Commit 50da5c18 authored by unknown's avatar unknown

merged


man/perror.1:
  Auto merged
scripts/mysqld_safe.sh:
  Auto merged
sql/gen_lex_hash.cc:
  Auto merged
sql/ha_myisam.cc:
  Auto merged
sql/item.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
strings/ctype-tis620.c:
  Auto merged
mysql-test/r/analyse.result:
  ul
mysql-test/r/group_by.result:
  ul
mysql-test/r/select.result:
  ul
parents a4aaac02 c7551b88
.TH perror 1 "19 December 2000" "MySQL 3.23" "MySQL database" .TH perror 1 "19 December 2000" "MySQL 3.23" "MySQL database"
.SH NAME .SH NAME
.BR perror perror \- describes a system or MySQL error code.
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...]]
.SH SYNOPSIS .SH SYNOPSIS
.B perror perror [OPTIONS] [ERRORCODE [ERRORCODE...]]
.RB [ \-? | \-\-help ]
.RB [ \-I | \-\-info ]
.RB [ \-s | \-\-silent ]
.RB [ \-v | \-\-verbose ]
.RB [ \-V | \-\-version ]
.SH DESCRIPTION .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 .TP
.BR \-? | \-\-help .BR \-? | \-\-help
Displays this help and exits. Displays this help and exits.
......
...@@ -3,9 +3,11 @@ ...@@ -3,9 +3,11 @@
# #
drop table if exists t1,t2; drop table if exists t1,t2;
create table t1 (i int, j int); create table t1 (i int, j int, empty_string char(10), bool char(1), d date);
insert into t1 values (1,2), (3,4), (5,6), (7,8); insert into t1 values (1,2,"","Y","2002-03-03"), (3,4,"","N","2002-03-04"), (5,6,"","Y","2002-03-04"), (7,8,"","N","2002-03-05");
select * from t1 procedure analyse(); select * from t1 procedure analyse();
select * from t1 procedure analyse(2);
create table t2 select * from t1 procedure analyse(); create table t2 select * from t1 procedure analyse();
select * from t2; select * from t2;
drop table t1,t2; drop table t1,t2;
...@@ -68,7 +68,8 @@ CREATE TABLE t1 ( ...@@ -68,7 +68,8 @@ CREATE TABLE t1 (
INSERT INTO t1 VALUES (1,'1970-01-01','1997-10-17 00:00:00',2529,1,21000,11886,'check',0,'F',16200,6); INSERT INTO t1 VALUES (1,'1970-01-01','1997-10-17 00:00:00',2529,1,21000,11886,'check',0,'F',16200,6);
!$1056 SELECT COUNT(P.URID),SUM(P.amount),P.method, MIN(PP.recdate+0) > 19980501000000 AS IsNew FROM t1 AS P JOIN t1 as PP WHERE P.URID = PP.URID GROUP BY method,IsNew; --error 1056
SELECT COUNT(P.URID),SUM(P.amount),P.method, MIN(PP.recdate+0) > 19980501000000 AS IsNew FROM t1 AS P JOIN t1 as PP WHERE P.URID = PP.URID GROUP BY method,IsNew;
drop table t1; drop table t1;
...@@ -255,6 +256,14 @@ select sql_big_result score,count(*) from t1 group by score desc; ...@@ -255,6 +256,14 @@ select sql_big_result score,count(*) from t1 group by score desc;
drop table t1; 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;
# Compare with hash keys # Compare with hash keys
# #
......
...@@ -1722,10 +1722,26 @@ drop table t4, t3, t2, t1; ...@@ -1722,10 +1722,26 @@ drop table t4, t3, t2, t1;
# #
# Test of DO # Test of DO
#
DO 1; DO 1;
DO benchmark(100,1+1),1,1; DO benchmark(100,1+1),1,1;
#
# random in WHERE clause
#
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 TABLE t1;
# #
# Test of bug with SUM(CASE...) # Test of bug with SUM(CASE...)
# #
...@@ -1794,10 +1810,11 @@ select * from t1 natural right join (t1 as t2 left join t1 as t3 using (a)); ...@@ -1794,10 +1810,11 @@ select * from t1 natural right join (t1 as t2 left join t1 as t3 using (a));
select * from t1 natural join (t1 as t2 left join t1 as t3 using (a)); select * from t1 natural join (t1 as t2 left join t1 as t3 using (a));
select * from (t1 as t2 left join t1 as t3 using (a)) natural join t1; select * from (t1 as t2 left join t1 as t3 using (a)) natural join t1;
drop table t1; drop table t1;
drop table if exists t1,t2;
CREATE TABLE t1 ( aa char(2), id int(11) NOT NULL auto_increment, t2_id int(11) NOT NULL default '0', PRIMARY KEY (id), KEY replace_id (t2_id)) TYPE=MyISAM; CREATE TABLE t1 ( aa char(2), id int(11) NOT NULL auto_increment, t2_id int(11) NOT NULL default '0', PRIMARY KEY (id), KEY replace_id (t2_id)) TYPE=MyISAM;
INSERT INTO t1 VALUES ("1",8264,2506),("2",8299,2517),("3",8301,2518),("4",8302,2519),("5",8303,2520),("6",8304,2521),("7",8305,2522); INSERT INTO t1 VALUES ("1",8264,2506),("2",8299,2517),("3",8301,2518),("4",8302,2519),("5",8303,2520),("6",8304,2521),("7",8305,2522);
CREATE TABLE t2 ( id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) TYPE=MyISAM; CREATE TABLE t2 ( id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) TYPE=MyISAM;
INSERT INTO t2 VALUES (2517), (2518), (2519), (2520), (2521), (2522); INSERT INTO t2 VALUES (2517), (2518), (2519), (2520), (2521), (2522);
select * from t1, t2 WHERE t1.t2_id = t2.id and t1.t2_id > 0 order by t1.id LIMIT 0, 5; select * from t1, t2 WHERE t1.t2_id = t2.id and t1.t2_id > 0 order by t1.id LIMIT 0, 5;
drop table if exists t1,t2; drop table t1,t2;
...@@ -39,8 +39,8 @@ parse_arguments() { ...@@ -39,8 +39,8 @@ parse_arguments() {
--datadir=*) DATADIR=`echo "$arg" | sed -e "s;--datadir=;;"` ;; --datadir=*) DATADIR=`echo "$arg" | sed -e "s;--datadir=;;"` ;;
--pid-file=*) pid_file=`echo "$arg" | sed -e "s;--pid-file=;;"` ;; --pid-file=*) pid_file=`echo "$arg" | sed -e "s;--pid-file=;;"` ;;
--user=*) --user=*)
if [ $SET_USER == 0 ] if test $SET_USER -eq 0
then then
user=`echo "$arg" | sed -e "s;--[^=]*=;;"` ; SET_USER=1 user=`echo "$arg" | sed -e "s;--[^=]*=;;"` ; SET_USER=1
fi fi
;; ;;
......
...@@ -294,7 +294,7 @@ void print_arrays() ...@@ -294,7 +294,7 @@ void print_arrays()
function_plus,function_mod); function_plus,function_mod);
int *prva= (int*) my_alloca(sizeof(int)*function_mod); int *prva= (int*) my_alloca(sizeof(int)*function_mod);
for (i=0 ; i <= function_mod; i++) for (i=0 ; i < function_mod; i++)
prva[i]= max_symbol; prva[i]= max_symbol;
for (i=0;i<size;i++) for (i=0;i<size;i++)
......
...@@ -195,6 +195,17 @@ bool Item_field::get_date(TIME *ltime,bool fuzzydate) ...@@ -195,6 +195,17 @@ bool Item_field::get_date(TIME *ltime,bool fuzzydate)
return 0; 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) bool Item_field::get_time(TIME *ltime)
{ {
if ((null_value=field->is_null()) || field->get_time(ltime)) if ((null_value=field->is_null()) || field->get_time(ltime))
......
...@@ -83,6 +83,8 @@ public: ...@@ -83,6 +83,8 @@ public:
virtual void split_sum_func(List<Item> &fields) {} virtual void split_sum_func(List<Item> &fields) {}
virtual bool get_date(TIME *ltime,bool fuzzydate); virtual bool get_date(TIME *ltime,bool fuzzydate);
virtual bool get_time(TIME *ltime); virtual bool get_time(TIME *ltime);
virtual bool get_date_result(TIME *ltime,bool fuzzydate)
{ return get_date(ltime,fuzzydate); }
virtual bool is_null() { return 0; } virtual bool is_null() { return 0; }
virtual unsigned int size_of()= 0; virtual unsigned int size_of()= 0;
virtual void top_level_item() {} virtual void top_level_item() {}
...@@ -142,8 +144,9 @@ public: ...@@ -142,8 +144,9 @@ public:
return field->result_type(); return field->result_type();
} }
Field *tmp_table_field(TABLE *t_arg=(TABLE *)0) { return result_field; } Field *tmp_table_field(TABLE *t_arg=(TABLE *)0) { return result_field; }
bool get_date(TIME *ltime,bool fuzzydate); bool get_date(TIME *ltime,bool fuzzydate);
bool get_time(TIME *ltime); bool get_date_result(TIME *ltime,bool fuzzydate);
bool get_time(TIME *ltime);
bool is_null() { return field->is_null(); } bool is_null() { return field->is_null(); }
unsigned int size_of() { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
...@@ -411,8 +414,8 @@ public: ...@@ -411,8 +414,8 @@ public:
return (*ref)->null_value; return (*ref)->null_value;
} }
bool get_date(TIME *ltime,bool fuzzydate) 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(THD *thd, String *tmp) { return (*ref)->send(thd, tmp); } bool send(THD *thd, String *tmp) { return (*ref)->send(thd, tmp); }
void make_field(Send_field *field) { (*ref)->make_field(field); } void make_field(Send_field *field) { (*ref)->make_field(field); }
......
...@@ -241,14 +241,16 @@ bool test_if_number(NUM_INFO *info, const char *str, uint str_len) ...@@ -241,14 +241,16 @@ bool test_if_number(NUM_INFO *info, const char *str, uint str_len)
} }
else else
return 0; return 0;
} //test_if_number }
// Stores the biggest and the smallest value from current 'info' /*
// to ev_num_info Stores the biggest and the smallest value from current 'info'
// If info contains an ulonglong number, which is bigger than to ev_num_info
// biggest positive number able to be stored in a longlong variable If info contains an ulonglong number, which is bigger than
// and is marked as negative, function will return 0, else 1. biggest positive number able to be stored in a longlong variable
and is marked as negative, function will return 0, else 1.
*/
bool get_ev_num_info(EV_NUM_INFO *ev_info, NUM_INFO *info, const char *num) bool get_ev_num_info(EV_NUM_INFO *ev_info, NUM_INFO *info, const char *num)
{ {
...@@ -276,11 +278,13 @@ void free_string(String *s) ...@@ -276,11 +278,13 @@ void free_string(String *s)
s->free(); s->free();
} }
void field_str::add() void field_str::add()
{ {
char buff[MAX_FIELD_WIDTH], *ptr; char buff[MAX_FIELD_WIDTH], *ptr;
String s(buff, sizeof(buff)), *res; String s(buff, sizeof(buff)), *res;
ulong length; ulong length;
TREE_ELEMENT *element;
if (!(res = item->val_str(&s))) if (!(res = item->val_str(&s)))
{ {
...@@ -426,9 +430,11 @@ void field_real::add() ...@@ -426,9 +430,11 @@ void field_real::add()
room_in_tree = 0; // Remove tree, out of RAM ? room_in_tree = 0; // Remove tree, out of RAM ?
delete_tree(&tree); delete_tree(&tree);
} }
// if element->count == 1, this element can be found only once from tree /*
// if element->count == 2, or more, this element is already in tree if element->count == 1, this element can be found only once from tree
else if (element->count == 1 && (tree_elements++) > pc->max_tree_elements) if element->count == 2, or more, this element is already in tree
*/
else if (element->count == 1 && (tree_elements++) >= pc->max_tree_elements)
{ {
room_in_tree = 0; // Remove tree, too many elements room_in_tree = 0; // Remove tree, too many elements
delete_tree(&tree); delete_tree(&tree);
...@@ -457,6 +463,7 @@ void field_real::add() ...@@ -457,6 +463,7 @@ void field_real::add()
} }
} // field_real::add } // field_real::add
void field_longlong::add() void field_longlong::add()
{ {
char buff[MAX_FIELD_WIDTH]; char buff[MAX_FIELD_WIDTH];
...@@ -479,9 +486,11 @@ void field_longlong::add() ...@@ -479,9 +486,11 @@ void field_longlong::add()
room_in_tree = 0; // Remove tree, out of RAM ? room_in_tree = 0; // Remove tree, out of RAM ?
delete_tree(&tree); delete_tree(&tree);
} }
// if element->count == 1, this element can be found only once from tree /*
// if element->count == 2, or more, this element is already in tree if element->count == 1, this element can be found only once from tree
else if (element->count == 1 && (tree_elements++) > pc->max_tree_elements) if element->count == 2, or more, this element is already in tree
*/
else if (element->count == 1 && (tree_elements++) >= pc->max_tree_elements)
{ {
room_in_tree = 0; // Remove tree, too many elements room_in_tree = 0; // Remove tree, too many elements
delete_tree(&tree); delete_tree(&tree);
...@@ -533,9 +542,11 @@ void field_ulonglong::add() ...@@ -533,9 +542,11 @@ void field_ulonglong::add()
room_in_tree = 0; // Remove tree, out of RAM ? room_in_tree = 0; // Remove tree, out of RAM ?
delete_tree(&tree); delete_tree(&tree);
} }
// if element->count == 1, this element can be found only once from tree /*
// if element->count == 2, or more, this element is already in tree if element->count == 1, this element can be found only once from tree
else if (element->count == 1 && (tree_elements++) > pc->max_tree_elements) if element->count == 2, or more, this element is already in tree
*/
else if (element->count == 1 && (tree_elements++) >= pc->max_tree_elements)
{ {
room_in_tree = 0; // Remove tree, too many elements room_in_tree = 0; // Remove tree, too many elements
delete_tree(&tree); delete_tree(&tree);
...@@ -615,14 +626,16 @@ bool analyse::end_of_records() ...@@ -615,14 +626,16 @@ bool analyse::end_of_records()
func_items[8]->null_value = 1; func_items[8]->null_value = 1;
else else
func_items[8]->set(res->ptr(), res->length()); func_items[8]->set(res->ptr(), res->length());
// count the dots, quotas, etc. in (ENUM("a","b","c"...)) /*
// if tree has been removed, don't suggest ENUM. count the dots, quotas, etc. in (ENUM("a","b","c"...))
// treemem is used to measure the size of tree for strings, If tree has been removed, don't suggest ENUM.
// tree_elements is used to count the elements in tree in case of numbers. treemem is used to measure the size of tree for strings,
// max_treemem tells how long the string starting from ENUM("... and tree_elements is used to count the elements
// ending to ..") shall at maximum be. If case is about numbers, max_treemem tells how long the string starting from ENUM("... and
// max_tree_elements will tell the length of the above, now ending to ..") shall at maximum be. If case is about numbers,
// every number is considered as length 1 max_tree_elements will tell the length of the above, now
every number is considered as length 1
*/
if (((*f)->treemem || (*f)->tree_elements) && if (((*f)->treemem || (*f)->tree_elements) &&
(*f)->tree.elements_in_tree && (*f)->tree.elements_in_tree &&
(((*f)->treemem ? max_treemem : max_tree_elements) > (((*f)->treemem ? max_treemem : max_tree_elements) >
...@@ -665,6 +678,7 @@ bool analyse::end_of_records() ...@@ -665,6 +678,7 @@ bool analyse::end_of_records()
ans.append("DATETIME", 8); ans.append("DATETIME", 8);
break; break;
case FIELD_TYPE_DATE: case FIELD_TYPE_DATE:
case FIELD_TYPE_NEWDATE:
ans.append("DATE", 4); ans.append("DATE", 4);
break; break;
case FIELD_TYPE_SET: case FIELD_TYPE_SET:
...@@ -676,9 +690,6 @@ bool analyse::end_of_records() ...@@ -676,9 +690,6 @@ bool analyse::end_of_records()
case FIELD_TYPE_TIME: case FIELD_TYPE_TIME:
ans.append("TIME", 4); ans.append("TIME", 4);
break; break;
case FIELD_TYPE_NEWDATE:
ans.append("NEWDATE", 7);
break;
case FIELD_TYPE_DECIMAL: case FIELD_TYPE_DECIMAL:
ans.append("DECIMAL", 7); ans.append("DECIMAL", 7);
// if item is FIELD_ITEM, it _must_be_ Field_num in this case // if item is FIELD_ITEM, it _must_be_ Field_num in this case
......
...@@ -1693,8 +1693,7 @@ Field *find_field_in_table(THD *thd,TABLE *table,const char *name,uint length, ...@@ -1693,8 +1693,7 @@ Field *find_field_in_table(THD *thd,TABLE *table,const char *name,uint length,
else else
thd->dupp_field=field; thd->dupp_field=field;
} }
if (check_grants && !thd->master_access && if (check_grants && check_grant_column(thd,table,name,length))
check_grant_column(thd,table,name,length))
return WRONG_GRANT; return WRONG_GRANT;
return field; return field;
} }
...@@ -1719,7 +1718,8 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables) ...@@ -1719,7 +1718,8 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables)
{ {
found_table=1; found_table=1;
Field *find=find_field_in_table(thd,tables->table,name,length, Field *find=find_field_in_table(thd,tables->table,name,length,
grant_option && !thd->master_access,1); grant_option &&
tables->grant.want_privilege ,1);
if (find) if (find)
{ {
if (find == WRONG_GRANT) if (find == WRONG_GRANT)
...@@ -1758,8 +1758,7 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables) ...@@ -1758,8 +1758,7 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables)
for (; tables ; tables=tables->next) for (; tables ; tables=tables->next)
{ {
Field *field=find_field_in_table(thd,tables->table,name,length, Field *field=find_field_in_table(thd,tables->table,name,length,
grant_option && grant_option && tables->grant.want_privilege ,allow_rowid);
!thd->master_access, allow_rowid);
if (field) if (field)
{ {
if (field == WRONG_GRANT) if (field == WRONG_GRANT)
......
...@@ -2527,6 +2527,12 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond) ...@@ -2527,6 +2527,12 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
{ {
JOIN_TAB *tab=join->join_tab+i; JOIN_TAB *tab=join->join_tab+i;
table_map current_map= tab->table->map; table_map current_map= tab->table->map;
/*
Following force including random expression in last table condition.
It solve problem with select like SELECT * FROM t1 WHERE rand() > 0.5
*/
if (i == join->tables-1)
current_map|= RAND_TABLE_BIT;
bool use_quick_range=0; bool use_quick_range=0;
used_tables|=current_map; used_tables|=current_map;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment