summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2003-03-12 16:43:37 +0200
committerunknown <monty@mashka.mysql.fi>2003-03-12 16:43:37 +0200
commitf318f681b419e35219b97b5ba51614e699734bfe (patch)
tree7e61013e9c9c316b0c7590aec79de7d5118e6692
parentdd122f05f62613e06e6b7b4d1d3466912b2ff1ad (diff)
parent653e95411c8eefe11fb9bae9d842cd451849186d (diff)
downloadmariadb-git-f318f681b419e35219b97b5ba51614e699734bfe.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-3.23
into mashka.mysql.fi:/home/my/mysql-3.23
-rwxr-xr-xman/perror.115
-rw-r--r--mysql-test/r/group_by.result1
-rw-r--r--mysql-test/r/select.result1
-rw-r--r--mysql-test/t/group_by.test8
-rw-r--r--mysql-test/t/select.test17
-rw-r--r--scripts/safe_mysqld.sh4
-rw-r--r--sql/item.cc11
-rw-r--r--sql/item.h11
-rw-r--r--sql/net_serv.cc2
-rw-r--r--sql/sql_select.cc2
-rw-r--r--strings/ctype-tis620.c30
11 files changed, 69 insertions, 33 deletions
diff --git a/man/perror.1 b/man/perror.1
index bd5a4211f4b..eb6c9f39d56 100755
--- a/man/perror.1
+++ b/man/perror.1
@@ -1,17 +1,12 @@
.TH perror 1 "19 December 2000" "MySQL 3.23" "MySQL database"
.SH NAME
-.BR perror
-can be used to display a description for a system error code, or an MyISAM/ISAM table handler error code. The error messages are mostly system dependent.
-.SH USAGE
-perror [OPTIONS] [ERRORCODE [ERRORCODE...]]
+perror \- describes a system or MySQL error code.
.SH SYNOPSIS
-.B perror
-.RB [ \-? | \-\-help ]
-.RB [ \-I | \-\-info ]
-.RB [ \-s | \-\-silent ]
-.RB [ \-v | \-\-verbose ]
-.RB [ \-V | \-\-version ]
+perror [OPTIONS] [ERRORCODE [ERRORCODE...]]
.SH DESCRIPTION
+Can be used to display a description for a system error code, or an MyISAM/ISAM table handler error code.
+The error messages are mostly system dependent.
+.SH OPTIONS
.TP
.BR \-? | \-\-help
Displays this help and exits.
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index 113f8325685..0073827056d 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -128,3 +128,4 @@ a MAX(b) ELT(MAX(b), 'a', 'b', 'c', 'd', 'e', 'f')
a MAX(b) MAKE_SET(MAX(b), 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h')
1 4 c
10 43 a,b,d,f
+a c count(distinct rand())
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index 5ac5de05f97..dcb796b8e00 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -1793,3 +1793,4 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par
t2 0 PRIMARY 1 auto A 1199 NULL NULL
t2 0 fld1 1 fld1 A 1199 NULL NULL
t2 1 fld3 1 fld3 A NULL NULL NULL
+1
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index 6e256d7896f..20e11713d31 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -346,3 +346,11 @@ select a, MAX(b), CONCAT_WS(MAX(b), '43', '4', '5') from t1 group by a;
select a, MAX(b), ELT(MAX(b), 'a', 'b', 'c', 'd', 'e', 'f') from t1 group by a;
select a, MAX(b), MAKE_SET(MAX(b), 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h') from t1 group by a;
drop table t1;
+
+# not purely group_by bug, but group_by is involved...
+
+create table t1 (a date default null, b date default null);
+insert t1 values ('1999-10-01','2000-01-10'), ('1997-01-01','1998-10-01');
+select a,min(b) c,count(distinct rand()) from t1 group by a having c<a + interval 1 day;
+drop table t1;
+
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index cdb6ee57e0f..2caadd99dbb 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -1713,7 +1713,22 @@ show full columns from t2 from test like 's%';
show keys from t2;
#
+# random in WHERE clause
+#
+
+drop table t1;
+CREATE TABLE t1 (
+ id mediumint(8) unsigned NOT NULL auto_increment,
+ pseudo varchar(35) NOT NULL default '',
+ PRIMARY KEY (id),
+ UNIQUE KEY pseudo (pseudo)
+);
+INSERT INTO t1 (pseudo) VALUES ('test');
+INSERT INTO t1 (pseudo) VALUES ('test1');
+SELECT 1 from t1 where rand() > 2;
+
+#
# Drop the test tables
#
-drop table t4, t3,t2, t1;
+drop table t4, t3, t2, t1;
diff --git a/scripts/safe_mysqld.sh b/scripts/safe_mysqld.sh
index a8ca3537cb3..6b7e16c57b0 100644
--- a/scripts/safe_mysqld.sh
+++ b/scripts/safe_mysqld.sh
@@ -34,8 +34,8 @@ parse_arguments() {
--datadir=*) DATADIR=`echo "$arg" | sed -e "s;--[^=]*=;;"` ;;
--pid-file=*) pid_file=`echo "$arg" | sed -e "s;--[^=]*=;;"` ;;
--user=*)
- if [ $SET_USER == 0 ]
- then
+ if test $SET_USER -eq 0
+ then
user=`echo "$arg" | sed -e "s;--[^=]*=;;"` ; SET_USER=1
fi
;;
diff --git a/sql/item.cc b/sql/item.cc
index 9b4274ab71d..a2d9f0b2575 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -194,6 +194,17 @@ bool Item_field::get_date(TIME *ltime,bool fuzzydate)
return 0;
}
+bool Item_field::get_date_result(TIME *ltime,bool fuzzydate)
+{
+ if ((null_value=result_field->is_null()) ||
+ result_field->get_date(ltime,fuzzydate))
+ {
+ bzero((char*) ltime,sizeof(*ltime));
+ return 1;
+ }
+ return 0;
+}
+
bool Item_field::get_time(TIME *ltime)
{
if ((null_value=field->is_null()) || field->get_time(ltime))
diff --git a/sql/item.h b/sql/item.h
index 408010d211a..3cf5a17805c 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -82,6 +82,8 @@ public:
virtual void split_sum_func(List<Item> &fields) {}
virtual bool get_date(TIME *ltime,bool fuzzydate);
virtual bool get_time(TIME *ltime);
+ virtual bool get_date_result(TIME *ltime,bool fuzzydate)
+ { return get_date(ltime,fuzzydate); }
};
@@ -129,8 +131,9 @@ public:
return field->result_type();
}
Field *tmp_table_field() { return result_field; }
- bool get_date(TIME *ltime,bool fuzzydate);
- bool get_time(TIME *ltime);
+ bool get_date(TIME *ltime,bool fuzzydate);
+ bool get_date_result(TIME *ltime,bool fuzzydate);
+ bool get_time(TIME *ltime);
};
@@ -332,8 +335,8 @@ public:
return tmp;
}
bool get_date(TIME *ltime,bool fuzzydate)
- {
- return (null_value=(*ref)->get_date(ltime,fuzzydate));
+ {
+ return (null_value=(*ref)->get_date_result(ltime,fuzzydate));
}
bool send(String *tmp) { return (*ref)->send(tmp); }
void make_field(Send_field *field) { (*ref)->make_field(field); }
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index c6a0b8c5b3e..c8c774d365f 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -181,7 +181,7 @@ static my_bool net_realloc(NET *net, ulong length)
void net_clear(NET *net)
{
#ifndef EXTRA_DEBUG
- int count; // One may get 'unused' warning
+ int count; /* One may get 'unused' warning */
bool is_blocking=vio_is_blocking(net->vio);
if (is_blocking)
vio_blocking(net->vio, FALSE);
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 8444a451965..bae64969fcd 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -2257,6 +2257,8 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
{
JOIN_TAB *tab=join->join_tab+i;
table_map current_map= tab->table->map;
+ if (i == join->tables-1)
+ current_map|= RAND_TABLE_BIT;
bool use_quick_range=0;
used_tables|=current_map;
diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c
index 1c0acc38e24..c39930179cf 100644
--- a/strings/ctype-tis620.c
+++ b/strings/ctype-tis620.c
@@ -444,8 +444,8 @@ static uchar* thai2sortable(const uchar * tstr,uint len)
const uchar* p = tstr;
uchar *outBuf;
-// uchar *pRight1, *pRight2, *pRight3, *pRight4;
-// uchar *pLeft1, *pLeft2, *pLeft3, *pLeft4;
+/* uchar *pRight1, *pRight2, *pRight3, *pRight4; */
+/* uchar *pLeft1, *pLeft2, *pLeft3, *pLeft4; */
uchar *pRight1, *pRight2, *pRight3;
uchar *pLeft1, *pLeft2, *pLeft3;
uint bufSize;
@@ -480,11 +480,11 @@ static uchar* thai2sortable(const uchar * tstr,uint len)
*pRight1++ = t_ctype[p[1]][0];
*pRight2++ = t_ctype[p[1]][1];
*pRight3++ = t_ctype[p[1]][2];
-// *pRight4++ = t_ctype[p[1]][3];
+/* *pRight4++ = t_ctype[p[1]][3]; */
*pRight1++ = t_ctype[*p][0];
*pRight2++ = t_ctype[*p][1];
*pRight3++ = t_ctype[*p][2];
-// *pRight4++ = t_ctype[*p][3];
+/* *pRight4++ = t_ctype[*p][3]; */
len--;
p += 2;
} else {
@@ -501,17 +501,17 @@ static uchar* thai2sortable(const uchar * tstr,uint len)
}
*pRight1++ = L2_BLANK;
*pRight2++ = L3_BLANK;
-// *pRight3++ = L4_BLANK;
+/* *pRight3++ = L4_BLANK; */
*pRight3++ = '\0';
-// *pRight4++ = '\0';
+/* *pRight4++ = '\0'; */
memcpy(pRight1, pLeft2, pRight2 - pLeft2);
pRight1 += pRight2 - pLeft2;
memcpy(pRight1, pLeft3, pRight3 - pLeft3);
-// pRight1 += pRight3 - pLeft3;
-// memcpy(pRight1, pLeft4, pRight4 - pLeft4);
+/* pRight1 += pRight3 - pLeft3; */
+/* memcpy(pRight1, pLeft4, pRight4 - pLeft4); */
free(pLeft2);
free(pLeft3);
-// free(pLeft4);
+/* free(pLeft4); */
return(outBuf);
}
@@ -603,22 +603,22 @@ my_bool my_like_range_tis620(const char *ptr, uint ptr_length, pchar escape,
{
if (*ptr == escape && ptr+1 != end)
{
- ptr++; // Skipp escape
+ ptr++; /* Skipp escape */
*min_str++= *max_str++ = *ptr;
continue;
}
- if (*ptr == wild_one) // '_' in SQL
+ if (*ptr == wild_one) /* '_' in SQL */
{
- *min_str++='\0'; // This should be min char
+ *min_str++='\0'; /* This should be min char */
*max_str++=max_sort_chr;
continue;
}
- if (*ptr == wild_many) // '%' in SQL
+ if (*ptr == wild_many) /* '%' in SQL */
{
*min_length= (uint) (min_str - min_org);
*max_length=res_length;
do {
- *min_str++ = ' '; // Because if key compression
+ *min_str++ = ' '; /* Because if key compression */
*max_str++ = max_sort_chr;
} while (min_str != min_end);
return 0;
@@ -628,7 +628,7 @@ my_bool my_like_range_tis620(const char *ptr, uint ptr_length, pchar escape,
*min_length= *max_length = (uint) (min_str - min_org);
while (min_str != min_end)
- *min_str++ = *max_str++ = ' '; // Because if key compression
+ *min_str++ = *max_str++ = ' '; /* Because if key compression */
return 0;
}