From 7873b89fc50d420a5f538a5b60faf79131f86c4f Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 5 Apr 2004 13:56:05 +0300 Subject: [PATCH 01/12] Fixed many compiler warnings Fixed bugs in group_concat with ORDER BY and DISTINCT (Bugs #2695, #3381 and #3319) Fixed crash when doing rollback in slave and the io thread catched up with the sql thread Set locked_in_memory properly include/mysql_com.h: Fixed compiler warning libmysqld/emb_qcache.cc: Removed not used variable libmysqld/lib_sql.cc: Removed not used variable myisam/mi_locking.c: Added comment myisam/mi_rnext.c: Fixed bug in concurrent insert myisam/mi_rprev.c: Simple optimization mysql-test/r/func_gconcat.result: New tests mysql-test/t/func_gconcat.test: New tests mysql-test/t/func_group.test: Cleanup sql-common/client.c: Removed compiler warning sql/derror.cc: Better comments sql/field.cc: Removed not used function/variable sql/field.h: Removed not needed variable sql/ha_innodb.cc: Removed not used function sql/item.cc: Fixed compiler warning sql/item_cmpfunc.cc: Fixed compiler warning sql/item_func.cc: Fixed compiler warning sql/item_geofunc.cc: Fixed compiler warning sql/item_sum.cc: Fixed bugs in group_concat and added more comments (Bugs #2695, #3381 and #3319) - field->abs_offset was not needed - Wrong assumption of field order in temporary table - Some not used variables removed - Added ORDER BY fields after argument fields so that code in sql_select.cc can move all fields to point to temporary tables, if needed. - Optimized loops sql/item_sum.h: Bug fixing and cleanup of group_concat() sql/log.cc: Removed wrong comment sql/log_event.cc: Removed compiler warning sql/mysqld.cc: Set locked_in_memory properly sql/protocol.cc: Removed compiler warning sql/set_var.cc: Code cleanup sql/slave.cc: Fixed crash when doing rollback in slave and the io thread catched up with the sql thread sql/sql_cache.cc: Removed compiler warnings sql/sql_derived.cc: Removed not used variable sql/sql_insert.cc: Removed compiler warnings sql/sql_lex.cc: Removed not used lable sql/sql_lex.h: Removed compiler warnings sql/sql_parse.cc: Removed compiler warnings sql/sql_prepare.cc: Removed compiler warnings sql/sql_select.cc: Removed not used variables Added function comments sql/sql_show.cc: Removed compiler warnings sql/sql_yacc.yy: Fix for ORDER BY handling in GROUP_CONCAT() --- include/mysql_com.h | 2 +- libmysqld/emb_qcache.cc | 1 - libmysqld/lib_sql.cc | 8 +- myisam/mi_locking.c | 15 ++ myisam/mi_rnext.c | 64 ++++--- myisam/mi_rprev.c | 27 +-- mysql-test/r/func_gconcat.result | 84 +++++++-- mysql-test/t/func_gconcat.test | 70 ++++++-- mysql-test/t/func_group.test | 1 - sql-common/client.c | 2 +- sql/derror.cc | 4 +- sql/field.cc | 11 +- sql/field.h | 1 - sql/ha_innodb.cc | 13 -- sql/item.cc | 1 - sql/item_cmpfunc.cc | 4 - sql/item_func.cc | 3 - sql/item_geofunc.cc | 16 +- sql/item_sum.cc | 281 ++++++++++++++++++------------- sql/item_sum.h | 83 ++++----- sql/log.cc | 1 - sql/log_event.cc | 2 +- sql/mysqld.cc | 3 +- sql/protocol.cc | 2 +- sql/set_var.cc | 3 +- sql/slave.cc | 31 +++- sql/sql_cache.cc | 4 +- sql/sql_derived.cc | 1 - sql/sql_insert.cc | 6 +- sql/sql_lex.cc | 2 +- sql/sql_lex.h | 2 +- sql/sql_parse.cc | 17 +- sql/sql_prepare.cc | 3 +- sql/sql_select.cc | 35 ++-- sql/sql_show.cc | 7 +- sql/sql_yacc.yy | 13 +- 36 files changed, 496 insertions(+), 327 deletions(-) diff --git a/include/mysql_com.h b/include/mysql_com.h index 4b94fc71c0c..578ef964d8d 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -119,7 +119,7 @@ enum enum_server_command #define CLIENT_SECURE_CONNECTION 32768 /* New 4.1 authentication */ #define CLIENT_MULTI_STATEMENTS 65536 /* Enable/disable multi-stmt support */ #define CLIENT_MULTI_RESULTS 131072 /* Enable/disable multi-results */ -#define CLIENT_REMEMBER_OPTIONS ((ulong) (1L << 31)) +#define CLIENT_REMEMBER_OPTIONS (((ulong) 1) << 31) #define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */ #define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */ diff --git a/libmysqld/emb_qcache.cc b/libmysqld/emb_qcache.cc index 4dac154ab80..0b6416632b7 100644 --- a/libmysqld/emb_qcache.cc +++ b/libmysqld/emb_qcache.cc @@ -428,7 +428,6 @@ int emb_load_querycache_result(THD *thd, Querycache_stream *src) *prev_row= row; row->data= columns; MYSQL_ROW col_end= columns + mysql->field_count; - uint len; for (; columns < col_end; columns++) src->load_column(&data->alloc, columns); diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 6fb23f8f00d..cfb50d3907a 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -332,10 +332,10 @@ char ** copy_arguments_ptr= 0; int init_embedded_server(int argc, char **argv, char **groups) { - char glob_hostname[FN_REFLEN]; - - /* This mess is to allow people to call the init function without - * having to mess with a fake argv */ + /* + This mess is to allow people to call the init function without + having to mess with a fake argv + */ int *argcp; char ***argvp; int fake_argc = 1; diff --git a/myisam/mi_locking.c b/myisam/mi_locking.c index 816748d459a..b13ebfb4cad 100644 --- a/myisam/mi_locking.c +++ b/myisam/mi_locking.c @@ -286,6 +286,21 @@ void mi_copy_status(void* to,void *from) ((MI_INFO*) to)->state= &((MI_INFO*) from)->save_state; } + +/* + Check if should allow concurrent inserts + + IMPLEMENTATION + Don't allow concurrent inserts if we have a hole in the table. + + NOTES + Rtree indexes are disabled in mi_open() + + RETURN + 0 ok to use concurrent inserts + 1 not ok +*/ + my_bool mi_check_status(void* param) { MI_INFO *info=(MI_INFO*) param; diff --git a/myisam/mi_rnext.c b/myisam/mi_rnext.c index e1cf916d6d9..6e6056f98d9 100644 --- a/myisam/mi_rnext.c +++ b/myisam/mi_rnext.c @@ -57,47 +57,45 @@ int mi_rnext(MI_INFO *info, byte *buf, int inx) } else { - switch(info->s->keyinfo[inx].key_alg) - { - case HA_KEY_ALG_RTREE: + switch (info->s->keyinfo[inx].key_alg) { + case HA_KEY_ALG_RTREE: /* - Note that rtree doesn't support that the table - may be changed since last call, so we do need - to skip rows inserted by other threads like in btree + Note that rtree doesn't support that the table + may be changed since last call, so we do need + to skip rows inserted by other threads like in btree */ - error=rtree_get_next(info,inx,info->lastkey_length); - break; + error= rtree_get_next(info,inx,info->lastkey_length); + break; - case HA_KEY_ALG_BTREE: - default: - if (!changed) - { - error=_mi_search_next(info,info->s->keyinfo+inx,info->lastkey, - info->lastkey_length,flag, - info->s->state.key_root[inx]); - } - else - { - error=_mi_search(info,info->s->keyinfo+inx,info->lastkey, - USE_WHOLE_KEY,flag, info->s->state.key_root[inx]); - } - if (!error && info->s->concurrent_insert) - { - while (info->lastpos >= info->state->data_file_length) - { - /* Skip rows that are inserted by other threads since we got a lock */ - if ((error=_mi_search_next(info,info->s->keyinfo+inx,info->lastkey, - info->lastkey_length, - SEARCH_BIGGER, - info->s->state.key_root[inx]))) - break; - } - } + case HA_KEY_ALG_BTREE: + default: + if (!changed) + error= _mi_search_next(info,info->s->keyinfo+inx,info->lastkey, + info->lastkey_length,flag, + info->s->state.key_root[inx]); + else + error= _mi_search(info,info->s->keyinfo+inx,info->lastkey, + USE_WHOLE_KEY,flag, info->s->state.key_root[inx]); } } if (info->s->concurrent_insert) + { + if (!error) + { + while (info->lastpos >= info->state->data_file_length) + { + /* Skip rows inserted by other threads since we got a lock */ + if ((error=_mi_search_next(info,info->s->keyinfo+inx, + info->lastkey, + info->lastkey_length, + SEARCH_BIGGER, + info->s->state.key_root[inx]))) + break; + } + } rw_unlock(&info->s->key_root_lock[inx]); + } /* Don't clear if database-changed */ info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); info->update|= HA_STATE_NEXT_FOUND; diff --git a/myisam/mi_rprev.c b/myisam/mi_rprev.c index 4807e636252..b787210e037 100644 --- a/myisam/mi_rprev.c +++ b/myisam/mi_rprev.c @@ -52,21 +52,22 @@ int mi_rprev(MI_INFO *info, byte *buf, int inx) error=_mi_search(info,share->keyinfo+inx,info->lastkey, USE_WHOLE_KEY, flag, share->state.key_root[inx]); - if (!error) - { - while (info->lastpos >= info->state->data_file_length) - { - /* Skip rows that are inserted by other threads since we got a lock */ - if ((error=_mi_search_next(info,share->keyinfo+inx,info->lastkey, - info->lastkey_length, - SEARCH_SMALLER, - share->state.key_root[inx]))) - break; - } - } - if (share->concurrent_insert) + { + if (!error) + { + while (info->lastpos >= info->state->data_file_length) + { + /* Skip rows that are inserted by other threads since we got a lock */ + if ((error=_mi_search_next(info,share->keyinfo+inx,info->lastkey, + info->lastkey_length, + SEARCH_SMALLER, + share->state.key_root[inx]))) + break; + } + } rw_unlock(&share->key_root_lock[inx]); + } info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); info->update|= HA_STATE_PREV_FOUND; if (error) diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result index 5807bae6a06..3ab43ce11d5 100644 --- a/mysql-test/r/func_gconcat.result +++ b/mysql-test/r/func_gconcat.result @@ -136,17 +136,7 @@ grp ROUND(group_concat(a separator "")) 3 456789 drop table t1; create table t1 (grp int, c char(10)); -insert into t1 values (1,NULL); -insert into t1 values (2,"b"); -insert into t1 values (2,NULL); -insert into t1 values (3,"E"); -insert into t1 values (3,NULL); -insert into t1 values (3,"D"); -insert into t1 values (3,NULL); -insert into t1 values (3,NULL); -insert into t1 values (3,"D"); -insert into t1 values (4,""); -insert into t1 values (5,NULL); +insert into t1 values (1,NULL),(2,"b"),(2,NULL),(3,"E"),(3,NULL),(3,"D"),(3,NULL),(3,NULL),(3,"D"),(4,""),(5,NULL); select grp,group_concat(c order by c) from t1 group by grp; grp group_concat(c order by c) 1 NULL @@ -222,3 +212,75 @@ select group_concat(a1 order by (t1.a)) from t1; group_concat(a1 order by (t1.a)) b,a,c drop table t1, t2; +CREATE TABLE t1 (id1 tinyint(4) NOT NULL, id2 tinyint(4) NOT NULL); +INSERT INTO t1 VALUES (1, 1),(1, 2),(1, 3),(1, 4),(1, 5),(2, 1),(2, 2),(2, 3); +CREATE TABLE t2 (id1 tinyint(4) NOT NULL); +INSERT INTO t2 VALUES (1),(2),(3),(4),(5); +SELECT t1.id1, GROUP_CONCAT(t1.id2 ORDER BY t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 AND t1.id1=1 GROUP BY t1.id1; +id1 concat_id +1 1,2,3,4,5 +SELECT t1.id1, GROUP_CONCAT(t1.id2 ORDER BY t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1; +id1 concat_id +1 1,2,3,4,5 +2 1,2,3 +SELECT t1.id1, GROUP_CONCAT(t1.id2 ORDER BY t1.id2 DESC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1; +id1 concat_id +1 5,4,3,2,1 +2 3,2,1 +SELECT t1.id1, GROUP_CONCAT(t1.id2 ORDER BY 6-t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1; +id1 concat_id +1 5,4,3,2,1 +2 3,2,1 +SELECT t1.id1, GROUP_CONCAT(t1.id2,6-t1.id2 ORDER BY 6-t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1; +id1 concat_id +1 51,42,33,24,15 +2 33,24,15 +SELECT t1.id1, GROUP_CONCAT(t1.id2,6-t1.id2 ORDER BY 6-t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1; +id1 concat_id +1 51,42,33,24,15 +2 33,24,15 +SELECT t1.id1, GROUP_CONCAT(t1.id2,"/",6-t1.id2 ORDER BY 1+0,6-t1.id2,t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1; +id1 concat_id +1 5/1,4/2,3/3,2/4,1/5 +2 3/3,2/4,1/5 +drop table t1,t2; +create table t1 (s1 char(10), s2 int not null); +insert into t1 values ('a',2),('b',2),('c',1),('a',3),('b',4),('c',4); +select distinct s1 from t1 order by s2; +s1 +c +a +b +select group_concat(distinct s1) from t1; +group_concat(distinct s1) +a,b,c +select group_concat(distinct s1 order by s2) from t1 where s2 < 4; +group_concat(distinct s1 order by s2) +c,b,a +select group_concat(distinct s1 order by s2) from t1; +group_concat(distinct s1 order by s2) +c,b,a,c +drop table t1; +create table t1 (a int, c int); +insert into t1 values (1, 2), (2, 3), (2, 4), (3, 5); +create table t2 (a int, c int); +insert into t2 values (1, 5), (2, 4), (3, 3), (3,3); +select group_concat(c) from t1; +group_concat(c) +2,3,4,5 +select group_concat(c order by (select c from t2 where t2.a=t1.a limit 1)) as grp from t1; +grp +5,4,3,2 +select group_concat(c order by (select mid(group_concat(c order by a),1,5) from t2 where t2.a=t1.a)) as grp from t1; +grp +5,4,3,2 +select group_concat(c order by (select mid(group_concat(c order by a),1,5) from t2 where t2.a=t1.a) desc) as grp from t1; +grp +2,4,3,5 +select a,c,(select group_concat(c order by a) from t2 where a=t1.a) as grp from t1 order by grp; +a c grp +3 5 3,3 +2 3 4 +2 4 4 +1 2 5 +drop table t1,t2; diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test index d004c81f14e..87df427616a 100644 --- a/mysql-test/t/func_gconcat.test +++ b/mysql-test/t/func_gconcat.test @@ -50,22 +50,12 @@ select grp,group_concat(c order by grp desc) from t1 group by grp order by grp; select grp, group_concat(a separator "")+0 from t1 group by grp; select grp, group_concat(a separator "")+0.0 from t1 group by grp; select grp, ROUND(group_concat(a separator "")) from t1 group by grp; +drop table t1; # Test NULL values -drop table t1; create table t1 (grp int, c char(10)); -insert into t1 values (1,NULL); -insert into t1 values (2,"b"); -insert into t1 values (2,NULL); -insert into t1 values (3,"E"); -insert into t1 values (3,NULL); -insert into t1 values (3,"D"); -insert into t1 values (3,NULL); -insert into t1 values (3,NULL); -insert into t1 values (3,"D"); -insert into t1 values (4,""); -insert into t1 values (5,NULL); +insert into t1 values (1,NULL),(2,"b"),(2,NULL),(3,"E"),(3,NULL),(3,"D"),(3,NULL),(3,NULL),(3,"D"),(4,""),(5,NULL); select grp,group_concat(c order by c) from t1 group by grp; # Test warnings @@ -129,4 +119,58 @@ insert into t1 values (0,"a"),(0,"b"),(1,"c"); insert into t2 values (1),(2),(3); select group_concat(a1 order by (t1.a IN (select a0 from t2))) from t1; select group_concat(a1 order by (t1.a)) from t1; -drop table t1, t2; \ No newline at end of file +drop table t1, t2; + +# +# Problem with GROUP BY (Bug #2695) +# + +CREATE TABLE t1 (id1 tinyint(4) NOT NULL, id2 tinyint(4) NOT NULL); +INSERT INTO t1 VALUES (1, 1),(1, 2),(1, 3),(1, 4),(1, 5),(2, 1),(2, 2),(2, 3); +CREATE TABLE t2 (id1 tinyint(4) NOT NULL); +INSERT INTO t2 VALUES (1),(2),(3),(4),(5); +SELECT t1.id1, GROUP_CONCAT(t1.id2 ORDER BY t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 AND t1.id1=1 GROUP BY t1.id1; +SELECT t1.id1, GROUP_CONCAT(t1.id2 ORDER BY t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1; +SELECT t1.id1, GROUP_CONCAT(t1.id2 ORDER BY t1.id2 DESC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1; +SELECT t1.id1, GROUP_CONCAT(t1.id2 ORDER BY 6-t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1; + +# The following failed when it was run twice: +SELECT t1.id1, GROUP_CONCAT(t1.id2,6-t1.id2 ORDER BY 6-t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1; +SELECT t1.id1, GROUP_CONCAT(t1.id2,6-t1.id2 ORDER BY 6-t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1; + +SELECT t1.id1, GROUP_CONCAT(t1.id2,"/",6-t1.id2 ORDER BY 1+0,6-t1.id2,t1.id2 ASC) AS concat_id FROM t1, t2 WHERE t1.id1 = t2.id1 GROUP BY t1.id1; +drop table t1,t2; + +# +# Problem with distinct (Bug #3381) +# + +create table t1 (s1 char(10), s2 int not null); +insert into t1 values ('a',2),('b',2),('c',1),('a',3),('b',4),('c',4); +select distinct s1 from t1 order by s2; +select group_concat(distinct s1) from t1; +select group_concat(distinct s1 order by s2) from t1 where s2 < 4; +# The following is wrong and needs to be fixed ASAP +select group_concat(distinct s1 order by s2) from t1; +drop table t1; + +# +# Test with subqueries (Bug #3319) +# + +create table t1 (a int, c int); +insert into t1 values (1, 2), (2, 3), (2, 4), (3, 5); +create table t2 (a int, c int); +insert into t2 values (1, 5), (2, 4), (3, 3), (3,3); +select group_concat(c) from t1; +select group_concat(c order by (select c from t2 where t2.a=t1.a limit 1)) as grp from t1; + +select group_concat(c order by (select mid(group_concat(c order by a),1,5) from t2 where t2.a=t1.a)) as grp from t1; +select group_concat(c order by (select mid(group_concat(c order by a),1,5) from t2 where t2.a=t1.a) desc) as grp from t1; + +# The following returns random results as we are sorting on blob addresses +# select group_concat(c order by (select group_concat(c order by a) from t2 where t2.a=t1.a)) as grp from t1; +# select group_concat(c order by (select group_concat(c) from t2 where a=t1.a)) as grp from t1; + +select a,c,(select group_concat(c order by a) from t2 where a=t1.a) as grp from t1 order by grp; +drop table t1,t2; diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test index ce89cbe1b22..2bd4838f934 100644 --- a/mysql-test/t/func_group.test +++ b/mysql-test/t/func_group.test @@ -134,7 +134,6 @@ select max(t2.a1) from t1 left outer join t2 on t1.a2=t2.a1 and 1=0 where t2.a1= select max(t1.a2),max(t2.a1) from t1 left outer join t2 on t1.a1=10; drop table t1,t2; - # # Tests to check MIN/MAX query optimization # diff --git a/sql-common/client.c b/sql-common/client.c index b94f3e1de38..4a4de33269b 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -2044,7 +2044,7 @@ error: /* Free alloced memory */ end_server(mysql); mysql_close_free(mysql); - if (!(client_flag & CLIENT_REMEMBER_OPTIONS)) + if (!(((ulong) client_flag) & CLIENT_REMEMBER_OPTIONS)) mysql_close_free_options(mysql); } DBUG_RETURN(0); diff --git a/sql/derror.cc b/sql/derror.cc index 53d0dc5b7e5..09f43d20044 100644 --- a/sql/derror.cc +++ b/sql/derror.cc @@ -50,7 +50,7 @@ static bool read_texts(const char *file_name,const char ***point, char name[FN_REFLEN]; const char *buff; uchar head[32],*pos; - CHARSET_INFO *cset; + CHARSET_INFO *cset; // For future DBUG_ENTER("read_texts"); *point=0; // If something goes wrong @@ -137,7 +137,7 @@ err1: if (file != FERR) VOID(my_close(file,MYF(MY_WME))); unireg_abort(1); - DBUG_RETURN(1); // Impossible + DBUG_RETURN(1); // keep compiler happy } /* read_texts */ diff --git a/sql/field.cc b/sql/field.cc index 89c6464c5f0..89c955ed45a 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -161,13 +161,6 @@ static bool test_if_real(const char *str,int length, CHARSET_INFO *cs) } #endif -static inline uint field_length_without_space(const char *ptr, uint length) -{ - const char *end= ptr+length; - while (end > ptr && end[-1] == ' ') - end--; - return (uint) (end-ptr); -} /* Tables of filed type compatibility. @@ -306,7 +299,7 @@ Field::Field(char *ptr_arg,uint32 length_arg,uchar *null_ptr_arg, field_name(field_name_arg), query_id(0), key_start(0), part_of_key(0), part_of_sortkey(0), unireg_check(unireg_check_arg), - field_length(length_arg),null_bit(null_bit_arg),abs_offset(0) + field_length(length_arg),null_bit(null_bit_arg) { flags=null_ptr ? 0: NOT_NULL_FLAG; comment.str= (char*) ""; @@ -5536,7 +5529,7 @@ uint32 calc_pack_length(enum_field_types type,uint32 length) case FIELD_TYPE_ENUM: abort(); return 0; // This shouldn't happen default: return 0; } - return 0; // This shouldn't happen + return 0; // Keep compiler happy } diff --git a/sql/field.h b/sql/field.h index 27fe3858fe6..0752dbae2fc 100644 --- a/sql/field.h +++ b/sql/field.h @@ -78,7 +78,6 @@ public: uint32 field_length; // Length of field uint16 flags; uchar null_bit; // Bit used to test null bit - uint abs_offset; // use only in group_concat Field(char *ptr_arg,uint32 length_arg,uchar *null_ptr_arg,uchar null_bit_arg, utype unireg_check_arg, const char *field_name_arg, diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 5d3d2a2fb4f..e0abe5a22e0 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -134,7 +134,6 @@ static mysql_byte* innobase_get_key(INNOBASE_SHARE *share,uint *length, my_bool not_used __attribute__((unused))); static INNOBASE_SHARE *get_share(const char *table_name); static void free_share(INNOBASE_SHARE *share); -static void innobase_print_error(const char* db_errpfx, char* buffer); /* General functions */ @@ -1292,18 +1291,6 @@ innobase_close_connection( return(0); } -/********************************************************************** -Prints an error message. */ -static -void -innobase_print_error( -/*=================*/ - const char* db_errpfx, /* in: error prefix text */ - char* buffer) /* in: error text */ -{ - sql_print_error("%s: %s", db_errpfx, buffer); -} - /***************************************************************************** ** InnoDB database tables diff --git a/sql/item.cc b/sql/item.cc index 48e35f06ec3..80086c3afd7 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -746,7 +746,6 @@ String *Item_param::query_val_str(String* str) case INT_RESULT: case REAL_RESULT: return val_str(str); - break; default: str->set("'", 1, default_charset()); diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 24d60b51eab..ae6658c8e35 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1472,16 +1472,12 @@ cmp_item* cmp_item::get_comparator(Item *item) switch (item->result_type()) { case STRING_RESULT: return new cmp_item_sort_string(item->collation.collation); - break; case INT_RESULT: return new cmp_item_int; - break; case REAL_RESULT: return new cmp_item_real; - break; case ROW_RESULT: return new cmp_item_row; - break; default: DBUG_ASSERT(0); break; diff --git a/sql/item_func.cc b/sql/item_func.cc index fdc0ee9d6a0..d7e778171a0 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1143,7 +1143,6 @@ String *Item_func_min_max::val_str(String *str) // This case should never be choosen DBUG_ASSERT(0); return 0; - } return 0; // Keep compiler happy } @@ -2442,7 +2441,6 @@ Item_func_set_user_var::check() save_result.vint= args[0]->val_int(); break; } - break; case STRING_RESULT: { save_result.vstr= args[0]->val_str(&value); @@ -2494,7 +2492,6 @@ Item_func_set_user_var::update() INT_RESULT, &my_charset_bin, DERIVATION_NONE); break; } - break; case STRING_RESULT: { if (!save_result.vstr) // Null value diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index a1305e0b1d9..555c1a74eaf 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -66,7 +66,6 @@ String *Item_func_geometry_from_wkb::val_str(String *str) String arg_val; String *wkb= args[0]->val_str(&arg_val); Geometry_buffer buffer; - Geometry *geom; uint32 srid= 0; if ((arg_count == 2) && !args[1]->null_value) @@ -78,7 +77,7 @@ String *Item_func_geometry_from_wkb::val_str(String *str) str->q_append(srid); if ((null_value= (args[0]->null_value || - !(geom= Geometry::create_from_wkb(&buffer, wkb->ptr(), wkb->length())) || + !Geometry::create_from_wkb(&buffer, wkb->ptr(), wkb->length()) || str->append(*wkb)))) return 0; return str; @@ -126,12 +125,11 @@ String *Item_func_as_wkb::val_str(String *str) String arg_val; String *swkb= args[0]->val_str(&arg_val); Geometry_buffer buffer; - Geometry *geom; if ((null_value= (args[0]->null_value || - !(geom= Geometry::create_from_wkb(&buffer, swkb->ptr() + SRID_SIZE, - swkb->length() - SRID_SIZE))))) + !(Geometry::create_from_wkb(&buffer, swkb->ptr() + SRID_SIZE, + swkb->length() - SRID_SIZE))))) return 0; str->copy(swkb->ptr() + SRID_SIZE, swkb->length() - SRID_SIZE, @@ -701,10 +699,10 @@ longlong Item_func_srid::val_int() Geometry_buffer buffer; Geometry *geom; - null_value= !swkb || - !(geom= Geometry::create_from_wkb(&buffer, - swkb->ptr() + SRID_SIZE, - swkb->length() - SRID_SIZE)); + null_value= (!swkb || + !Geometry::create_from_wkb(&buffer, + swkb->ptr() + SRID_SIZE, + swkb->length() - SRID_SIZE)); if (null_value) return 0; diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 113ef0e1922..7df2299239f 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -41,7 +41,11 @@ Item_sum::Item_sum(List &list) list.empty(); // Fields are used } -// Constructor used in processing select with temporary tebles + +/* + Constructor used in processing select with temporary tebles +*/ + Item_sum::Item_sum(THD *thd, Item_sum *item): Item_result_field(thd, item), quick_group(item->quick_group) { @@ -55,6 +59,7 @@ Item_sum::Item_sum(THD *thd, Item_sum *item): args[i]= item->args[i]; } + void Item_sum::mark_as_sum_func() { current_thd->lex->current_select->with_sum_func= 1; @@ -1495,10 +1500,17 @@ String *Item_sum_udf_str::val_str(String *str) /***************************************************************************** GROUP_CONCAT function - Syntax: - GROUP_CONCAT([DISTINCT] expr,... [ORDER BY col [ASC|DESC],...] - [SEPARATOR str_const]) + + SQL SYNTAX: + GROUP_CONCAT([DISTINCT] expr,... [ORDER BY col [ASC|DESC],...] + [SEPARATOR str_const]) + concat of values from "group by" operation + + BUGS + DISTINCT and ORDER BY only works if ORDER BY uses all fields and only fields + in expression list + Blobs doesn't work with DISTINCT or ORDER BY *****************************************************************************/ /* @@ -1510,24 +1522,22 @@ int group_concat_key_cmp_with_distinct(void* arg, byte* key1, byte* key2) { Item_func_group_concat* item= (Item_func_group_concat*)arg; + uint *offset= item->field_offsets+ item->field_list_offset; + Item **field_item, **end; - for (uint i= 0; i < item->arg_count_field; i++) + for (field_item= item->args, end= field_item+item->arg_count_field; + field_item < end; + field_item++) { - Item *field_item= item->args[i]; - Field *field= field_item->real_item()->get_tmp_table_field(); + Field *field= (*field_item)->real_item()->get_tmp_table_field(); if (field) { - uint offset= field->abs_offset; - - int res= field->key_cmp(key1 + offset, key2 + offset); - /* - if key1 and key2 is not equal than field->key_cmp return offset. This - function must return value 1 for this case. - */ - if (res) - return 1; + int res; + if ((res= field->key_cmp(key1 + *offset, key2 + *offset))) + return res; + offset++; } - } + } return 0; } @@ -1540,22 +1550,23 @@ int group_concat_key_cmp_with_distinct(void* arg, byte* key1, int group_concat_key_cmp_with_order(void* arg, byte* key1, byte* key2) { Item_func_group_concat* item= (Item_func_group_concat*)arg; + uint *offset= item->field_offsets; + ORDER **order_item, **end; - for (uint i=0; i < item->arg_count_order; i++) + for (order_item= item->order, end=order_item+ item->arg_count_order; + order_item < end; + order_item++) { - ORDER *order_item= item->order[i]; - Item *item= *order_item->item; + Item *item= *(*order_item)->item; Field *field= item->real_item()->get_tmp_table_field(); if (field) { - uint offset= field->abs_offset; - - bool dir= order_item->asc; - int res= field->key_cmp(key1 + offset, key2 + offset); + int res= field->key_cmp(key1 + *offset, key2 + *offset); if (res) - return dir ? res : -res; + return (*order_item)->asc ? res : -res; + offset++; } - } + } /* We can't return 0 because tree class remove this item as double value. */ @@ -1566,6 +1577,11 @@ int group_concat_key_cmp_with_order(void* arg, byte* key1, byte* key2) /* function of sort for syntax: GROUP_CONCAT(DISTINCT expr,... ORDER BY col,... ) + + BUG: + This doesn't work in the case when the order by contains data that + is not part of the field list because tree-insert will not notice + the duplicated values when inserting things sorted by ORDER BY */ int group_concat_key_cmp_with_distinct_and_order(void* arg,byte* key1, @@ -1578,58 +1594,53 @@ int group_concat_key_cmp_with_distinct_and_order(void* arg,byte* key1, /* - create result - item is pointer to Item_func_group_concat + Append data from current leaf to item->result */ int dump_leaf_key(byte* key, uint32 count __attribute__((unused)), - Item_func_group_concat *group_concat_item) + Item_func_group_concat *item) { char buff[MAX_FIELD_WIDTH]; String tmp((char *)&buff,sizeof(buff),default_charset_info); String tmp2((char *)&buff,sizeof(buff),default_charset_info); - + uint *field_offsets= (item->field_offsets + + item->field_list_offset); tmp.length(0); - for (uint i= 0; i < group_concat_item->arg_show_fields; i++) + for (uint i= 0; i < item->arg_count_field; i++) { - Item *show_item= group_concat_item->args[i]; + Item *show_item= item->args[i]; if (!show_item->const_item()) { Field *f= show_item->real_item()->get_tmp_table_field(); char *sv= f->ptr; - f->ptr= (char *)key + f->abs_offset; + f->ptr= (char *) key + *(field_offsets++); String *res= f->val_str(&tmp,&tmp2); - group_concat_item->result.append(*res); + item->result.append(*res); f->ptr= sv; } else { String *res= show_item->val_str(&tmp); if (res) - group_concat_item->result.append(*res); + item->result.append(*res); } } - if (group_concat_item->tree_mode) // Last item of tree + if (item->tree_mode) // Last item of tree { - group_concat_item->show_elements++; - if (group_concat_item->show_elements < - group_concat_item->tree->elements_in_tree) - group_concat_item->result.append(*group_concat_item->separator); + item->show_elements++; + if (item->show_elements < item->tree->elements_in_tree) + item->result.append(*item->separator); } else + item->result.append(*item->separator); + + /* stop if length of result more than group_concat_max_len */ + if (item->result.length() > item->group_concat_max_len) { - group_concat_item->result.append(*group_concat_item->separator); - } - /* - if length of result more than group_concat_max_len - stop ! - */ - if (group_concat_item->result.length() > - group_concat_item->group_concat_max_len) - { - group_concat_item->count_cut_values++; - group_concat_item->result.length(group_concat_item->group_concat_max_len); - group_concat_item->warning_for_row= TRUE; + item->count_cut_values++; + item->result.length(item->group_concat_max_len); + item->warning_for_row= TRUE; return 1; } return 0; @@ -1654,51 +1665,85 @@ Item_func_group_concat::Item_func_group_concat(bool is_distinct, separator(is_separator), tree(&tree_base), table(0), order(0), tables_list(0), show_elements(0), arg_count_order(0), arg_count_field(0), - arg_show_fields(0), count_cut_values(0) - + count_cut_values(0) { + Item *item_select; + Item **arg_ptr; + original= 0; quick_group= 0; mark_as_sum_func(); order= 0; group_concat_max_len= current_thd->variables.group_concat_max_len; - - arg_show_fields= arg_count_field= is_select->elements; + arg_count_field= is_select->elements; arg_count_order= is_order ? is_order->elements : 0; - arg_count= arg_count_field; + arg_count= arg_count_field + arg_count_order; /* We need to allocate: - args - arg_count+arg_count_order (for possible order items in temporare - tables) + args - arg_count_field+arg_count_order + (for possible order items in temporare tables) order - arg_count_order + field_offset For offset withing the key */ - args= (Item**) sql_alloc(sizeof(Item*)*(arg_count+arg_count_order)+ - sizeof(ORDER*)*arg_count_order); - if (!args) + if (!(args= (Item**) sql_alloc((sizeof(Item*) + sizeof(uint)) * arg_count + + sizeof(ORDER*)*arg_count_order))) return; - /* fill args items of show and sort */ - int i= 0; - List_iterator_fast li(*is_select); - Item *item_select; + order= (ORDER**)(args + arg_count); + field_offsets= (uint*) (order+ arg_count_order); - for ( ; (item_select= li++) ; i++) - args[i]= item_select; + /* fill args items of show and sort */ + List_iterator_fast li(*is_select); + + for (arg_ptr=args ; (item_select= li++) ; arg_ptr++) + *arg_ptr= item_select; if (arg_count_order) { - i= 0; - order= (ORDER**)(args + arg_count + arg_count_order); + ORDER **order_ptr= order; for (ORDER *order_item= (ORDER*) is_order->first; - order_item != NULL; - order_item= order_item->next) + order_item != NULL; + order_item= order_item->next) { - order[i++]= order_item; + (*order_ptr++)= order_item; + *arg_ptr= *order_item->item; + order_item->item= arg_ptr++; } } } + + +Item_func_group_concat::Item_func_group_concat(THD *thd, + Item_func_group_concat *item) + :Item_sum(thd, item),item_thd(thd), + tmp_table_param(item->tmp_table_param), + max_elements_in_tree(item->max_elements_in_tree), + warning(item->warning), + warning_available(item->warning_available), + key_length(item->key_length), + rec_offset(item->rec_offset), + tree_mode(item->tree_mode), + distinct(item->distinct), + warning_for_row(item->warning_for_row), + separator(item->separator), + tree(item->tree), + table(item->table), + order(item->order), + field_offsets(item->field_offsets), + tables_list(item->tables_list), + group_concat_max_len(item->group_concat_max_len), + show_elements(item->show_elements), + arg_count_order(item->arg_count_order), + arg_count_field(item->arg_count_field), + field_list_offset(item->field_list_offset), + count_cut_values(item->count_cut_values), + original(item) +{ + quick_group= item->quick_group; +} + void Item_func_group_concat::cleanup() @@ -1737,12 +1782,11 @@ Item_func_group_concat::~Item_func_group_concat() */ if (!original) { - THD *thd= current_thd; if (warning_available) { char warn_buff[MYSQL_ERRMSG_SIZE]; sprintf(warn_buff, ER(ER_CUT_VALUE_GROUP_CONCAT), count_cut_values); - warning->set_msg(thd, warn_buff); + warning->set_msg(current_thd, warn_buff); } } } @@ -1773,13 +1817,15 @@ void Item_func_group_concat::clear() bool Item_func_group_concat::add() { + bool record_is_null; + if (always_null) return 0; copy_fields(tmp_table_param); copy_funcs(tmp_table_param->items_to_copy); - bool record_is_null= TRUE; - for (uint i= 0; i < arg_show_fields; i++) + record_is_null= TRUE; + for (uint i= 0; i < arg_count_field; i++) { Item *show_item= args[i]; if (!show_item->const_item()) @@ -1803,8 +1849,7 @@ bool Item_func_group_concat::add() else { if (result.length() <= group_concat_max_len && !warning_for_row) - dump_leaf_key(table->record[0] + rec_offset, 1, - (Item_func_group_concat*)this); + dump_leaf_key(table->record[0] + rec_offset, 1, this); } return 0; } @@ -1832,24 +1877,19 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) thd->allow_sum_func= 0; maybe_null= 0; item_thd= thd; + + /* + Fix fields for select list and ORDER clause + */ + for (i= 0 ; i < arg_count ; i++) { if (args[i]->fix_fields(thd, tables, args + i) || args[i]->check_cols(1)) return 1; - maybe_null |= args[i]->maybe_null; - } - /* - Fix fields for order clause in function: - GROUP_CONCAT(expr,... ORDER BY col,... ) - */ - for (i= 0 ; i < arg_count_order ; i++) - { - // order_item->item can be changed by fix_fields() call - ORDER *order_item= order[i]; - if ((*order_item->item)->fix_fields(thd, tables, order_item->item) || - (*order_item->item)->check_cols(1)) - return 1; + if (i < arg_count_field && args[i]->maybe_null) + maybe_null= 0; } + result_field= 0; null_value= 1; max_length= group_concat_max_len; @@ -1864,23 +1904,29 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) bool Item_func_group_concat::setup(THD *thd) { - DBUG_ENTER("Item_func_group_concat::setup"); List list; SELECT_LEX *select_lex= thd->lex->current_select; + Field **field, **field_end; + uint offset, *offsets, const_fields; + qsort_cmp2 compare_key; + DBUG_ENTER("Item_func_group_concat::setup"); if (select_lex->linkage == GLOBAL_OPTIONS_TYPE) DBUG_RETURN(1); + /* push all not constant fields to list and create temp table */ + const_fields= 0; always_null= 0; - for (uint i= 0; i < arg_count; i++) + for (uint i= 0; i < arg_count_field; i++) { Item *item= args[i]; if (list.push_back(item)) DBUG_RETURN(1); if (item->const_item()) { + const_fields++; (void) item->val_int(); if (item->null_value) always_null= 1; @@ -1900,12 +1946,19 @@ bool Item_func_group_concat::setup(THD *thd) count_field_types(tmp_table_param,all_fields,0); if (table) { + /* + We come here when we are getting the result from a temporary table, + not the original tables used in the query + */ free_tmp_table(thd, table); tmp_table_param->cleanup(); } /* - We have to create a temporary table for that we get descriptions of fields + We have to create a temporary table to get descriptions of fields (types, sizes and so on). + + Note that in the table, we first have the ORDER BY fields, then the + field list. */ if (!(table=create_tmp_table(thd, tmp_table_param, all_fields, 0, 0, 0, 0,select_lex->options | thd->options, @@ -1914,27 +1967,27 @@ bool Item_func_group_concat::setup(THD *thd) table->file->extra(HA_EXTRA_NO_ROWS); table->no_rows= 1; - - Field** field, **field_end; - field_end = (field = table->field) + table->fields; - uint offset = 0; - for (key_length = 0; field < field_end; ++field) + field_end= (field= table->field) + table->fields; + offsets= field_offsets; + offset= 0; + for (key_length= 0; field < field_end; field++) { uint32 length= (*field)->pack_length(); - (*field)->abs_offset= offset; + (*offsets++)= offset; offset+= length; key_length += length; - } - rec_offset = table->reclength - key_length; + } + /* Offset to first result field in table */ + field_list_offset= table->fields - (list.elements - const_fields); + /* Offset to first field */ + rec_offset= (uint) (table->field[0]->ptr - table->record[0]); if (tree_mode) delete_tree(tree); - /* - choise function of sort - */ + + /* choose function of sort */ tree_mode= distinct || arg_count_order; - qsort_cmp2 compare_key; if (tree_mode) { if (arg_count_order) @@ -1946,21 +1999,20 @@ bool Item_func_group_concat::setup(THD *thd) } else { + compare_key= NULL; if (distinct) compare_key= (qsort_cmp2) group_concat_key_cmp_with_distinct; - else - compare_key= NULL; } /* - Create a tree of sort. Tree is used for a sort and a remove dubl - values (according with syntax of the function). If function does't + Create a tree of sort. Tree is used for a sort and a remove double + values (according with syntax of the function). If function doesn't contain DISTINCT and ORDER BY clauses, we don't create this tree. */ init_tree(tree, min(thd->variables.max_heap_table_size, - thd->variables.sortbuff_size/16), 0, + thd->variables.sortbuff_size/16), 0, key_length, compare_key, 0, NULL, (void*) this); - max_elements_in_tree= ((key_length) ? - thd->variables.max_heap_table_size/key_length : 1); + max_elements_in_tree= (key_length ? + thd->variables.max_heap_table_size/key_length : 1); }; /* @@ -1975,6 +2027,7 @@ bool Item_func_group_concat::setup(THD *thd) DBUG_RETURN(0); } + /* This is used by rollup to create a separate usable copy of the function */ void Item_func_group_concat::make_unique() @@ -2017,7 +2070,7 @@ void Item_func_group_concat::print(String *str) str->append("group_concat(", 13); if (distinct) str->append("distinct ", 9); - for (uint i= 0; i < arg_count; i++) + for (uint i= 0; i < arg_count_field; i++) { if (i) str->append(','); diff --git a/sql/item_sum.h b/sql/item_sum.h index 1c31f1a9b70..cac080c5807 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -204,18 +204,24 @@ class Item_sum_count_distinct :public Item_sum_int uint key_length; CHARSET_INFO *key_charset; - // calculated based on max_heap_table_size. If reached, - // walk the tree and dump it into MyISAM table + /* + Calculated based on max_heap_table_size. If reached, + walk the tree and dump it into MyISAM table + */ uint max_elements_in_tree; - // the first few bytes of record ( at least one) - // are just markers for deleted and NULLs. We want to skip them since - // they will just bloat the tree without providing any valuable info + /* + The first few bytes of record ( at least one) + are just markers for deleted and NULLs. We want to skip them since + they will just bloat the tree without providing any valuable info + */ int rec_offset; - // If there are no blobs, we can use a tree, which - // is faster than heap table. In that case, we still use the table - // to help get things set up, but we insert nothing in it + /* + If there are no blobs, we can use a tree, which + is faster than heap table. In that case, we still use the table + to help get things set up, but we insert nothing in it + */ bool use_tree; bool always_null; // Set to 1 if the result is always NULL @@ -236,7 +242,8 @@ class Item_sum_count_distinct :public Item_sum_int Item_sum_count_distinct(THD *thd, Item_sum_count_distinct *item) :Item_sum_int(thd, item), table(item->table), used_table_cache(item->used_table_cache), - field_lengths(item->field_lengths), tmp_table_param(item->tmp_table_param), + field_lengths(item->field_lengths), + tmp_table_param(item->tmp_table_param), tree(item->tree), original(item), key_length(item->key_length), max_elements_in_tree(item->max_elements_in_tree), rec_offset(item->rec_offset), use_tree(item->use_tree), @@ -318,18 +325,17 @@ public: void fix_length_and_dec() {} }; + /* + variance(a) = -variance(a) = - -= sum (ai - avg(a))^2 / count(a) ) -= sum (ai^2 - 2*ai*avg(a) + avg(a)^2) / count(a) -= (sum(ai^2) - sum(2*ai*avg(a)) + sum(avg(a)^2))/count(a) = -= (sum(ai^2) - 2*avg(a)*sum(a) + count(a)*avg(a)^2)/count(a) = -= (sum(ai^2) - 2*sum(a)*sum(a)/count(a) + count(a)*sum(a)^2/count(a)^2 )/count(a) = -= (sum(ai^2) - 2*sum(a)^2/count(a) + sum(a)^2/count(a) )/count(a) = -= (sum(ai^2) - sum(a)^2/count(a))/count(a) - + = sum (ai - avg(a))^2 / count(a) ) + = sum (ai^2 - 2*ai*avg(a) + avg(a)^2) / count(a) + = (sum(ai^2) - sum(2*ai*avg(a)) + sum(avg(a)^2))/count(a) = + = (sum(ai^2) - 2*avg(a)*sum(a) + count(a)*avg(a)^2)/count(a) = + = (sum(ai^2) - 2*sum(a)*sum(a)/count(a) + count(a)*sum(a)^2/count(a)^2 )/count(a) = + = (sum(ai^2) - 2*sum(a)^2/count(a) + sum(a)^2/count(a) )/count(a) = + = (sum(ai^2) - sum(a)^2/count(a))/count(a) */ class Item_sum_variance : public Item_sum_num @@ -515,8 +521,9 @@ class Item_sum_xor :public Item_sum_bit /* -** user defined aggregates + User defined aggregates */ + #ifdef HAVE_DLOPEN class Item_udf_sum : public Item_sum @@ -682,12 +689,13 @@ class Item_func_group_concat : public Item_sum friend int group_concat_key_cmp_with_distinct(void* arg, byte* key1, byte* key2); - friend int group_concat_key_cmp_with_order(void* arg, byte* key1, byte* key2); + friend int group_concat_key_cmp_with_order(void* arg, byte* key1, + byte* key2); friend int group_concat_key_cmp_with_distinct_and_order(void* arg, byte* key1, byte* key2); friend int dump_leaf_key(byte* key, uint32 count __attribute__((unused)), - Item_func_group_concat *group_concat_item); + Item_func_group_concat *group_concat_item); public: String result; @@ -696,12 +704,13 @@ class Item_func_group_concat : public Item_sum TREE *tree; TABLE *table; ORDER **order; + uint *field_offsets; TABLE_LIST *tables_list; ulong group_concat_max_len; uint show_elements; uint arg_count_order; uint arg_count_field; - uint arg_show_fields; + uint field_list_offset; uint count_cut_values; /* Following is 0 normal object and pointer to original one for copy @@ -712,38 +721,12 @@ class Item_func_group_concat : public Item_sum Item_func_group_concat(bool is_distinct,List *is_select, SQL_LIST *is_order,String *is_separator); - Item_func_group_concat(THD *thd, Item_func_group_concat *item) - :Item_sum(thd, item),item_thd(thd), - tmp_table_param(item->tmp_table_param), - max_elements_in_tree(item->max_elements_in_tree), - warning(item->warning), - warning_available(item->warning_available), - key_length(item->key_length), - rec_offset(item->rec_offset), - tree_mode(item->tree_mode), - distinct(item->distinct), - warning_for_row(item->warning_for_row), - separator(item->separator), - tree(item->tree), - table(item->table), - order(item->order), - tables_list(item->tables_list), - group_concat_max_len(item->group_concat_max_len), - show_elements(item->show_elements), - arg_count_order(item->arg_count_order), - arg_count_field(item->arg_count_field), - arg_show_fields(item->arg_show_fields), - count_cut_values(item->count_cut_values), - original(item) - { - quick_group= item->quick_group; - }; + Item_func_group_concat(THD *thd, Item_func_group_concat *item); ~Item_func_group_concat(); void cleanup(); enum Sumfunctype sum_func () const {return GROUP_CONCAT_FUNC;} const char *func_name() const { return "group_concat"; } - enum Type type() const { return SUM_FUNC_ITEM; } virtual Item_result result_type () const { return STRING_RESULT; } void clear(); bool add(); diff --git a/sql/log.cc b/sql/log.cc index 6b091484a82..0cd9e7172c3 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -507,7 +507,6 @@ int MYSQL_LOG::find_log_pos(LOG_INFO *linfo, const char *log_name, RETURN VALUES 0 ok LOG_INFO_EOF End of log-index-file found - LOG_INFO_SEEK Could not allocate IO cache LOG_INFO_IO Got IO error while reading file */ diff --git a/sql/log_event.cc b/sql/log_event.cc index 742cf6a1a82..84bbc496c9d 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -83,7 +83,7 @@ inline int ignored_error_code(int err_code) pretty_print_str() */ -#ifndef MYSQL_CLIENT +#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) static char *pretty_print_str(char *packet, char *str, int len) { char *end= str + len; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index d602c44c8f9..4f58ff33f04 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2361,9 +2361,8 @@ Now disabling --log-slave-updates."); { if (global_system_variables.log_warnings) sql_print_error("Warning: Failed to lock memory. Errno: %d\n",errno); + locked_in_memory= 0; } - else - locked_in_memory=1; } #else locked_in_memory=0; diff --git a/sql/protocol.cc b/sql/protocol.cc index 40adc9e8961..61af6ffceaf 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -166,10 +166,10 @@ net_printf(THD *thd, uint errcode, ...) const char *format; #ifndef EMBEDDED_LIBRARY const char *text_pos; + int head_length= NET_HEADER_SIZE; #else char text_pos[1024]; #endif - int head_length= NET_HEADER_SIZE; NET *net= &thd->net; DBUG_ENTER("net_printf"); diff --git a/sql/set_var.cc b/sql/set_var.cc index 5d2a6c1d39e..b99816eaccd 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -838,7 +838,8 @@ bool update_sys_var_str(sys_var_str *var_str, rw_lock_t *var_mutex, { char *res= 0, *old_value=(char *)(var ? var->value->str_value.ptr() : 0); uint new_length= (var ? var->value->str_value.length() : 0); - if (!old_value) old_value=""; + if (!old_value) + old_value= (char*) ""; if (!(res= my_strdup_with_length(old_value, new_length, MYF(0)))) return 1; /* diff --git a/sql/slave.cc b/sql/slave.cc index be9a5795233..fedf9e3dd69 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -285,8 +285,9 @@ int init_relay_log_pos(RELAY_LOG_INFO* rli,const char* log, In this case, we will use the same IO_CACHE pointer to read data as the IO thread is using to write data. */ - if (my_b_tell((rli->cur_log=rli->relay_log.get_log_file())) == 0 && - check_binlog_magic(rli->cur_log,errmsg)) + rli->cur_log= rli->relay_log.get_log_file(); + if (my_b_tell(rli->cur_log) == 0 && + check_binlog_magic(rli->cur_log, errmsg)) goto err; rli->cur_log_old_open_count=rli->relay_log.get_open_count(); } @@ -1672,7 +1673,18 @@ int init_master_info(MASTER_INFO* mi, const char* master_info_fname, DBUG_ENTER("init_master_info"); if (mi->inited) + { + /* + We have to reset read position of relay-log-bin as we may have + already been reading from 'hotlog' when the slave was stopped + last time. If this case pos_in_file would be set and we would + get a crash when trying to read the signature for the binary + relay log. + */ + my_b_seek(mi->rli.cur_log, (my_off_t) 0); DBUG_RETURN(0); + } + mi->mysql=0; mi->file_id=1; fn_format(fname, master_info_fname, mysql_data_home, "", 4+32); @@ -3616,13 +3628,16 @@ int queue_event(MASTER_INFO* mi,const char* buf, ulong event_len) mi->master_log_pos+= inc_pos; DBUG_PRINT("info", ("master_log_pos: %d, event originating from the same server, ignored", (ulong) mi->master_log_pos)); } - else /* write the event to the relay log */ + else + { + /* write the event to the relay log */ if (likely(!(error= rli->relay_log.appendv(buf,event_len,0)))) { mi->master_log_pos+= inc_pos; DBUG_PRINT("info", ("master_log_pos: %d", (ulong) mi->master_log_pos)); rli->relay_log.harvest_bytes_written(&rli->log_space_total); } + } err: pthread_mutex_unlock(&mi->data_lock); @@ -4090,8 +4105,9 @@ Before assert, my_b_tell(cur_log)=%s rli->event_relay_log_pos=%s", if (rli->relay_log.is_active(rli->linfo.log_file_name)) { #ifdef EXTRA_DEBUG - sql_print_error("next log '%s' is currently active", - rli->linfo.log_file_name); + if (global_system_variables.log_warnings) + sql_print_error("next log '%s' is currently active", + rli->linfo.log_file_name); #endif rli->cur_log= cur_log= rli->relay_log.get_log_file(); rli->cur_log_old_open_count= rli->relay_log.get_open_count(); @@ -4119,8 +4135,9 @@ Before assert, my_b_tell(cur_log)=%s rli->event_relay_log_pos=%s", from hot to cold, but not from cold to hot). No need for LOCK_log. */ #ifdef EXTRA_DEBUG - sql_print_error("next log '%s' is not active", - rli->linfo.log_file_name); + if (global_system_variables.log_warnings) + sql_print_error("next log '%s' is not active", + rli->linfo.log_file_name); #endif // open_binlog() will check the magic header if ((rli->cur_log_fd=open_binlog(cur_log,rli->linfo.log_file_name, diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 39061a6501b..e1a15eff475 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -1860,11 +1860,11 @@ my_bool Query_cache::write_result_data(Query_cache_block **result_block, { // It is success (nobody can prevent us write data) STRUCT_UNLOCK(&structure_guard_mutex); - byte *rest = (byte*) data; - Query_cache_block *block = *result_block; uint headers_len = (ALIGN_SIZE(sizeof(Query_cache_block)) + ALIGN_SIZE(sizeof(Query_cache_result))); #ifndef EMBEDDED_LIBRARY + Query_cache_block *block= *result_block; + byte *rest= (byte*) data; // Now fill list of blocks that created by allocate_data_chain do { diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index ea47ca9f71d..81269a8cbcf 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -115,7 +115,6 @@ static int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit, TABLE *table; int res; select_union *derived_result; - TABLE_LIST *tables= (TABLE_LIST *)first_select->table_list.first; bool is_union= first_select->next_select() && first_select->next_select()->linkage == UNION_TYPE; bool is_subsel= first_select->first_inner_unit() ? 1: 0; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index a0117a079a5..fff52ce40bd 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -21,12 +21,14 @@ #include "sql_acl.h" static int check_null_fields(THD *thd,TABLE *entry); +#ifndef EMBEDDED_LIBRARY static TABLE *delayed_get_table(THD *thd,TABLE_LIST *table_list); static int write_delayed(THD *thd,TABLE *table, enum_duplicates dup, char *query, uint query_length, int log_on); static void end_delayed_insert(THD *thd); extern "C" pthread_handler_decl(handle_delayed_insert,arg); static void unlink_blobs(register TABLE *table); +#endif /* Define to force use of my_malloc() if the allocated memory block is big */ @@ -127,7 +129,9 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, TABLE *table; List_iterator_fast its(values_list); List_item *values; - char *query=thd->query; +#ifndef EMBEDDED_LIBRARY + char *query= thd->query; +#endif thr_lock_type lock_type = table_list->lock_type; TABLE_LIST *insert_table_list= (TABLE_LIST*) thd->lex->select_lex.table_list.first; diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index df7d487194a..4c63a8b7c7f 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1389,7 +1389,7 @@ create_total_list_n_last_return(THD *thd_arg, } } } -end: + if (slave_list_first) { *new_table_list= slave_list_first; diff --git a/sql/sql_lex.h b/sql/sql_lex.h index b9d85a23011..15aef1a9acc 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -396,6 +396,7 @@ public: SQL_LIST order_list; /* ORDER clause */ List expr_list; List when_list; /* WHEN clause (expression) */ + SQL_LIST *gorder_list; ha_rows select_limit, offset_limit; /* LIMIT clause parameters */ // Arrays of pointers to top elements of all_fields list Item **ref_pointer_array; @@ -538,7 +539,6 @@ typedef struct st_lex gptr yacc_yyss,yacc_yyvs; THD *thd; CHARSET_INFO *charset; - SQL_LIST *gorder_list; List col_list; List ref_list; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 68ef195cdc4..6d989ecf154 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -48,7 +48,9 @@ extern "C" int gethostname(char *name, int namelen); #endif +#ifndef NO_EMBEDDED_ACCESS_CHECKS static int check_for_max_user_connections(THD *thd, USER_CONN *uc); +#endif static void decrease_user_connections(USER_CONN *uc); static bool check_db_used(THD *thd,TABLE_LIST *tables); static bool check_merge_table_access(THD *thd, char *db, TABLE_LIST *tables); @@ -426,6 +428,8 @@ void init_max_user_conn(void) 1 error */ +#ifndef NO_EMBEDDED_ACCESS_CHECKS + static int check_for_max_user_connections(THD *thd, USER_CONN *uc) { int error=0; @@ -456,7 +460,7 @@ static int check_for_max_user_connections(THD *thd, USER_CONN *uc) (void) pthread_mutex_unlock(&LOCK_user_conn); DBUG_RETURN(error); } - +#endif /* NO_EMBEDDED_ACCESS_CHECKS */ /* Decrease user connection count @@ -545,15 +549,15 @@ bool is_update_query(enum enum_sql_command command) static bool check_mqh(THD *thd, uint check_command) { +#ifdef NO_EMBEDDED_ACCESS_CHECKS + return(0); +#else bool error=0; time_t check_time = thd->start_time ? thd->start_time : time(NULL); USER_CONN *uc=thd->user_connect; DBUG_ENTER("check_mqh"); DBUG_ASSERT(uc != 0); -#ifdef NO_EMBEDDED_ACCESS_CHECKS - DBUG_RETURN(0); -#else /* If more than a hour since last check, reset resource checking */ if (check_time - uc->intime >= 3600) { @@ -3518,7 +3522,10 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv, DBUG_ENTER("check_access"); DBUG_PRINT("enter",("want_access: %lu master_access: %lu", want_access, thd->master_access)); - ulong db_access,dummy; +#ifndef NO_EMBEDDED_ACCESS_CHECKS + ulong db_access; +#endif + ulong dummy; if (save_priv) *save_priv=0; else diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 94fef4cafdc..66ea32c9af4 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1121,9 +1121,10 @@ static void reset_stmt_for_execute(Prepared_statement *stmt) void mysql_stmt_execute(THD *thd, char *packet, uint packet_length) { ulong stmt_id= uint4korr(packet); +#ifndef EMBEDDED_LIBRARY uchar *packet_end= (uchar *) packet + packet_length - 1; +#endif Prepared_statement *stmt; - DBUG_ENTER("mysql_stmt_execute"); packet+= 9; /* stmt_id + 5 bytes of flags */ diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 63fe8d77f1a..45857a89ca9 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3608,7 +3608,6 @@ static void make_join_readinfo(JOIN *join, uint options) { uint i; - SELECT_LEX *select_lex= &join->thd->lex->select_lex; bool statistics= test(!(join->select_options & SELECT_DESCRIBE)); DBUG_ENTER("make_join_readinfo"); @@ -3878,9 +3877,7 @@ JOIN::join_free(bool full) else { for (tab= join_tab, end= tab+tables; tab != end; tab++) - { tab->cleanup(); - } table= 0; } } @@ -4787,7 +4784,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, else return new Field_double(item_sum->max_length,maybe_null, item->name, table, item_sum->decimals); - case Item_sum::VARIANCE_FUNC: /* Place for sum & count */ + case Item_sum::VARIANCE_FUNC: /* Place for sum & count */ case Item_sum::STD_FUNC: if (group) return new Field_string(sizeof(double)*2+sizeof(longlong), @@ -4815,17 +4812,19 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, default: // This case should never be choosen DBUG_ASSERT(0); + thd->fatal_error(); return 0; } } - thd->fatal_error(); - return 0; // Error + /* We never come here */ } case Item::FIELD_ITEM: case Item::DEFAULT_VALUE_ITEM: - return create_tmp_field_from_field(thd, (*from_field= - ((Item_field*) item)->field), + { + Item_field *field= (Item_field*) item; + return create_tmp_field_from_field(thd, (*from_field= field->field), item, table, modify_item); + } case Item::FUNC_ITEM: case Item::COND_ITEM: case Item::FIELD_AVG_ITEM: @@ -8543,6 +8542,23 @@ bool JOIN::alloc_func_list() } +/* + Initialize 'sum_funcs' array with all Item_sum objects + + SYNOPSIS + make_sum_func_list() + field_list All items + send_fields Items in select list + before_group_by Set to 1 if this is called before GROUP BY handling + + NOTES + Calls ::setup() for all item_sum objects in field_list + + RETURN + 0 ok + 1 error +*/ + bool JOIN::make_sum_func_list(List &field_list, List &send_fields, bool before_group_by) { @@ -8579,7 +8595,7 @@ bool JOIN::make_sum_func_list(List &field_list, List &send_fields, /* - Change all funcs and sum_funcs to fields in tmp table, and create + Change all funcs and sum_funcs to fields in tmp table, and create new list of all items. change_to_use_tmp_fields() @@ -9079,7 +9095,6 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, List field_list; List item_list; THD *thd=join->thd; - SELECT_LEX *select_lex= &join->thd->lex->select_lex; select_result *result=join->result; Item *item_null= new Item_null(); CHARSET_INFO *cs= &my_charset_latin1; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 30adc06fbd0..51b5b2e6077 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -31,9 +31,11 @@ static const char *grant_names[]={ "select","insert","update","delete","create","drop","reload","shutdown", "process","file","grant","references","index","alter"}; +#ifndef NO_EMBEDDED_ACCESS_CHECKS static TYPELIB grant_types = { sizeof(grant_names)/sizeof(char **), "grant_types", grant_names}; +#endif static int mysql_find_files(THD *thd,List *files, const char *db, const char *path, const char *wild, bool dir); @@ -367,7 +369,9 @@ mysql_find_files(THD *thd,List *files, const char *db,const char *path, char *ext; MY_DIR *dirp; FILEINFO *file; +#ifndef NO_EMBEDDED_ACCESS_CHECKS uint col_access=thd->col_access; +#endif TABLE_LIST table_list; DBUG_ENTER("mysql_find_files"); @@ -826,7 +830,9 @@ int mysqld_show_create_db(THD *thd, char *dbname, char path[FN_REFLEN]; char buff[2048]; String buffer(buff, sizeof(buff), system_charset_info); +#ifndef NO_EMBEDDED_ACCESS_CHECKS uint db_access; +#endif bool found_libchar; HA_CREATE_INFO create; uint create_options = create_info ? create_info->options : 0; @@ -1135,7 +1141,6 @@ append_identifier(THD *thd, String *packet, const char *name, uint length) { const char *name_end; char quote_char; - uint part_len; if (thd->variables.sql_mode & MODE_ANSI_QUOTES) quote_char= '\"'; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 845f0d42f26..404da12db9d 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -3054,7 +3054,7 @@ sum_expr: | GROUP_CONCAT_SYM '(' opt_distinct expr_list opt_gorder_clause opt_gconcat_separator ')' { - $$=new Item_func_group_concat($3,$4,Lex->gorder_list,$6); + $$=new Item_func_group_concat($3,$4,Select->gorder_list,$6); $4->empty(); }; @@ -3070,16 +3070,15 @@ opt_gconcat_separator: opt_gorder_clause: /* empty */ { - LEX *lex=Lex; - lex->gorder_list = NULL; + Select->gorder_list = NULL; } | order_clause { - LEX *lex=Lex; - lex->gorder_list= - (SQL_LIST*) sql_memdup((char*) &lex->current_select->order_list, + SELECT_LEX *select= Select; + select->gorder_list= + (SQL_LIST*) sql_memdup((char*) &select->order_list, sizeof(st_sql_list)); - lex->current_select->order_list.empty(); + select->order_list.empty(); }; From 8c06c8c01025668cdfa6ae66f25060b012ef2347 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 5 Apr 2004 17:55:26 +0500 Subject: [PATCH 02/12] WL1368: SHOW GRANTS FOR CURRENT USER 'SHOW GRANTS' syntax is added 'SHOW GRANTS FOR CURRENT_USER' syntax is added 'SHOW GRANTS FOR CURRENT_USER()' syntax is added CURRENT_USER without parens in expressions(SELECT CURRENT_USER;) mysql-test/r/grant2.result: WL1368: SHOW GRANTS FOR CURRENT USER mysql-test/r/grant_cache.result: WL1368: SHOW GRANTS FOR CURRENT USER mysql-test/t/grant2.test: WL1368: SHOW GRANTS FOR CURRENT USER mysql-test/t/grant_cache.test: WL1368: SHOW GRANTS FOR CURRENT USER sql/lex.h: WL1368: SHOW GRANTS FOR CURRENT USER sql/sql_yacc.yy: WL1368: SHOW GRANTS FOR CURRENT USER --- mysql-test/r/grant2.result | 3 ++ mysql-test/r/grant_cache.result | 17 +++++++++++ mysql-test/t/grant2.test | 1 + mysql-test/t/grant_cache.test | 8 +++++ sql/lex.h | 2 +- sql/sql_yacc.yy | 54 +++++++++++++++++++++++++++++++-- 6 files changed, 82 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result index 0b127188586..d0765e2721f 100644 --- a/mysql-test/r/grant2.result +++ b/mysql-test/r/grant2.result @@ -5,6 +5,9 @@ grant all privileges on `my\_%`.* to mysqltest_1@localhost with grant option; select current_user(); current_user() mysqltest_1@localhost +select current_user; +current_user +mysqltest_1@localhost grant all privileges on `my\_1`.* to mysqltest_2@localhost with grant option; grant all privileges on `my_%`.* to mysqltest_3@localhost with grant option; ERROR 42000: Access denied for user: 'mysqltest_1'@'localhost' to database 'my_%' diff --git a/mysql-test/r/grant_cache.result b/mysql-test/r/grant_cache.result index fc4073d23b1..48068c0f68d 100644 --- a/mysql-test/r/grant_cache.result +++ b/mysql-test/r/grant_cache.result @@ -2,6 +2,12 @@ drop table if exists test.t1,mysqltest.t1,mysqltest.t2; drop database if exists mysqltest; reset query cache; flush status; +show grants for current_user; +Grants for root@localhost +GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION +show grants; +Grants for root@localhost +GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION create database if not exists mysqltest; create table mysqltest.t1 (a int,b int,c int); create table mysqltest.t2 (a int,b int,c int); @@ -41,6 +47,10 @@ grant SELECT on mysqltest.* to mysqltest_1@localhost; grant SELECT on mysqltest.t1 to mysqltest_2@localhost; grant SELECT on test.t1 to mysqltest_2@localhost; grant SELECT(a) on mysqltest.t1 to mysqltest_3@localhost; +show grants for current_user(); +Grants for mysqltest_1@localhost +GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' +GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost' show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 6 @@ -101,6 +111,9 @@ Qcache_hits 3 show status like "Qcache_not_cached"; Variable_name Value Qcache_not_cached 1 +show grants for current_user(); +Grants for @localhost +GRANT USAGE ON *.* TO ''@'localhost' select "user2"; user2 user2 @@ -158,6 +171,10 @@ Qcache_not_cached 7 select "user4"; user4 user4 +show grants; +Grants for mysqltest_1@localhost +GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' +GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost' select a from t1; ERROR 3D000: No Database Selected select * from mysqltest.t1,test.t1; diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test index 148c4d3da21..1fc1ed78385 100644 --- a/mysql-test/t/grant2.test +++ b/mysql-test/t/grant2.test @@ -15,6 +15,7 @@ grant all privileges on `my\_%`.* to mysqltest_1@localhost with grant option; connect (user1,localhost,mysqltest_1,,); connection user1; select current_user(); +select current_user; grant all privileges on `my\_1`.* to mysqltest_2@localhost with grant option; --error 1044 grant all privileges on `my_%`.* to mysqltest_3@localhost with grant option; diff --git a/mysql-test/t/grant_cache.test b/mysql-test/t/grant_cache.test index 5ebf621ff40..7806253124e 100644 --- a/mysql-test/t/grant_cache.test +++ b/mysql-test/t/grant_cache.test @@ -12,6 +12,8 @@ reset query cache; flush status; connect (root,localhost,root,,test,$MASTER_MYPORT,master.sock); connection root; +show grants for current_user; +show grants; --disable_warnings create database if not exists mysqltest; --enable_warnings @@ -43,6 +45,7 @@ grant SELECT(a) on mysqltest.t1 to mysqltest_3@localhost; # The following queries should be fetched from cache connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,master.sock); connection user1; +show grants for current_user(); show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; show status like "Qcache_not_cached"; @@ -64,6 +67,10 @@ show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; show status like "Qcache_not_cached"; +connect (unkuser,localhost,,,,$MASTER_MYPORT,master.sock); +connection unkuser; +show grants for current_user(); + # The following queries should be fetched from cache connect (user2,localhost,mysqltest_2,,mysqltest,$MASTER_MYPORT,master.sock); connection user2; @@ -104,6 +111,7 @@ show status like "Qcache_not_cached"; connect (user4,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,master.sock); connection user4; select "user4"; +show grants; --error 1046 select a from t1; # The following query is not cached before (different database) diff --git a/sql/lex.h b/sql/lex.h index ceef140b5f7..94ea0295f05 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -122,6 +122,7 @@ static SYMBOL symbols[] = { { "CURRENT_DATE", SYM(CURDATE)}, { "CURRENT_TIME", SYM(CURTIME)}, { "CURRENT_TIMESTAMP", SYM(NOW_SYM)}, + { "CURRENT_USER", SYM(CURRENT_USER)}, { "DATA", SYM(DATA_SYM)}, { "DATABASE", SYM(DATABASE)}, { "DATABASES", SYM(DATABASES)}, @@ -481,7 +482,6 @@ static SYMBOL sql_functions[] = { { "CAST", SYM(CAST_SYM)}, { "CEIL", F_SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ceiling)}, { "CEILING", F_SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ceiling)}, - { "CURRENT_USER", F_SYM(FUNC_ARG0),0,CREATE_FUNC(create_func_current_user)}, { "BIT_LENGTH", F_SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_bit_length)}, { "CENTROID", F_SYM(FUNC_ARG1),0,CREATE_FUNC_GEOM(create_func_centroid)}, { "CHAR_LENGTH", F_SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_char_length)}, diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 2d713ef5f5e..12216125034 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -210,6 +210,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); %token CONCURRENT %token CONSTRAINT %token CONVERT_SYM +%token CURRENT_USER %token DATABASES %token DATA_SYM %token DEFAULT @@ -721,7 +722,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); union_clause union_list precision subselect_start opt_and charset subselect_end select_var_list select_var_list_init help opt_len - opt_extended_describe + opt_extended_describe curr_user END_OF_INPUT %type @@ -2684,6 +2685,8 @@ simple_expr: $$= new Item_func_curtime_local($3); Lex->safe_to_cache_query=0; } + | curr_user + { $$= create_func_current_user(); } | DATE_ADD_INTERVAL '(' expr ',' interval_expr interval ')' { $$= new Item_date_add_interval($3,$5,$6,0); } | DATE_SUB_INTERVAL '(' expr ',' interval_expr interval ')' @@ -4170,6 +4173,29 @@ show_param: { Lex->sql_command= SQLCOM_SHOW_LOGS; WARN_DEPRECATED("SHOW BDB LOGS", "SHOW ENGINE BDB LOGS"); } | LOGS_SYM { Lex->sql_command= SQLCOM_SHOW_LOGS; WARN_DEPRECATED("SHOW LOGS", "SHOW ENGINE BDB LOGS"); } + | GRANTS + { + LEX *lex=Lex; + lex->sql_command= SQLCOM_SHOW_GRANTS; + THD *thd= lex->thd; + LEX_USER *curr_user; + if (!(curr_user= (LEX_USER*) thd->alloc(sizeof(st_lex_user)))) + YYABORT; + curr_user->user.str= thd->priv_user; + curr_user->user.length= strlen(thd->priv_user); + if (*thd->priv_host != 0) + { + curr_user->host.str= thd->priv_host; + curr_user->host.length= strlen(thd->priv_host); + } + else + { + curr_user->host.str= (char *) "%"; + curr_user->host.length= 1; + } + curr_user->password.str=NullS; + lex->grant_user= curr_user; + } | GRANTS FOR_SYM user { LEX *lex=Lex; @@ -4744,6 +4770,11 @@ ident_or_text: | TEXT_STRING_sys { $$=$1;} | LEX_HOSTNAME { $$=$1;}; +curr_user: + CURRENT_USER {;} + | CURRENT_USER '(' ')' {;} + ; + user: ident_or_text { @@ -4760,7 +4791,25 @@ user: if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user)))) YYABORT; $$->user = $1; $$->host=$3; - }; + } + | curr_user + { + THD *thd= YYTHD; + if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user)))) + YYABORT; + $$->user.str= thd->priv_user; + $$->user.length= strlen(thd->priv_user); + if (*thd->priv_host != 0) + { + $$->host.str= thd->priv_host; + $$->host.length= strlen(thd->priv_host); + } + else + { + $$->host.str= (char *) "%"; + $$->host.length= 1; + } + }; /* Keyword that we allow for identifiers */ @@ -4798,6 +4847,7 @@ keyword: | COMPRESSED_SYM {} | CONCURRENT {} | CUBE_SYM {} + | CURRENT_USER {} | DATA_SYM {} | DATETIME {} | DATE_SYM {} From b5d93e4ef5409f76ce509edffd7d35b0ba987f64 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 5 Apr 2004 18:27:19 +0500 Subject: [PATCH 03/12] corrected wrong checking of DBUG_OFF in mysql-test/t/synchronization.test mysql-test/r/have_debug.require: corrected mistake mysql-test/t/synchronization.test: corrected wrong test --- mysql-test/r/have_debug.require | 4 ++-- mysql-test/t/synchronization.test | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/have_debug.require b/mysql-test/r/have_debug.require index 3ef51a3a6db..13f85741049 100644 --- a/mysql-test/r/have_debug.require +++ b/mysql-test/r/have_debug.require @@ -1,2 +1,2 @@ -instr(version(),convert('debug' using utf8))!=0; -1 \ No newline at end of file +instr(version(),convert('debug' using utf8))!=0 +1 diff --git a/mysql-test/t/synchronization.test b/mysql-test/t/synchronization.test index 695e405544a..bbea4c44dad 100644 --- a/mysql-test/t/synchronization.test +++ b/mysql-test/t/synchronization.test @@ -1,4 +1,4 @@ --- source include/have_crypt.inc +-- source include/have_debug.inc # # Test for Bug #2385 CREATE TABLE LIKE lacks locking on source and destination table From fe64a716f34052e41de0446c4b1c411e8e3db3c3 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 5 Apr 2004 16:28:16 +0300 Subject: [PATCH 04/12] Fixed a non-critical bug, but which affected how indent program indents the code. --- client/mysql.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/mysql.cc b/client/mysql.cc index 31f563d4116..fe6af909a5a 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -425,8 +425,9 @@ int main(int argc,char *argv[]) } #endif sprintf(buff, "%s", +#ifndef NOT_YET "Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n"); -#ifdef NOT_YET +#else "Type 'help [[%]function name[%]]' to get help on usage of function.\n"); #endif put_info(buff,INFO_INFO); From 6a868cca91198c14999f26b5da8a137bb320d7ba Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 6 Apr 2004 12:13:43 +0300 Subject: [PATCH 05/12] Fixed warnings from valgrind (not a bug) Don't add -debug to server version if MYSQL_SERVER_PREFIX is used Indentation cleanups myisam/mi_write.c: Indentation cleanup mysql-test/r/lowercase_table2.result: Fixed test results sql/filesort.cc: Fixed warnings from valgrind (not a bug) sql/ha_myisam.cc: Indentation cleanup sql/mysqld.cc: Don't add -debug to server if MYSQL_SERVER_PREFIX is used sql/sql_base.cc: Indentation cleanup sql/sql_show.cc: Fixed typo in comment sql/sql_table.cc: Indentation cleanup --- myisam/mi_write.c | 2 +- mysql-test/r/lowercase_table2.result | 4 ++-- sql/filesort.cc | 15 ++++++++++++++- sql/ha_myisam.cc | 7 ++----- sql/mysqld.cc | 8 +++----- sql/sql_base.cc | 2 +- sql/sql_show.cc | 2 +- sql/sql_table.cc | 8 ++++---- 8 files changed, 28 insertions(+), 20 deletions(-) diff --git a/myisam/mi_write.c b/myisam/mi_write.c index 59819b40f96..c17f47fc1ae 100644 --- a/myisam/mi_write.c +++ b/myisam/mi_write.c @@ -917,7 +917,7 @@ int mi_init_bulk_insert(MI_INFO *info, ulong cache_size, ha_rows rows) DBUG_PRINT("enter",("cache_size: %lu", cache_size)); DBUG_ASSERT(!info->bulk_insert && - (!rows || rows >= MI_MIN_ROWS_TO_USE_BULK_INSERT)); + (!rows || rows >= MI_MIN_ROWS_TO_USE_BULK_INSERT)); for (i=total_keylength=num_keys=0 ; i < share->base.keys ; i++) { diff --git a/mysql-test/r/lowercase_table2.result b/mysql-test/r/lowercase_table2.result index 737d49fc340..c29d52ffffc 100644 --- a/mysql-test/r/lowercase_table2.result +++ b/mysql-test/r/lowercase_table2.result @@ -13,7 +13,7 @@ SHOW CREATE TABLE T1; Table Create Table T1 CREATE TABLE `T1` ( `a` int(11) default NULL -) TYPE=MyISAM +) ENGINE=MyISAM DEFAULT CHARSET=latin1 RENAME TABLE T1 TO T2; SHOW TABLES LIKE "T2"; Tables_in_test (T2) @@ -68,7 +68,7 @@ SHOW CREATE TABLE T1; Table Create Table T1 CREATE TABLE `T1` ( `a` int(11) default NULL -) TYPE=InnoDB +) ENGINE=InnoDB DEFAULT CHARSET=latin RENAME TABLE T1 TO T2; SHOW TABLES LIKE "T2"; Tables_in_test (T2) diff --git a/sql/filesort.cc b/sql/filesort.cc index a15ffb43f6f..8699a517661 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -663,9 +663,22 @@ static void make_sortkey(register SORTPARAM *param, for ( ; (field= addonf->field) ; addonf++) { if (addonf->null_bit && field->is_null()) + { nulls[addonf->null_offset]|= addonf->null_bit; +#ifdef HAVE_purify + bzero(to, addonf->length); +#endif + } else - field->pack((char *) to, field->ptr); + { + uchar *end= (uchar*) field->pack((char *) to, field->ptr); +#ifdef HAVE_purify + uint length= (uint) ((to + addonf->length) - end); + DBUG_ASSERT((int) length >= 0); + if (length) + bzero(end, length); +#endif + } to+= addonf->length; } } diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 6ac3c52fe40..427edde2f4b 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -841,14 +841,11 @@ void ha_myisam::deactivate_non_unique_index(ha_rows rows) if (file->state->records == 0 && (!rows || rows >= MI_MIN_ROWS_TO_DISABLE_INDEXES)) mi_disable_non_unique_index(file,rows); - else - if (!file->bulk_insert && - (!rows || rows >= MI_MIN_ROWS_TO_USE_BULK_INSERT)) - { + else if (!file->bulk_insert && + (!rows || rows >= MI_MIN_ROWS_TO_USE_BULK_INSERT)) mi_init_bulk_insert(file, current_thd->variables.bulk_insert_buff_size, rows); - } } } enable_activate_all_index=1; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 62ec6bc1027..e5c996c663f 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2105,13 +2105,11 @@ static int init_common_variables(const char *conf_file_name, int argc, strmov(fn_ext(pidfile_name),".pid"); // Add proper extension #ifndef DBUG_OFF - if (*(MYSQL_SERVER_SUFFIX)) - strxmov(strend(server_version),MYSQL_SERVER_SUFFIX,"-debug",NullS); + if (!*(MYSQL_SERVER_SUFFIX)) + strmov(strend(server_version),"-debug"); else - strmov(strend(server_version),"--debug"); -#else - strmov(strend(server_version),MYSQL_SERVER_SUFFIX); #endif + strmov(strend(server_version),MYSQL_SERVER_SUFFIX); load_defaults(conf_file_name, groups, &argc, &argv); defaults_argv=argv; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index f3bf0a15745..dce08cf59c4 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1805,7 +1805,7 @@ Field *find_field_in_table(THD *thd,TABLE *table,const char *name,uint length, if (cached_field_index < table->fields && !my_strcasecmp(system_charset_info, table->field[cached_field_index]->field_name, name)) - field_ptr= table->field + cached_field_index; + field_ptr= table->field + cached_field_index; else if (table->name_hash.records) field_ptr= (Field**)hash_search(&table->name_hash,(byte*) name, length); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 506a5deda91..021064c6bfc 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1279,7 +1279,7 @@ store_create_info(THD *thd, TABLE *table, String *packet) /* - Again we are using CURRENT_TIMESTAMP instead of NOW becaus eit is + Again we are using CURRENT_TIMESTAMP instead of NOW because it is more standard */ has_now_default= table->timestamp_field == field && diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 5e358f76d3f..442774744b8 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -628,15 +628,15 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, if (!timestamps) { sql_field->unireg_check= Field::TIMESTAMP_DNUN_FIELD; - ++timestamps_with_niladic; + timestamps_with_niladic++; } else sql_field->unireg_check= Field::NONE; } - else if(sql_field->unireg_check != Field::NONE) - ++timestamps_with_niladic; + else if (sql_field->unireg_check != Field::NONE) + timestamps_with_niladic++; - ++timestamps; + timestamps++; /* fall-through */ default: sql_field->pack_flag=(FIELDFLAG_NUMBER | From e7a85e367f5518cbe3a4bc70d37a6a66418ea68f Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 6 Apr 2004 15:00:51 +0500 Subject: [PATCH 06/12] Previous patch was wrong :( Here is 2nd version. 'reduce/reduce conflicts' issue is fixed sql/sql_yacc.yy: 'reduce/reduce conflicts' issue is fixed --- sql/sql_yacc.yy | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index e02334b6ef7..a18b540141a 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -722,7 +722,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); union_clause union_list precision subselect_start opt_and charset subselect_end select_var_list select_var_list_init help opt_len - opt_extended_describe curr_user + opt_extended_describe END_OF_INPUT %type @@ -2685,7 +2685,7 @@ simple_expr: $$= new Item_func_curtime_local($3); Lex->safe_to_cache_query=0; } - | curr_user + | CURRENT_USER optional_braces { $$= create_func_current_user(); } | DATE_ADD_INTERVAL '(' expr ',' interval_expr interval ')' { $$= new Item_date_add_interval($3,$5,$6,0); } @@ -4769,11 +4769,6 @@ ident_or_text: | TEXT_STRING_sys { $$=$1;} | LEX_HOSTNAME { $$=$1;}; -curr_user: - CURRENT_USER {;} - | CURRENT_USER '(' ')' {;} - ; - user: ident_or_text { @@ -4791,7 +4786,7 @@ user: YYABORT; $$->user = $1; $$->host=$3; } - | curr_user + | CURRENT_USER optional_braces { THD *thd= YYTHD; if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user)))) @@ -4846,7 +4841,6 @@ keyword: | COMPRESSED_SYM {} | CONCURRENT {} | CUBE_SYM {} - | CURRENT_USER {} | DATA_SYM {} | DATETIME {} | DATE_SYM {} From e78208e59ba90a08630bef32b8423df3687bb96f Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 6 Apr 2004 12:31:25 +0200 Subject: [PATCH 07/12] don't modify constant strings sql/sql_prepare.cc: use static variable --- sql/sql_prepare.cc | 2 +- sql/table.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 94fef4cafdc..8a5759459af 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -802,7 +802,7 @@ static int mysql_test_select_fields(Prepared_statement *stmt, if (check_table_access(thd, privilege, tables,0)) DBUG_RETURN(1); } - else if (check_access(thd, privilege, "*any*",0,0,0)) + else if (check_access(thd, privilege, any_db,0,0,0)) DBUG_RETURN(1); #endif if ((&lex->select_lex != lex->all_selects_list && diff --git a/sql/table.cc b/sql/table.cc index dcd0d39d855..b25517bce10 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1288,7 +1288,7 @@ bool check_db_name(char *name) /* Used to catch empty names and names with end space */ bool last_char_is_space= TRUE; - if (lower_case_table_names) + if (lower_case_table_names && name != any_db) my_casedn_str(files_charset_info, name); while (*name) From 315f5d27c4579220ce56f56d29ff299ad715ec11 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 6 Apr 2004 19:17:13 +0500 Subject: [PATCH 08/12] fixed the tests mysql-test/t/synchronization.test for Bug #2385 CREATE TABLE LIKE lacks locking on source and destination table BitKeeper/deleted/.del-synchronization-master.opt~265be23ead00949: Delete: mysql-test/t/synchronization-master.opt BitKeeper/deleted/.del-have_debug.require~d981522532c711b2: Delete: mysql-test/r/have_debug.require BitKeeper/deleted/.del-have_debug.inc~f4dc5160b9912226: Delete: mysql-test/include/have_debug.inc mysql-test/r/synchronization.result: fixed the test for Bug #2385 CREATE TABLE LIKE lacks locking on source and destination table mysql-test/t/synchronization.test: fixed the test for Bug #2385 CREATE TABLE LIKE lacks locking on source and destination table sql/sql_table.cc: deleted test sleep from mysql_create_like_table --- mysql-test/include/have_debug.inc | 4 - mysql-test/r/have_debug.require | 2 - mysql-test/r/synchronization.result | 169 +++++++++++++++++++++--- mysql-test/t/synchronization-master.opt | 1 - mysql-test/t/synchronization.test | 64 ++++----- sql/sql_table.cc | 5 - 6 files changed, 180 insertions(+), 65 deletions(-) delete mode 100644 mysql-test/include/have_debug.inc delete mode 100644 mysql-test/r/have_debug.require delete mode 100644 mysql-test/t/synchronization-master.opt diff --git a/mysql-test/include/have_debug.inc b/mysql-test/include/have_debug.inc deleted file mode 100644 index 63c0c008b21..00000000000 --- a/mysql-test/include/have_debug.inc +++ /dev/null @@ -1,4 +0,0 @@ --- require r/have_debug.require -disable_query_log; -select instr(version(),convert('debug' using utf8))!=0; -enable_query_log; diff --git a/mysql-test/r/have_debug.require b/mysql-test/r/have_debug.require deleted file mode 100644 index 13f85741049..00000000000 --- a/mysql-test/r/have_debug.require +++ /dev/null @@ -1,2 +0,0 @@ -instr(version(),convert('debug' using utf8))!=0 -1 diff --git a/mysql-test/r/synchronization.result b/mysql-test/r/synchronization.result index 87800939ed9..ad9443c86da 100644 --- a/mysql-test/r/synchronization.result +++ b/mysql-test/r/synchronization.result @@ -1,23 +1,162 @@ -CREATE TABLE t1 (a int); - CREATE TABLE t2 LIKE t1; -ALTER TABLE t1 add key(a); +CREATE TABLE t1 (x1 int); + ALTER TABLE t1 CHANGE x1 x2 int; +CREATE TABLE t2 LIKE t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `a` int(11) default NULL + `xx` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -drop table t1, t2; -CREATE TABLE t1 (a int); - CREATE TABLE t2 LIKE t1; -CREATE TABLE t2 (b int); -let's take a look at result of create .. like : ------------ -ERROR HY000: Can't create/write to file './test/t2.frm' (Errcode: 17) ------------ - +DROP TABLE t2; + ALTER TABLE t1 CHANGE x2 x1 int; +CREATE TABLE t2 LIKE t1; SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( - `b` int(11) default NULL + `xx` int(11) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -drop table t1, t2; +DROP TABLE t2; + ALTER TABLE t1 CHANGE x1 x2 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x2 x1 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x1 x2 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x2 x1 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x1 x2 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x2 x1 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x1 x2 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x2 x1 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x1 x2 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x2 x1 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x1 x2 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x2 x1 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x1 x2 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x2 x1 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x1 x2 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x2 x1 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x1 x2 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; + ALTER TABLE t1 CHANGE x2 x1 int; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `xx` int(11) default NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; diff --git a/mysql-test/t/synchronization-master.opt b/mysql-test/t/synchronization-master.opt deleted file mode 100644 index 710a0395d55..00000000000 --- a/mysql-test/t/synchronization-master.opt +++ /dev/null @@ -1 +0,0 @@ ---exit-info=2048 \ No newline at end of file diff --git a/mysql-test/t/synchronization.test b/mysql-test/t/synchronization.test index bbea4c44dad..7bdeaa8a740 100644 --- a/mysql-test/t/synchronization.test +++ b/mysql-test/t/synchronization.test @@ -1,45 +1,33 @@ --- source include/have_debug.inc - # # Test for Bug #2385 CREATE TABLE LIKE lacks locking on source and destination table # -connect (con_to_sleep,localhost,lock_controller,,); -connect (con_to_harm_sleeper,localhost,root,,); +connect (con1,localhost,root,,); +connect (con2,localhost,root,,); # locking of source: -connection con_to_sleep; -CREATE TABLE t1 (a int); -send CREATE TABLE t2 LIKE t1; -connection con_to_harm_sleeper; -sleep 1; -ALTER TABLE t1 add key(a); - -connection con_to_sleep; -sleep 4; -SHOW CREATE TABLE t2; -drop table t1, t2; - -# locking of destination: -connection con_to_sleep; -CREATE TABLE t1 (a int); -send CREATE TABLE t2 LIKE t1; - -connection con_to_harm_sleeper; -sleep 1; -CREATE TABLE t2 (b int); -disable_query_log; -select "-----------" as "let's take a look at result of create .. like : "; -enable_query_log; - -connection con_to_sleep; -sleep 1; ---error 1 -reap; -disable_query_log; -select "" as "-----------"; -enable_query_log; -SHOW CREATE TABLE t2; - -drop table t1, t2; \ No newline at end of file +CREATE TABLE t1 (x1 int); +let $1= 10; +while ($1) +{ + connection con1; + send ALTER TABLE t1 CHANGE x1 x2 int; + connection con2; + CREATE TABLE t2 LIKE t1; + replace_result x1 xx x2 xx; + SHOW CREATE TABLE t2; + DROP TABLE t2; + connection con1; + reap; + send ALTER TABLE t1 CHANGE x2 x1 int; + connection con2; + CREATE TABLE t2 LIKE t1; + replace_result x1 xx x2 xx; + SHOW CREATE TABLE t2; + DROP TABLE t2; + connection con1; + reap; + dec $1; +} +DROP TABLE t1; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 5e358f76d3f..343bcda9102 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1963,11 +1963,6 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table, /* Create a new table by copying from source table */ -#ifndef DBUG_OFF - // The code stated below is for test synchronization.test Bug #2385 - if (test_flags & TEST_SYNCHRONIZATION) - sleep(3); -#endif if (my_copy(src_path, dst_path, MYF(MY_WME|MY_DONT_OVERWRITE_FILE))) goto err; From ae3d22668921d11c584d7cf395f60ed29cb651d1 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 6 Apr 2004 17:57:32 +0300 Subject: [PATCH 09/12] Fixed a problem with mysqld_multi log file. The default is now datadir/mysqld_multi.log, if doesn't exists or is not writable, then /var/log/mysqld_multi.log, if does not exists or is not writable, then /tmp/mysqld_multi.log, but only in case the file does not yet exists in /tmp. Otherwise log will be disabled, unless user explicitely sets it with an option. BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + scripts/mysqld_multi.sh | 59 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 58 insertions(+), 2 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 4067304c8e1..b3533f2a834 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -52,6 +52,7 @@ hf@genie.(none) igor@hundin.mysql.fi igor@rurik.mysql.com ingo@mysql.com +jani@a80-186-24-72.elisa-laajakaista.fi jani@dsl-jkl1657.dial.inet.fi jani@dsl-kpogw4gb5.dial.inet.fi jani@hynda.(none) diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh index 3165a01362c..a4f2b18fda8 100644 --- a/scripts/mysqld_multi.sh +++ b/scripts/mysqld_multi.sh @@ -4,12 +4,12 @@ use Getopt::Long; use POSIX qw(strftime); $|=1; -$VER="2.5"; +$VER="2.6"; $opt_config_file = undef(); $opt_example = 0; $opt_help = 0; -$opt_log = "/tmp/mysqld_multi.log"; +$opt_log = ""; $opt_mysqladmin = "@bindir@/mysqladmin"; $opt_mysqld = "@libexecdir@/mysqld"; $opt_no_log = 0; @@ -18,6 +18,9 @@ $opt_tcp_ip = 0; $opt_user = "root"; $opt_version = 0; +my $my_print_defaults_exists= 1; +my $logdir= undef(); + my ($mysqld, $mysqladmin, $groupids, $homedir, $my_progname); $homedir = $ENV{HOME}; @@ -42,7 +45,9 @@ sub main print "Please make sure you have this command available and\n"; print "in your path. The command is available from the latest\n"; print "MySQL distribution.\n"; + $my_print_defaults_exists= 0; } + init_log(); my @defops = `my_print_defaults mysqld_multi`; chop @defops; splice @ARGV, 0, 0, @defops; @@ -112,6 +117,56 @@ sub main } } +#### +#### Init log file. Check for appropriate place for log file, in the following +#### order my_print_defaults mysqld datadir, @datadir@, /var/log, /tmp +#### + +sub init_log +{ + if ($my_print_defaults_exists) + { + @mysqld_opts= `my_print_defaults mysqld`; + chomp @mysqld_opts; + foreach my $opt (@mysqld_opts) + { + if ($opt =~ m/^\-\-datadir[=](.*)/) + { + if (-d "$1" && -w "$1") + { + $logdir= $1; + } + } + } + } + if (!defined($logdir)) + { + $logdir= "@datadir@" if (-d "@datadir@" && -w "@datadir@"); + } + if (!defined($logdir)) + { + $logdir= "/var/log" if (-d "/var/log" && -w "/var/log"); + } + if (!defined($logdir)) + { + if (-d "/tmp" && -w "/tmp" && ! -e "/tmp/mysqld_multi.log") + { + $logdir= "/tmp"; + } + } + if (!defined($logdir)) + { + # We still couldn't get a default log file in place. Log file + # will be disabled unless user sets it with an option + + $opt_no_log= 1; + } + else + { + $opt_log= "$logdir/mysqld_multi.log"; + } +} + #### #### Report living and not running MySQL servers #### From 815c23f1e6431a6e20e8915fa92a71f7a754d5b7 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 6 Apr 2004 19:57:33 +0500 Subject: [PATCH 10/12] Fixed charsetnr sent to the client --- client/mysqltest.c | 5 ++- mysql-test/r/metadata.result | 70 ++++++++++++++++++------------------ mysql-test/r/union.result | 6 ++-- sql/field.cc | 12 +++++++ sql/protocol.cc | 5 ++- sql/table.cc | 1 - 6 files changed, 58 insertions(+), 41 deletions(-) diff --git a/client/mysqltest.c b/client/mysqltest.c index 00165ab4f45..be5dac1c9d9 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -2358,7 +2358,7 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags) if (display_metadata) { - dynstr_append(ds,"Catalog\tDatabase\tTable\tTable_alias\tColumn\tColumn_alias\tName\tType\tLength\tMax length\tIs_null\tFlags\tDecimals\n"); + dynstr_append(ds,"Catalog\tDatabase\tTable\tTable_alias\tColumn\tColumn_alias\tName\tType\tLength\tMax length\tIs_null\tFlags\tDecimals\tCharsetnr\n"); for (field= mysql_fetch_fields(res), field_end= field+num_fields ; field < field_end ; field++) @@ -2394,6 +2394,9 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags) dynstr_append_mem(ds, "\t", 1); int10_to_str((int) field->decimals, buff, 10); dynstr_append(ds, buff); + dynstr_append_mem(ds, "\t", 1); + int10_to_str((int) field->charsetnr, buff, 10); + dynstr_append(ds, buff); dynstr_append_mem(ds, "\n", 1); } } diff --git a/mysql-test/r/metadata.result b/mysql-test/r/metadata.result index 59914447087..80a01a0ca90 100644 --- a/mysql-test/r/metadata.result +++ b/mysql-test/r/metadata.result @@ -1,36 +1,36 @@ drop table if exists t1,t2; select 1, 1.0, -1, "hello", NULL; -Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals -def 1 8 1 1 N 32769 0 -def 1.0 5 3 3 N 32769 1 -def -1 8 1 2 N 32769 0 -def hello 254 5 5 N 1 31 -def NULL 6 0 0 Y 32768 0 +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def 1 8 1 1 N 32769 0 8 +def 1.0 5 3 3 N 32769 1 8 +def -1 8 1 2 N 32769 0 8 +def hello 254 5 5 N 1 31 8 +def NULL 6 0 0 Y 32768 0 8 1 1.0 -1 hello NULL 1 1.0 -1 hello NULL create table t1 (a tinyint, b smallint, c mediumint, d int, e bigint, f float(3,2), g double(4,3), h decimal(5,4), i year, j date, k timestamp, l datetime, m enum('a','b'), n set('a','b'), o char(10)); select * from t1; -Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals -def test t1 t1 a a 1 4 0 Y 32768 0 -def test t1 t1 b b 2 6 0 Y 32768 0 -def test t1 t1 c c 9 9 0 Y 32768 0 -def test t1 t1 d d 3 11 0 Y 32768 0 -def test t1 t1 e e 8 20 0 Y 32768 0 -def test t1 t1 f f 4 3 0 Y 32768 2 -def test t1 t1 g g 5 4 0 Y 32768 3 -def test t1 t1 h h 0 7 0 Y 32768 4 -def test t1 t1 i i 13 4 0 Y 32864 0 -def test t1 t1 j j 10 10 0 Y 0 0 -def test t1 t1 k k 7 19 0 N 1089 0 -def test t1 t1 l l 12 19 0 Y 0 0 -def test t1 t1 m m 254 1 0 Y 256 0 -def test t1 t1 n n 254 3 0 Y 2048 0 -def test t1 t1 o o 254 10 0 Y 0 0 +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a a 1 4 0 Y 32768 0 63 +def test t1 t1 b b 2 6 0 Y 32768 0 63 +def test t1 t1 c c 9 9 0 Y 32768 0 63 +def test t1 t1 d d 3 11 0 Y 32768 0 63 +def test t1 t1 e e 8 20 0 Y 32768 0 63 +def test t1 t1 f f 4 3 0 Y 32768 2 63 +def test t1 t1 g g 5 4 0 Y 32768 3 63 +def test t1 t1 h h 0 7 0 Y 32768 4 63 +def test t1 t1 i i 13 4 0 Y 32864 0 63 +def test t1 t1 j j 10 10 0 Y 128 0 63 +def test t1 t1 k k 7 19 0 N 1217 0 63 +def test t1 t1 l l 12 19 0 Y 128 0 63 +def test t1 t1 m m 254 1 0 Y 256 0 8 +def test t1 t1 n n 254 3 0 Y 2048 0 8 +def test t1 t1 o o 254 10 0 Y 0 0 8 a b c d e f g h i j k l m n o select a b, b c from t1 as t2; -Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals -def test t1 t2 a b 1 4 0 Y 32768 0 -def test t1 t2 b c 2 6 0 Y 32768 0 +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t2 a b 1 4 0 Y 32768 0 63 +def test t1 t2 b c 2 6 0 Y 32768 0 63 b c drop table t1; CREATE TABLE t1 (id tinyint(3) default NULL, data varchar(255) default NULL); @@ -38,24 +38,24 @@ INSERT INTO t1 VALUES (1,'male'),(2,'female'); CREATE TABLE t2 (id tinyint(3) unsigned default NULL, data char(3) default '0'); INSERT INTO t2 VALUES (1,'yes'),(2,'no'); select t1.id, t1.data, t2.data from t1, t2 where t1.id = t2.id; -Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals -def test t1 t1 id id 1 3 1 Y 32768 0 -def test t1 t1 data data 253 255 6 Y 0 0 -def test t2 t2 data data 254 3 3 Y 0 0 +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 id id 1 3 1 Y 32768 0 63 +def test t1 t1 data data 253 255 6 Y 0 0 8 +def test t2 t2 data data 254 3 3 Y 0 0 8 id data data 1 male yes 2 female no select t1.id, t1.data, t2.data from t1, t2 where t1.id = t2.id order by t1.id; -Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals -def test t1 t1 id id 1 3 1 Y 32768 0 -def test t1 t1 data data 253 255 6 Y 0 0 -def test t2 t2 data data 254 3 3 Y 0 0 +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 id id 1 3 1 Y 32768 0 63 +def test t1 t1 data data 253 255 6 Y 0 0 8 +def test t2 t2 data data 254 3 3 Y 0 0 8 id data data 1 male yes 2 female no select t1.id from t1 union select t2.id from t2; -Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals -def test t1 t1 id id 1 3 1 Y 32768 0 +Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 id id 1 3 1 Y 32768 0 63 id 1 2 diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index 8e288f9725f..a39a4e8a85f 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -693,7 +693,7 @@ testc show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `dt` char(19) default NULL + `dt` binary(19) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 SELECT dt from t2 UNION select sv from t2; @@ -704,7 +704,7 @@ testv show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `dt` char(19) default NULL + `dt` binary(19) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 SELECT sc from t2 UNION select sv from t2; @@ -726,7 +726,7 @@ tetetetetest show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `dt` longblob + `dt` blob ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; create table t1 SELECT sv from t2 UNION select b from t2; diff --git a/sql/field.cc b/sql/field.cc index 8408bfdf578..30ae20de94b 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -5623,6 +5623,18 @@ Field *make_field(char *ptr, uint32 field_length, null_pos=0; null_bit=0; } + + switch (field_type) + { + case FIELD_TYPE_DATE: + case FIELD_TYPE_NEWDATE: + case FIELD_TYPE_TIME: + case FIELD_TYPE_DATETIME: + case FIELD_TYPE_TIMESTAMP: + field_charset= &my_charset_bin; + default: break; + } + if (f_is_alpha(pack_flag)) { if (!f_is_packed(pack_flag)) diff --git a/sql/protocol.cc b/sql/protocol.cc index 61af6ffceaf..fb4d2a57ab6 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -530,7 +530,10 @@ bool Protocol::send_fields(List *list, uint flag) /* Store fixed length fields */ pos= (char*) local_packet->ptr()+local_packet->length(); *pos++= 12; // Length of packed fields - int2store(pos, field.charsetnr); + if (item->collation.collation == &my_charset_bin || thd_charset == NULL) + int2store(pos, field.charsetnr); + else + int2store(pos, thd_charset->number); int4store(pos+2, field.length); pos[6]= field.type; int2store(pos+7,field.flags); diff --git a/sql/table.cc b/sql/table.cc index b25517bce10..23d99466a83 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -465,7 +465,6 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag, goto err_not_open; /* purecov: inspected */ } reg_field->comment=comment; - reg_field->set_charset(charset); if (!(reg_field->flags & NOT_NULL_FLAG)) { if ((null_bit<<=1) == 256) From 6c3106456def1ba07d0aa2610be615222095df7f Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 6 Apr 2004 20:26:35 +0500 Subject: [PATCH 11/12] fixed bug #3342 "SHOW CREATE DATABASE seems to require DROP privilege" (now it require only SELECT privilege on database) mysql-test/r/show_check.result: added test for bug #3342 "SHOW CREATE DATABASE seems to require DROP privilege" mysql-test/t/show_check.test: added test for bug #3342 "SHOW CREATE DATABASE seems to require DROP privilege" --- mysql-test/r/show_check.result | 38 +++++++++++++++++++++++++++ mysql-test/t/show_check.test | 48 ++++++++++++++++++++++++++++++++++ sql/sql_parse.cc | 2 +- 3 files changed, 87 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index 5a5eb025353..b54d4b5a342 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -362,3 +362,41 @@ t1 HEAP Fixed 0 5 # # # 5 NULL NULL NULL NULL latin1_swedish_ci NULL t2 HEAP Fixed 0 5 # # # 5 NULL NULL NULL NULL latin1_swedish_ci NULL t3 HEAP Fixed 0 9 # # # 9 NULL NULL NULL NULL latin1_swedish_ci NULL drop table t1, t2, t3; +create database test_$1; +show create database test_$1; +Database Create Database +test_$1 CREATE DATABASE `test_$1` /*!40100 DEFAULT CHARACTER SET latin1 */ +create table test_$1.t1(a int); +insert into test_$1.t1 values(1); +grant select on `test_$1`.* to mysqltest_1@localhost; +grant usage on `test_$1`.* to mysqltest_2@localhost; +grant drop on `test_$1`.* to mysqltest_3@localhost; +select * from t1; +a +1 +show create database test_$1; +Database Create Database +test_$1 CREATE DATABASE `test_$1` /*!40100 DEFAULT CHARACTER SET latin1 */ +drop table t1; +ERROR 42000: Access denied for user: 'mysqltest_1'@'localhost' to database 'test_$1' +drop database test_$1; +ERROR 42000: Access denied for user: 'mysqltest_1'@'localhost' to database 'test_$1' +select * from test_$1.t1; +ERROR 42000: Access denied for user: 'mysqltest_2'@'localhost' to database 'test_$1' +show create database test_$1; +ERROR 42000: Access denied for user: 'mysqltest_2'@'localhost' to database 'test_$1' +drop table test_$1.t1; +ERROR 42000: Access denied for user: 'mysqltest_2'@'localhost' to database 'test_$1' +drop database test_$1; +ERROR 42000: Access denied for user: 'mysqltest_2'@'localhost' to database 'test_$1' +select * from test_$1.t1; +ERROR 42000: Access denied for user: 'mysqltest_3'@'localhost' to database 'test_$1' +show create database test_$1; +ERROR 42000: Access denied for user: 'mysqltest_3'@'localhost' to database 'test_$1' +drop table test_$1.t1; +drop database test_$1; +delete from mysql.user +where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3'; +delete from mysql.db +where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3'; +flush privileges; diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test index 638626a7456..b0307af19bb 100644 --- a/mysql-test/t/show_check.test +++ b/mysql-test/t/show_check.test @@ -256,3 +256,51 @@ delete from t3 where a=5; show table status; drop table t1, t2, t3; + +# +# Test for bug #3342 SHOW CREATE DATABASE seems to require DROP privilege +# + +create database test_$1; +show create database test_$1; +create table test_$1.t1(a int); +insert into test_$1.t1 values(1); +grant select on `test_$1`.* to mysqltest_1@localhost; +grant usage on `test_$1`.* to mysqltest_2@localhost; +grant drop on `test_$1`.* to mysqltest_3@localhost; + +connect (con1,localhost,mysqltest_1,,test_$1); +connection con1; +select * from t1; +show create database test_$1; +--error 1044 +drop table t1; +--error 1044 +drop database test_$1; + +connect (con2,localhost,mysqltest_2,,test); +connection con2; +--error 1044 +select * from test_$1.t1; +--error 1044 +show create database test_$1; +--error 1044 +drop table test_$1.t1; +--error 1044 +drop database test_$1; + +connect (con3,localhost,mysqltest_3,,test); +connection con3; +--error 1044 +select * from test_$1.t1; +--error 1044 +show create database test_$1; +drop table test_$1.t1; +drop database test_$1; + +connection default; +delete from mysql.user +where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3'; +delete from mysql.db +where user='mysqltest_1' || user='mysqltest_2' || user='mysqltest_3'; +flush privileges; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index aa3e40e1df8..3639f9f77c3 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3131,7 +3131,7 @@ mysql_execute_command(THD *thd) net_printf(thd,ER_WRONG_DB_NAME, lex->name); break; } - if (check_access(thd,DROP_ACL,lex->name,0,1,0)) + if (check_access(thd,SELECT_ACL,lex->name,0,1,0)) break; if (thd->locked_tables || thd->active_transaction()) { From e9447881eb13378b06f0939091ab4e258a83ad51 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 7 Apr 2004 04:33:58 +0300 Subject: [PATCH 12/12] Portability fixes Fixed problems with group_concat() and HAVING Updated crash-me values sql-bench/limits/mysql-4.0.cfg: Rename: sql-bench/limits/mysql.cfg -> sql-bench/limits/mysql-4.0.cfg include/my_global.h: Safety fix libmysqld/Makefile.am: Portability fix (For AIX 64 bit) mysql-test/r/func_gconcat.result: More tests mysql-test/t/func_gconcat.test: More tests sql/field.cc: Cleanups sql/init.cc: moved thread_stack_min to right place sql/item_sum.cc: Fixed problems with group_concat() and HAVING Removed some not needed variables sql/item_sum.h: Fixed problems with group_concat() and HAVING Removed some not needed variables sql/mysqld.cc: Moved thread_stack_min to right place to handle case where we didn't get as much stack space as we asked for sql/sql_parse.cc: More debugging sql/sql_select.cc: Cleanup sql/sql_yacc.yy: Fixed handling of Item_group_concat() in having. (Arguments should not be handled as refs) --- include/my_global.h | 8 +- libmysqld/Makefile.am | 4 +- mysql-test/r/func_gconcat.result | 27 +- mysql-test/t/func_gconcat.test | 13 +- sql-bench/limits/mysql-4.0.cfg | 7050 ++++++++++++++++++++++++++++++ sql-bench/limits/mysql.cfg | 318 +- sql/field.cc | 11 - sql/init.cc | 2 - sql/item_sum.cc | 115 +- sql/item_sum.h | 2 - sql/mysqld.cc | 2 + sql/sql_parse.cc | 7 + sql/sql_select.cc | 3 +- sql/sql_yacc.yy | 12 +- 14 files changed, 7326 insertions(+), 248 deletions(-) create mode 100644 sql-bench/limits/mysql-4.0.cfg diff --git a/include/my_global.h b/include/my_global.h index 4a56741ddbc..e114aefecca 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -1120,10 +1120,10 @@ typedef union { *((T)+1)=(((A) >> 16));\ *((T)+0)=(((A) >> 24)); } -#define doubleget(V,M) memcpy((byte*) &V,(byte*) (M),sizeof(double)) -#define doublestore(T,V) memcpy((byte*) (T),(byte*) &V,sizeof(double)) -#define longlongget(V,M) memcpy((byte*) &V,(byte*) (M),sizeof(ulonglong)) -#define longlongstore(T,V) memcpy((byte*) (T),(byte*) &V,sizeof(ulonglong)) +#define doubleget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(double)) +#define doublestore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(double)) +#define longlongget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(ulonglong)) +#define longlongstore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(ulonglong)) #else diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am index da58a711d22..0cfcf8b1c49 100644 --- a/libmysqld/Makefile.am +++ b/libmysqld/Makefile.am @@ -88,9 +88,9 @@ libmysqld.a: libmysqld_int.a $(INC_LIB) cd tmp ; \ for file in *.a ; do \ bfile=`basename $$file .a` ; \ - ar x $$file; \ + $(AR) x $$file; \ for obj in *.o ; do mv $$obj $${bfile}_$$obj ; done ; \ - ar q ../libmysqld_int2.a *.o ; \ + $(AR) q ../libmysqld_int2.a *.o ; \ rm -f *.o ; \ done mv libmysqld_int2.a libmysqld.a diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result index 3ab43ce11d5..dccd87e3d75 100644 --- a/mysql-test/r/func_gconcat.result +++ b/mysql-test/r/func_gconcat.result @@ -59,11 +59,16 @@ grp group_concat(d order by a desc) 1 a 2 b,a 3 c,d,d,b,b,a -select grp,group_concat(a order by a,d+c) from t1 group by grp; -grp group_concat(a order by a,d+c) +select grp,group_concat(a order by a,d+c-ascii(c)-a) from t1 group by grp; +grp group_concat(a order by a,d+c-ascii(c)-a) 1 1 2 2,3 3 4,5,6,7,8,9 +select grp,group_concat(a order by d+c-ascii(c),a) from t1 group by grp; +grp group_concat(a order by d+c-ascii(c),a) +1 1 +2 3,2 +3 7,8,4,6,9,5 select grp,group_concat(c order by 1) from t1 group by grp; grp group_concat(c order by 1) 1 a @@ -197,9 +202,21 @@ NULL drop table t1; drop table t2; create table t1 (bar varchar(32)); -insert into t1 values('test'),('test2'); -select * from t1 having group_concat(bar)=''; +insert into t1 values('test1'),('test2'); +select group_concat(bar order by concat(bar,bar)) from t1; +group_concat(bar order by concat(bar,bar)) +test1,test2 +select group_concat(bar order by concat(bar,bar) desc) from t1; +group_concat(bar order by concat(bar,bar) desc) +test2,test1 +select bar from t1 having group_concat(bar)=''; bar +select bar from t1 having instr(group_concat(bar), "test") > 0; +bar +test1 +select bar from t1 having instr(group_concat(bar order by concat(bar,bar) desc), "test2,test1") > 0; +bar +test1 drop table t1; create table t1 (a int, a1 varchar(10)); create table t2 (a0 int); @@ -246,7 +263,7 @@ id1 concat_id drop table t1,t2; create table t1 (s1 char(10), s2 int not null); insert into t1 values ('a',2),('b',2),('c',1),('a',3),('b',4),('c',4); -select distinct s1 from t1 order by s2; +select distinct s1 from t1 order by s2,s1; s1 c a diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test index 87df427616a..9d99a57afe5 100644 --- a/mysql-test/t/func_gconcat.test +++ b/mysql-test/t/func_gconcat.test @@ -29,7 +29,8 @@ select grp,group_concat(c order by c) from t1 group by grp; select grp,group_concat(c order by c desc) from t1 group by grp; select grp,group_concat(d order by a) from t1 group by grp; select grp,group_concat(d order by a desc) from t1 group by grp; -select grp,group_concat(a order by a,d+c) from t1 group by grp; +select grp,group_concat(a order by a,d+c-ascii(c)-a) from t1 group by grp; +select grp,group_concat(a order by d+c-ascii(c),a) from t1 group by grp; select grp,group_concat(c order by 1) from t1 group by grp; select grp,group_concat(c order by "c") from t1 group by grp; select grp,group_concat(distinct c order by c) from t1 group by grp; @@ -108,8 +109,12 @@ drop table t2; # check having create table t1 (bar varchar(32)); -insert into t1 values('test'),('test2'); -select * from t1 having group_concat(bar)=''; +insert into t1 values('test1'),('test2'); +select group_concat(bar order by concat(bar,bar)) from t1; +select group_concat(bar order by concat(bar,bar) desc) from t1; +select bar from t1 having group_concat(bar)=''; +select bar from t1 having instr(group_concat(bar), "test") > 0; +select bar from t1 having instr(group_concat(bar order by concat(bar,bar) desc), "test2,test1") > 0; drop table t1; # ORDER BY fix_fields() @@ -147,7 +152,7 @@ drop table t1,t2; create table t1 (s1 char(10), s2 int not null); insert into t1 values ('a',2),('b',2),('c',1),('a',3),('b',4),('c',4); -select distinct s1 from t1 order by s2; +select distinct s1 from t1 order by s2,s1; select group_concat(distinct s1) from t1; select group_concat(distinct s1 order by s2) from t1 where s2 < 4; # The following is wrong and needs to be fixed ASAP diff --git a/sql-bench/limits/mysql-4.0.cfg b/sql-bench/limits/mysql-4.0.cfg new file mode 100644 index 00000000000..feaa79e43e9 --- /dev/null +++ b/sql-bench/limits/mysql-4.0.cfg @@ -0,0 +1,7050 @@ +#This file is automaticly generated by crash-me 1.61 + +NEG=yes # update of column= -column + ###< create table crash_q (a integer) + ###> OK + ###< insert into crash_q values(10) + ###> OK + ###< update crash_q set a=-a + ###> OK + ###< drop table crash_q + ###> OK + ### + ###As far as all queries returned OK, result is YES +Need_cast_for_null=no # Need to cast NULL for arithmetic + ### Check if numeric_null (NULL) is 'NULL' +alter_add_col=yes # Alter table add column + ###< alter table crash_q add d integer + ###> OK + ### + ###As far as all queries returned OK, result is YES +alter_add_constraint=yes # Alter table add constraint + ###< alter table crash_q add constraint c2 check(a > b) + ###> OK + ### + ###As far as all queries returned OK, result is YES +alter_add_foreign_key=no # Alter table add foreign key + ###< alter table crash_q add constraint f1 foreign key(c1) + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 + ###< references crash_q1(c1) + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'references crash_q1(c1)' at line 1 + ### + ###As far as some queries didnt return OK, result is NO +alter_add_multi_col=yes # Alter table add many columns + ###< alter table crash_q add (f integer,g integer) + ###> OK +alter_add_primary_key=with constraint # Alter table add primary key + ###< alter table crash_q1 add constraint p1 primary key(c1) + ###> OK +alter_add_unique=yes # Alter table add unique + ###< alter table crash_q add constraint u1 unique(c1) + ###> OK + ### + ###As far as all queries returned OK, result is YES +alter_alter_col=yes # Alter table alter column default + ###< alter table crash_q alter b set default 10 + ###> OK + ### + ###As far as all queries returned OK, result is YES +alter_change_col=yes # Alter table change column + ###< alter table crash_q change a e char(50) + ###> OK + ### + ###As far as all queries returned OK, result is YES +alter_drop_col=yes # Alter table drop column + ###< alter table crash_q drop column b + ###> OK +alter_drop_constraint=no # Alter table drop constraint + ###< alter table crash_q drop constraint c2 + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'constraint c2' at line 1 + ### + ###< alter table crash_q drop constraint c2 restrict + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'constraint c2 restrict' at line 1 +alter_drop_foreign_key=with drop foreign key # Alter table drop foreign key + ###< alter table crash_q drop constraint f1 + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'constraint f1' at line 1 + ### + ###< alter table crash_q drop constraint f1 restrict + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'constraint f1 restrict' at line 1 + ### + ###< alter table crash_q drop foreign key f1 + ###> OK +alter_drop_primary_key=drop primary key # Alter table drop primary key + ###< alter table crash_q1 drop constraint p1 restrict + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'constraint p1 restrict' at line 1 + ### + ###< alter table crash_q1 drop primary key + ###> OK +alter_drop_unique=with drop key # Alter table drop unique + ###< alter table crash_q drop constraint u1 + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'constraint u1' at line 1 + ### + ###< alter table crash_q drop constraint u1 restrict + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'constraint u1 restrict' at line 1 + ### + ###< alter table crash_q drop key c1 + ###> OK +alter_modify_col=yes # Alter table modify column + ###< alter table crash_q modify c1 CHAR(20) + ###> OK +alter_rename_table=yes # Alter table rename table + ###< alter table crash_q rename to crash_q1 + ###> OK + ### + ###As far as all queries returned OK, result is YES +atomic_updates=no # atomic updates + ###< create table crash_q (a integer not null,primary key (a)) + ###> OK + ###< insert into crash_q values (2) + ###> OK + ###< insert into crash_q values (3) + ###> OK + ###< insert into crash_q values (1) + ###> OK + ###< update crash_q set a=a+1 + ###> execute error:Duplicate entry '3' for key 1 + ###< drop table crash_q + ###> OK + ### + ###As far as some queries didnt return OK, result is NO +automatic_rowid=_rowid # Automatic row id + ###< create table crash_q (a int not null, primary key(a)) + ###> OK + ###< insert into crash_q values (1) + ###> OK + ###< select _rowid from crash_q + ###> OK + ###< drop table crash_q + ###> OK +binary_numbers=no # binary numbers (0b1001) + ###< select 0b1001 + ###> execute error:Unknown column '0b1001' in 'field list' + ### + ###As far as some queries didnt return OK, result is NO +binary_strings=no # binary strings (b'0110') + ###< select b'0110' + ###> execute error:Unknown column 'b' in 'field list' + ### + ###As far as some queries didnt return OK, result is NO +case_insensitive_strings=yes # Case insensitive compare + ### + ###aa + ###We expected 'a a ' but got 'aa' +column_alias=yes # Column alias + ###< select a as ab from crash_me + ###> OK + ### + ###As far as all queries returned OK, result is YES +columns_in_group_by=+64 # number of columns in group by + ###We are trying (example with N=5): + ###create table crash_q (q1 integer,q2 integer,q3 integer,q4 integer,q5 integer) + ###insert into crash_q values(1,1,1,1,1) + ###insert into crash_q values(1,1,1,1,1) + ###select q1,q2,q3,q4,q5 from crash_q group by q1,q2,q3,q4,q5 +columns_in_order_by=+64 # number of columns in order by + ###We are trying (example with N=5): + ###create table crash_q (q1 integer,q2 integer,q3 integer,q4 integer,q5 integer) + ###insert into crash_q values(1,1,1,1,1) + ###insert into crash_q values(1,1,1,1,1) + ###select * from crash_q order by q1,q2,q3,q4,q5 +comment_#=yes # # as comment + ###< select * from crash_me # Testing of comments + ###> OK + ### + ###As far as all queries returned OK, result is YES +comment_--=yes # -- as comment (ANSI) + ###< select * from crash_me -- Testing of comments + ###> OK + ### + ###As far as all queries returned OK, result is YES +comment_/**/=yes # /* */ as comment + ###< select * from crash_me /* Testing of comments */ + ###> OK + ### + ###As far as all queries returned OK, result is YES +comment_//=no # // as comment + ###< select * from crash_me // Testing of comments + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '// Testing of comments' at line 1 + ### + ###As far as some queries didnt return OK, result is NO +compute=no # Compute + ###< select a from crash_me order by a compute sum(a) by a + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'compute sum(a) by a' at line 1 + ### + ###As far as some queries didnt return OK, result is NO +connections=101 # Simultaneous connections (installation default) +constraint_check=syntax only # Column constraints + ###< create table crash_q (a int check (a>0)) + ###> OK + ### + ###< insert into crash_q values(0) + ###> OK + ### + ###< drop table crash_q + ###> OK +constraint_check_named=syntax only # Named constraints + ###< create table crash_q (a int ,b int, constraint abc check (a>b)) + ###> OK + ### + ###< insert into crash_q values(0,0) + ###> OK + ### + ###< drop table crash_q + ###> OK +constraint_check_table=syntax only # Table constraints + ###< create table crash_q (a int ,b int, check (a>b)) + ###> OK + ### + ###< insert into crash_q values(0,0) + ###> OK + ### + ###< drop table crash_q + ###> OK +constraint_null=yes # NULL constraint (SyBase style) + ###< create table crash_q (a int null) + ###> OK + ###< drop table crash_q + ###> OK + ### + ###As far as all queries returned OK, result is YES +crash_me_safe=yes # crash me safe +crash_me_version=1.61 # crash me version +create_default=yes # default value for column + ###< create table crash_q (q integer default 10 not null) + ###> OK + ###< drop table crash_q + ###> OK + ### + ###As far as all queries returned OK, result is YES +create_default_func=no # default value function for column + ###< create table crash_q (q integer not null,q1 integer default (1+1)) + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(1+1))' at line 1 + ###< drop table crash_q + ###> execute error:Unknown table 'crash_q' + ### + ###As far as some queries didnt return OK, result is NO +create_if_not_exists=yes # create table if not exists + ###< create table crash_q (q integer) + ###> OK + ###< create table if not exists crash_q (q integer) + ###> OK + ### + ###As far as all queries returned OK, result is YES +create_index=yes # create index + ###< create index crash_q on crash_me (a) + ###> OK +create_schema=no # Create SCHEMA + ###< create schema crash_schema create table crash_q (a int) create table crash_q2(b int) + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'schema crash_schema create table crash_q (a int) create table c + ###< drop schema crash_schema cascade + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'schema crash_schema cascade' at line 1 + ### + ###As far as some queries didnt return OK, result is NO +create_table_select=yes # create table from select + ###< create table crash_q SELECT * from crash_me + ###> OK +cross_join=yes # cross join (same as from a,b) + ###< select crash_me.a from crash_me cross join crash_me3 + ###> OK + ### + ###As far as all queries returned OK, result is YES +date_as_string=yes # String functions on date columns + ###< create table crash_me2 (a date not null) + ###> OK + ###< insert into crash_me2 values ('1998-03-03') + ###> OK + ### + ###0000-00-00 + ###We expected '1963-08-16' but got '0000-00-00' + ### + ###< delete from crash_me_d + ###> OK +date_format_EUR_with_date=error # Supports DATE 'DD.MM.YYYY' (EUR) format + ###< insert into crash_me_d(a) values (DATE '16.08.1963') + ###> OK + ### + ###1963-08-16 + ### + ###< delete from crash_me_d + ###> OK +date_format_ISO_with_date=yes # Supports DATE 'YYYY-MM-DD' (ISO) format + ###< insert into crash_me_d(a) values (DATE '1963-08-16') + ###> OK + ### + ###0000-00-00 + ###We expected '1963-08-16' but got '0000-00-00' + ### + ###< delete from crash_me_d + ###> OK +date_format_USA_with_date=error # Supports DATE 'MM/DD/YYYY' format + ###< insert into crash_me_d(a) values (DATE '08/16/1963') + ###> OK + ### + ###1963-08-16 + ### + ###< delete from crash_me_d + ###> OK +date_format_YYYYMMDD_with_date=yes # Supports DATE 'YYYYMMDD' format + ###< insert into crash_me_d(a) values (DATE '19630816') + ###> OK + ### + ###0000-00-00 + ###We expected 'infinity' but got '0000-00-00' + ### + ###< drop table crash_me2 + ###> OK +date_last=yes # Supports 9999-12-31 dates + ###< create table crash_me2 (a date not null) + ###> OK + ###< insert into crash_me2 values ('9999-12-31') + ###> OK + ### + ###0001-01-01 + ### + ###< drop table crash_me2 + ###> OK +date_with_YY=yes # Supports YY-MM-DD 2000 compilant dates + ###< create table crash_me2 (a date not null) + ###> OK + ###< insert into crash_me2 values ('98-03-03') + ###> OK + ### + ###2010-03-03 + ### + ###< drop table crash_me2 + ###> OK +date_zero=yes # Supports 0000-00-00 dates + ###< create table crash_me2 (a date not null) + ###> OK + ###< insert into crash_me2 values ('0000-00-00') + ###> OK + ### + ###Walker's +drop_if_exists=yes # drop table if exists + ###< create table crash_q (q integer) + ###> OK + ###< drop table if exists crash_q + ###> OK + ### + ###As far as all queries returned OK, result is YES +drop_index=with 'ON' # drop index + ###< drop index crash_q + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 + ### + ###< drop index crash_q from crash_me + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'from crash_me' at line 1 + ### + ###< drop index crash_q on crash_me + ###> OK +drop_requires_cascade=no # drop table require cascade/restrict + ###< create table crash_me (a integer not null) + ###> OK + ###< drop table crash_me + ###> OK +drop_restrict=yes # drop table with cascade/restrict + ###< create table crash_q (a int) + ###> OK + ###< drop table crash_q restrict + ###> OK + ### + ###As far as all queries returned OK, result is YES +end_colon=yes # allows end ';' + ###< select * from crash_me; + ###> OK + ### + ###As far as all queries returned OK, result is YES +except=no # except + ###< select * from crash_me except select * from crash_me3 + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'select * from crash_me3' at line 1 + ### + ###As far as some queries didnt return OK, result is NO +except_all=no # except all + ###< select * from crash_me except all select * from crash_me3 + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'all select * from crash_me3' at line 1 + ### + ###As far as some queries didnt return OK, result is NO +except_all_incompat=no # except all (incompatible lists) + ###< select * from crash_me except all select * from crash_me2 + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'all select * from crash_me2' at line 1 + ### + ###As far as some queries didnt return OK, result is NO +except_incompat=no # except (incompatible lists) + ###< select * from crash_me except select * from crash_me2 + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'select * from crash_me2' at line 1 + ### + ###As far as some queries didnt return OK, result is NO +field_name_case=yes # case independent field names + ###< create table crash_q (q integer) + ###> OK + ###< insert into crash_q(Q) values (1) + ###> OK + ###< drop table crash_q + ###> OK + ### + ###As far as all queries returned OK, result is YES +float_int_expr=yes # mixing of integer and float in expression + ###< select 1+1.0 + ###> OK + ### + ###As far as all queries returned OK, result is YES +foreign_key=syntax only # foreign keys + ###< create table crash_me_qf (a integer not null,primary key (a)) + ###> OK + ### + ###< create table crash_me_qf2 (a integer not null,foreign key (a) references crash_me_qf (a)) + ###> OK + ### + ###< insert into crash_me_qf values (1) + ###> OK + ### + ###< insert into crash_me_qf2 values (2) + ###> OK + ### + ###< drop table crash_me_qf2 + ###> OK + ### + ###< drop table crash_me_qf + ###> OK +full_outer_join=no # full outer join + ###< select crash_me.a from crash_me full join crash_me2 ON + ### crash_me.a=crash_me2.a + ###> execute error:Unknown table 'crash_me' in field list + ### + ###As far as some queries didnt return OK, result is NO +func_extra_!=yes # Function NOT as '!' in SELECT + ### + ###3 +func_extra_&=yes # Function & (bitwise and) + ### + ###1 +func_extra_<>=yes # Function <> in SELECT + ### + ###1 +func_extra_add_months=no # Function ADD_MONTHS + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '3) from crash_me_d' at line 1 +func_extra_addtime=no # Function ADDTIME + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '('Aâ',2)' at line 1 +func_extra_and_or=yes # Function AND and OR in SELECT + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(65)' at line 1 +func_extra_ascii_code=no # Function ASCII_CODE + ### + ###97 + ###We expected 'a' but got '97' +func_extra_atn2=no # Function ATN2 + ### + ###a2 +func_extra_auto_string2num=yes # Function automatic string->num convert + ### + ###1 +func_extra_binary_shifts=yes # Function << and >> (bitwise shifts) + ### + ###2 +func_extra_ceil=yes # Function CEIL + ### + ### execute failed:Unknown column 'EUR' in 'field list' +func_extra_charindex=no # Function CHARINDEX + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(65)' at line 1 +func_extra_chr_str=no # Function CHR (any type to string) + ### + ###0 + ###We expected 'abcdef' but got '0' +func_extra_concat_list=yes # Function CONCAT(list) + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '5)' at line 1 +func_extra_cosh=no # Function COSH + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '('1963-08-16') from crash_me_d' at line 1 +func_extra_date_format=yes # Function DATE_FORMAT + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(day,3,'1997-11-30') from crash_me_d' at line 1 +func_extra_datediff=no # Function DATEDIFF + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '('2002-12-04','2002-12-01') from crash_me_d' at line 1 +func_extra_datename=no # Function DATENAME + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(month,'July 20 1997') from crash_me_d' at line 1 +func_extra_day=no # Function DAY + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '1,'S-103',2,'Leopard',3)' at line 1 +func_extra_ebcdic_string=no # Function EBCDIC in string cast + ### + ###TWO +func_extra_encrypt=yes # Function ENCRYPT + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '('abcd',6)' at line 1 +func_extra_field=yes # Function FIELD + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(222.6666,10,2)' at line 1 +func_extra_float=no # Function FLOAT + ### + ###1,234.56 +func_extra_from_days=yes # Function FROM_DAYS + ### + ###1970-01-01 02:00:00 +func_extra_getdate=no # Function GETDATE + ### + ###HARRY +func_extra_hex=yes # Function HEX + ### + ###6 +func_extra_in_num=yes # Function IN on numbers in SELECT + ### + ###1 +func_extra_index=no # Function INDEX + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '('the soap')' at line 1 +func_extra_instr=yes # Function LOCATE as INSTR + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '3,2)' at line 1 +func_extra_instrb=no # Function INSTRB + ### + ###5 +func_extra_last_day=no # Function LAST_DAY + ### + ###0 +func_extra_least=yes # Function LEAST + ### + ###1 + ###We expected '2' but got '1' +func_extra_lengthb=no # Function LENGTHB + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '('abcd','.',6)' at line 1 +func_extra_like=yes # Function LIKE in SELECT + ### + ###1 +func_extra_ln=yes # Function LN + ### + ###2.000000 +func_extra_logn=no # Function LOGN + ### + ###??hi +func_extra_ltrim2arg=no # Function LTRIM (2 arg) + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(1963,228) from crash_me_d' at line 1 +func_extra_maketime=no # Function MAKETIME + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '('Aâ')' at line 1 +func_extra_mdy=no # Function MDY + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '('19630816200212111111')' at line 1 +func_extra_mid=yes # Function SUBSTRING as MID + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '('1997-02-02','1997-01-01') from crash_me_d' at line 1 +func_extra_noround=no # Function NOROUND + ###< select noround(22.6) + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(22.6)' at line 1 +func_extra_not=yes # Function NOT in SELECT + ### + ###0 +func_extra_not_like=yes # Function NOT LIKE in SELECT + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '('2123')' at line 1 +func_extra_odbc_convert=no # Function ODBC CONVERT + ### + ###70de51425df9d787 +func_extra_paste=no # Function PASTE + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '('%a%','crash')' at line 1 +func_extra_period_add=yes # Function PERIOD_ADD + ### + ###13 +func_extra_pow=yes # Function POW + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(a)' at line 1 +func_extra_regexp=yes # Function REGEXP in SELECT + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 +func_extra_replicate=no # Function REPLICATE + ### + ###dcba +func_extra_rfill3arg=no # Function RFILL (3 arg) + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(4)' at line 1 +func_extra_round1=yes # Function ROUND(1 arg) + ### + ###hi?? +func_extra_rpad4arg=no # Function RPAD (4 arg) + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ''.')' at line 1 +func_extra_sec_to_time=yes # Function SEC_TO_TIME + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(1)' at line 1 +func_extra_str=no # Function STR + ### + ###-1 +func_extra_stuff=no # Function STUFF + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '3) from crash_me_d' at line 1 +func_extra_substr2arg=no # Function SUBSTR (2 arg) + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '('abcd',2,2)' at line 1 +func_extra_substrb=no # Function SUBSTRB + ### + ###tcx.se +func_extra_subtime=no # Function SUBTIME + ### + ###2003-08-27 19:55:21 +func_extra_tail=no # Function TAIL + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(1)' at line 1 +func_extra_time=no # Function TIME + ### + ###5001 +func_extra_timediff=no # Function TIMEDIFF + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '('19630816','00200212')' at line 1 +func_extra_to_days=yes # Function TO_DAYS + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '('abc','bc','de')' at line 1 +func_extra_trim1arg=yes # Function TRIM (1 arg) + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ''.')' at line 1 +func_extra_trim_many_char=error # Function TRIM; Many char extension + ### + ###abc +func_extra_trunc=no # Function TRUNC + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(222.6)' at line 1 +func_extra_uid=no # Function UID + ### + ###1062003321 +func_extra_userenv=no # Function USERENV + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(NULL,'WALRUS')' at line 1 +func_extra_version=yes # Function VERSION + ### + ###5 +func_extra_weekofyear=no # Function WEEKOFYEAR + ### + ###3 +func_extra_||=yes # Function OR as '||' + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '~* 'HI'' at line 1 +func_odbc_abs=yes # Function ABS + ### + ###1.570796 +func_odbc_ascii=yes # Function ASCII + ### + ###1.570796 +func_odbc_atan=yes # Function ATAN + ### + ###1.570796 +func_odbc_ceiling=yes # Function CEILING + ### + ###A +func_odbc_concat=yes # Function CONCAT(2 arg) + ### + ###1.000000 +func_odbc_cot=yes # Function COT + ### + ###2003-08-27 +func_odbc_curtime=yes # Function CURTIME + ### + ###test +func_odbc_dayname=yes # Function DAYNAME + ###< insert into crash_me_d values('1997-02-01') + ### + ###1 +func_odbc_dayofweek=yes # Function DAYOFWEEK + ###< insert into crash_me_d values('1997-02-01') + ### + ###32 +func_odbc_degrees=yes # Function DEGREES + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '('abc','abe')' at line 1 + ### + ###2.718282 +func_odbc_floor=yes # Function FLOOR + ### + ###c +func_odbc_hour=yes # Function HOUR + ###< insert into crash_me_t values(20:08:16) + ### + ###12 +func_odbc_ifnull=yes # Function IFNULL + ### + ###aefd +func_odbc_lcase=yes # Function LCASE + ### + ###ab +func_odbc_length=yes # Function REAL LENGTH + ### + ###5 + ###We expected '4' but got '5' + ### + ###2 +func_odbc_locate_3=yes # Function LOCATE(3 arg) + ### + ###0.693147 +func_odbc_log10=yes # Function LOG10 + ### + ###abcd +func_odbc_minute=yes # Function MINUTE + ###< insert into crash_me_t values(20:08:16) + ### + ###4 +func_odbc_month=yes # Function MONTH + ###< insert into crash_me_d values('1997-02-01') + ### + ###February +func_odbc_now=yes # Function NOW + ### + ###3.141593 +func_odbc_power=yes # Function POWER + ### + ###1 +func_odbc_radians=yes # Function RADIANS + ### + ###0.40540353712198 +func_odbc_repeat=yes # Function REPEAT + ### + ###bababa +func_odbc_right=yes # Function RIGHT + ### + ###5.63 +func_odbc_rtrim=yes # Function RTRIM + ### + ###14 +func_odbc_sign=yes # Function SIGN + ### + ###0.841471 +func_odbc_soundex=yes # Function SOUNDEX + ### + ### +func_odbc_sqrt=yes # Function SQRT + ### + ###cd +func_odbc_tan=yes # Function TAN + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(SQL_TSI_SECOND,1,'1997-01-01 00:00:00')' at line 1 + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(SQL_TSI_SECOND,'1997-01-01 00:00:02', '1997-01-01 00:00:01')' + ### + ###10 +func_odbc_ucase=yes # Function UCASE + ### + ###monty@localhost +func_odbc_week=USA # WEEK + ###1997 +func_sql_+=yes # Function +, -, * and / + ### + ###24 +func_sql_cast=yes # Function CAST + ### + ###1 + ###We expected '10' but got '1' +func_sql_char_length(constant)=yes # Function CHAR_LENGTH(constant) + ### + ###4 +func_sql_coalesce=yes # Function COALESCE + ### + ###0 + ###We expected 'abcdef' but got '0' +func_sql_current_date=yes # Function CURRENT_DATE + ### + ###19:55:21 +func_sql_current_timestamp=yes # Function CURRENT_TIMESTAMP + ### + ###43 +func_sql_localtime=yes # Function LOCALTIME + ### + ###2003-08-27 19:55:21 +func_sql_lower=yes # Function LOWER + ### + ### +func_sql_nullif_string=yes # Function NULLIF with strings + ### + ###3 +func_sql_position=yes # Function POSITION + ### + ### 2 then 'false' when 2 > 1 then 'true' end + ###>true +func_sql_session_user=with_parenthesis # SESSION_USER + ###< select SESSION_USER + ###> execute error:Unknown column 'SESSION_USER' in 'field list' + ### + ###< select SESSION_USER() + ###> OK +func_sql_simple_case=yes # Function simple CASE + ### + ###bc +func_sql_system_user=with_parenthesis # SYSTEM_USER + ###< select SYSTEM_USER + ###> execute error:Unknown column 'SYSTEM_USER' in 'field list' + ### + ###< select SYSTEM_USER() + ###> OK +func_sql_trim=yes # Function TRIM + ### + ###ABC +func_sql_user=with_parenthesis # USER + ###< select USER + ###> execute error:Unknown column 'USER' in 'field list' + ### + ###< select USER() + ###> OK +func_where_between=yes # Function BETWEEN + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'all (select b from crash_me)' at line 1 +func_where_eq_any=no # Function = ANY + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(select b from crash_me)' at line 1 +func_where_exists=no # Function EXISTS + ### + ###1 +func_where_like=yes # Function LIKE + ### + ###1 +func_where_match=no # Function MATCH + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'match unique (select a from crash_me)' at line 1 +func_where_matches=no # Function MATCHES + ### + ###1 +func_where_not_exists=no # Function NOT EXISTS + ### + ###1 +func_where_not_unique=no # Function NOT UNIQUE + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'unique (select * from crash_me)' at line 1 +functions=yes # Functions + ###< select 1+1 + ###> OK + ### + ###As far as all queries returned OK, result is YES +group_by=yes # Group by + ###< select a from crash_me group by a + ###> OK + ### + ###As far as all queries returned OK, result is YES +group_by_alias=yes # Group by alias + ###< select a as ab from crash_me group by ab + ###> OK + ### + ###As far as all queries returned OK, result is YES +group_by_null=yes # Group on column with null values + ###< create table crash_q (s char(10)) + ###> OK + ###< insert into crash_q values(null) + ###> OK + ###< insert into crash_q values(null) + ###> OK + ### + ###1 +group_func_extra_bit_or=yes # Group function BIT_OR + ### + ###1 +group_func_extra_std=yes # Group function STD + ### + ###0.0000 +group_func_extra_variance=no # Group function VARIANCE + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(a),a from crash_me group by a' at line 1 +group_func_sql_avg=yes # Group function AVG + ### + ###1 +group_func_sql_count_column=yes # Group function COUNT column name + ### + ###1 +group_func_sql_every=no # Group function EVERY + ### + ###1 +group_func_sql_max_str=yes # Group function MAX on strings + ### + ###1 +group_func_sql_min_str=yes # Group function MIN on strings + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(a),a from crash_me group by a' at line 1 +group_func_sql_sum=yes # Group function SUM + ### + ### 0 + ###>1 + ### + ###a +index_in_create=yes # index in create table + ###< create table crash_q (q integer not null,index (q)) + ###> OK + ###< drop table crash_q + ###> OK + ### + ###As far as all queries returned OK, result is YES +index_namespace=yes # different namespace for index + ###< create index crash_me on crash_me (b) + ###> OK + ###< drop index crash_me on crash_me + ###> OK + ### + ###As far as all queries returned OK, result is YES +index_parts=yes # index on column part (extension) + ###< create index crash_q on crash_me (b(5)) + ###> OK + ###< drop index crash_q on crash_me + ###> OK + ### + ###As far as all queries returned OK, result is YES +inner_join=yes # inner join + ###< select crash_me.a from crash_me inner join crash_me2 ON crash_me.a=crash_me2.a + ###> OK + ### + ###As far as all queries returned OK, result is YES +insert_default_values=no # INSERT DEFAULT VALUES + ###< create table crash_me_q (a int) + ###> OK + ###< insert into crash_me_q DEFAULT VALUES + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEFAULT VALUES' at line 1 + ###< drop table crash_me_q + ###> OK + ### + ###As far as some queries didnt return OK, result is NO +insert_empty_string=yes # insert empty string + ###< create table crash_q (a char(10) not null,b char(10)) + ###> OK + ###< insert into crash_q values ('','') + ###> OK + ###< drop table crash_q + ###> OK + ### + ###As far as all queries returned OK, result is YES +insert_multi_value=yes # INSERT with Value lists + ###< create table crash_q (s char(10)) + ###> OK + ###< insert into crash_q values ('a'),('b') + ###> OK + ###< drop table crash_q + ###> OK + ### + ###As far as all queries returned OK, result is YES +insert_select=yes # insert INTO ... SELECT ... + ###< create table crash_q (a int) + ###> OK + ###< insert into crash_q (a) SELECT crash_me.a from crash_me + ###> OK + ###< drop table crash_q + ###> OK + ### + ###As far as all queries returned OK, result is YES +insert_with_default=yes # INSERT with DEFAULT + ###< create table crash_me_q (a int) + ###> OK + ###< insert into crash_me_q (a) values (DEFAULT) + ###> OK + ###< drop table crash_me_q + ###> OK + ### + ###As far as all queries returned OK, result is YES +insert_with_empty_value_list=no # INSERT with empty value list + ###< create table crash_me_q (a int) + ###> OK + ###< insert into crash_me_q (a) values () + ###> execute error:Column count doesn't match value count at row 1 + ###< drop table crash_me_q + ###> OK + ### + ###As far as some queries didnt return OK, result is NO +insert_with_set=yes # INSERT with set syntax + ###< create table crash_q (a integer) + ###> OK + ###< insert into crash_q SET a=1 + ###> OK + ###< drop table crash_q + ###> OK + ### + ###As far as all queries returned OK, result is YES +intersect=no # intersect + ###< select * from crash_me intersect select * from crash_me3 + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'select * from crash_me3' at line 1 + ### + ###As far as some queries didnt return OK, result is NO +intersect_all=no # intersect all + ###< select * from crash_me intersect all select * from crash_me3 + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'all select * from crash_me3' at line 1 + ### + ###As far as some queries didnt return OK, result is NO +intersect_all_incompat=no # intersect all (incompatible lists) + ###< select * from crash_me intersect all select * from crash_me2 + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'all select * from crash_me2' at line 1 + ### + ###As far as some queries didnt return OK, result is NO +intersect_incompat=no # intersect (incompatible lists) + ###< select * from crash_me intersect select * from crash_me2 + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'select * from crash_me2' at line 1 + ### + ###As far as some queries didnt return OK, result is NO +join_tables=31 # tables in join + ###We are trying (example with N=5): + ###select crash_me.a,t0.a,t1.a,t2.a,t3.a,t4.a from crash_me,crash_me t0,crash_me t1,crash_me t2,crash_me t3,crash_me t4 + ### 32:FAIL 7:OK 19:OK 25:OK 28:OK 30:OK 31:FAIL +left_outer_join=yes # left outer join + ###< select crash_me.a from crash_me left join crash_me2 ON crash_me.a=crash_me2.a + ###> OK + ### + ###As far as all queries returned OK, result is YES +left_outer_join_using=yes # left outer join using + ###< select c1 from crash_me left join crash_me2 using (a) + ###> OK + ### + ###As far as all queries returned OK, result is YES +length_of_varchar_field=actual length # CHARACTER_LENGTH(varchar_field) + ###< CREATE TABLE crash_me1 (S1 VARCHAR(100)) + ###> OK + ###< INSERT INTO crash_me1 VALUES ('X') + ###> OK + ### + ###< SELECT CHARACTER_LENGTH(S1) FROM crash_me1 + ### > 1 + ###< drop table crash_me1 + ###> OK +like_with_column=yes # column LIKE column + ###< create table crash_q (a char(10),b char(10)) + ###> OK + ###< insert into crash_q values('abc','abc') + ###> OK + ###< select * from crash_q where a like b + ###> OK + ###< drop table crash_q + ###> OK + ### + ###As far as all queries returned OK, result is YES +like_with_number=yes # LIKE on numbers + ###< create table crash_q (a int,b int) + ###> OK + ###< insert into crash_q values(10,10) + ###> OK + ###< select * from crash_q where a like '10' + ###> OK + ###< drop table crash_q + ###> OK + ### + ###As far as all queries returned OK, result is YES +lock_tables=yes # lock table + ###< lock table crash_me READ + ###> OK + ###< unlock tables + ###> OK + ### + ###As far as all queries returned OK, result is YES +logical_value=1 # Value of logical operation (1=1) + ###2 +multi_drop=yes # many tables to drop table + ###< create table crash_q (a int) + ###> OK + ###< create table crash_q2 (a int) + ###> OK + ###< drop table crash_q,crash_q2 + ###> OK + ### + ###As far as all queries returned OK, result is YES +multi_null_in_unique=yes # null in unique index + ###< create table crash_q (q integer, x integer,unique (q)) + ###> OK + ###< insert into crash_q(x) values(1) + ###> OK + ###< insert into crash_q(x) values(2) + ###> OK + ###< drop table crash_q + ###> OK + ### + ###As far as all queries returned OK, result is YES +multi_strings=yes # Multiple line strings + ### + ###a + ### + ###< drop table crash_q + ###> OK +natural_join=yes # natural join + ###< select * from crash_me natural join crash_me3 + ###> OK + ### + ###As far as all queries returned OK, result is YES +natural_join_incompat=yes # natural join (incompatible lists) + ###< select c1 from crash_me natural join crash_me2 + ###> OK + ### + ###As far as all queries returned OK, result is YES +natural_left_outer_join=yes # natural left outer join + ###< select c1 from crash_me natural left join crash_me2 + ###> OK + ### + ###As far as all queries returned OK, result is YES +no_primary_key=yes # Tables without primary key + ###< create table crash_me (a integer not null,b char(10) not null) + ###> OK + ###< insert into crash_me (a,b) values (1,'a') + ###> OK +not_id_between=no # NOT ID BETWEEN interprets as ID NOT BETWEEN + ###< create table crash_me_b (i int) + ###> OK + ###< insert into crash_me_b values(2) + ###> OK + ###< insert into crash_me_b values(5) + ###> OK + ### + ### +null_in_index=yes # null in index + ###< create table crash_q (a char(10),index (a)) + ###> OK + ###< insert into crash_q values (NULL) + ###> OK + ### + ### +nulls_in_unique=yes # null combination in unique index + ###< create table crash_q (q integer,q1 integer,unique (q,q1)) + ###> OK + ###< insert into crash_q (q,q1) values(1,NULL) + ###> OK + ###< insert into crash_q (q,q1) values(1,NULL) + ###> OK + ###< drop table crash_q + ###> OK + ### + ###As far as all queries returned OK, result is YES +odbc_left_outer_join=yes # left outer join odbc style + ###< select crash_me.a from { oj crash_me left outer join crash_me2 ON crash_me.a=crash_me2.a } + ###> OK + ### + ###As far as all queries returned OK, result is YES +operating_system=Linux 2.4.20-64GB-SMP i686 # crash-me tested on +order_by=yes # Order by + ###< select a from crash_me order by a + ###> OK + ### + ###As far as all queries returned OK, result is YES +order_by_alias=yes # Order by alias + ###< select a as ab from crash_me order by ab + ###> OK + ### + ###As far as all queries returned OK, result is YES +order_by_function=yes # Order by function + ###< select a from crash_me order by a+1 + ###> OK + ### + ###As far as all queries returned OK, result is YES +order_by_position=yes # Order by position + ###< select a from crash_me order by 1 + ###> OK + ### + ###As far as all queries returned OK, result is YES +order_on_unused=yes # Order by on unused column + ###< select b from crash_me order by a + ###> OK + ### + ###As far as all queries returned OK, result is YES +position_of_null=first # Where is null values in sorted recordset + ###< insert into crash_me_n (i) values(1) + ###> OK + ###< insert into crash_me_n values(2,2) + ###> OK + ###< insert into crash_me_n values(3,3) + ###> OK + ###< insert into crash_me_n values(4,4) + ###> OK + ###< insert into crash_me_n (i) values(5) + ###> OK + ### + ###< select r from crash_me_n order by r + ###> + ###> + ###> 2 + ###> 3 + ###> 4 +position_of_null_desc=last # Where is null values in sorted recordset (DESC) + ###< select r from crash_me_n order by r desc + ###> 4 + ###> 3 + ###> 2 + ###> + ###> +primary_key_in_create=yes # primary key in create table + ###< create table crash_q (q integer not null,primary key (q)) + ###> OK + ###< drop table crash_q + ###> OK + ### + ###As far as all queries returned OK, result is YES +psm_functions=no # PSM functions (ANSI SQL) + ###< create table crash_q (a int) + ###> OK + ###< create function crash_func(in a1 int, in b1 int) returns int language sql deterministic contains sql begin return a1 * b1; end + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(in a1 int, in b1 int) returns int language sql deterministic c + ###< insert into crash_q values(crash_func(2,4)) + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(2,4))' at line 1 + ###< select a,crash_func(a,2) from crash_q + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(a,2) from crash_q' at line 1 + ###< drop function crash_func cascade + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'cascade' at line 1 + ###< drop table crash_q + ###> OK + ### + ###As far as some queries didnt return OK, result is NO +psm_modules=no # PSM modules (ANSI SQL) + ###< create table crash_q (a int,b int) + ###> OK + ###< create module crash_m declare procedure crash_proc(in a1 int, in b1 int) language sql modifies sql data begin declare c1 int; set c1 = a1 + b1; insert into crash_q(a,b) values (a1,c1); end; declare procedure crash_proc2(INOUT a int, in b int) contains sql set a = b + 10; end module + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'module crash_m declare procedure crash_proc(in a1 int, in b1 in + ###< call crash_proc(1,10) + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'call crash_proc(1,10)' at line 1 + ###< drop module crash_m cascade + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'module crash_m cascade' at line 1 + ###< drop table crash_q cascade + ###> OK + ### + ###As far as some queries didnt return OK, result is NO +psm_procedures=no # PSM procedures (ANSI SQL) + ###< create table crash_q (a int,b int) + ###> OK + ###< create procedure crash_proc(in a1 int, in b1 int) language sql modifies sql data begin declare c1 int; set c1 = a1 + b1; insert into crash_q(a,b) values (a1,c1); end + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'procedure crash_proc(in a1 int, in b1 int) language sql modifie + ###< call crash_proc(1,10) + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'call crash_proc(1,10)' at line 1 + ###< drop procedure crash_proc + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'procedure crash_proc' at line 1 + ###< drop table crash_q + ###> OK + ### + ###As far as some queries didnt return OK, result is NO +psm_trigger=no # Triggers (ANSI SQL) + ###< create table crash_q (a int ,b int) + ###> OK + ###< create trigger crash_trigger after insert on crash_q referencing new table as new_a when (localtime > time '18:00:00') begin atomic end + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'trigger crash_trigger after insert on crash_q referencing new t + ###< insert into crash_q values(1,2) + ###> OK + ###< drop trigger crash_trigger + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'trigger crash_trigger' at line 1 + ###< drop table crash_q + ###> OK + ### + ###As far as some queries didnt return OK, result is NO +query_size=1048574 # query size +quote_ident_with_"=error # " as identifier quote (ANSI SQL) + ### + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '[A] from crash_me' at line 1 +quote_ident_with_`=yes # ` as identifier quote + ### + ###hello + ###We expected 'hello ' but got 'hello' + ### + ###< drop table crash_q + ###> OK +remember_end_space_varchar=no # Remembers end space in varchar() + ###< create table crash_q (a varchar(10)) + ###> OK + ###< insert into crash_q values('hello ') + ###> OK + ### + ###0 + ###We expected '1' but got '0' +select_constants=yes # Select constants + ###< select 1 + ###> OK + ### + ###As far as all queries returned OK, result is YES +select_limit=with LIMIT # LIMIT number of rows + ###< select * from crash_me limit 1 + ###> OK +select_limit2=yes # SELECT with LIMIT #,# + ###< select * from crash_me limit 1,1 + ###> OK + ### + ###As far as all queries returned OK, result is YES +select_limit3=yes # SELECT with LIMIT # OFFSET # + ###< select * from crash_me limit 1 offset 1 + ###> OK + ### + ###As far as all queries returned OK, result is YES +select_string_size=1048565 # constant string size in SELECT + ###We are trying (example with N=5): + ###select 'aaaaa' +select_table_update=no # Update with sub select + ###< create table crash_q (a integer,b char(10)) + ###> OK + ###< insert into crash_q values(1,'c') + ###> OK + ###< update crash_q set b= (select b from crash_me where crash_q.a = crash_me.a) + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'select b from crash_me where crash_q.a = crash_me.a)' at line 1 + ### + ###< drop table crash_q + ###> OK +select_without_from=yes # SELECT without FROM + ###< select 1 + ###> OK + ### + ###As far as all queries returned OK, result is YES +server_version=MySQL 4.0.15 debug log/ # server version +simple_joins=yes # ANSI SQL simple joins + ###< select crash_me.a from crash_me, crash_me t0 + ###> OK + ### + ###As far as all queries returned OK, result is YES +sorted_group_by=yes # Group by always sorted + ###< create table crash_me_t1 (a int not null, b int not null) + ###> OK + ###< insert into crash_me_t1 values (1,1) + ###> OK + ###< insert into crash_me_t1 values (1,2) + ###> OK + ###< insert into crash_me_t1 values (3,1) + ###> OK + ###< insert into crash_me_t1 values (3,2) + ###> OK + ###< insert into crash_me_t1 values (2,2) + ###> OK + ###< insert into crash_me_t1 values (2,1) + ###> OK + ###< create table crash_me_t2 (a int not null, b int not null) + ###> OK + ###< create index crash_me_t2_ind on crash_me_t2 (a) + ###> OK + ###< insert into crash_me_t2 values (1,3) + ###> OK + ###< insert into crash_me_t2 values (3,1) + ###> OK + ###< insert into crash_me_t2 values (2,2) + ###> OK + ###< insert into crash_me_t2 values (1,1) + ###> OK + ### + ###< select crash_me_t1.a,crash_me_t2.b from crash_me_t1,crash_me_t2 where crash_me_t1.a=crash_me_t2.a group by crash_me_t1.a,crash_me_t2.b + ### > 1,1 + ### > 1,3 + ### > 2,2 + ### > 3,1 + ### + ### Check recordset: + ### 1,1 expected: 1,1 + ### 1,3 expected: 1,3 + ### 2,2 expected: 2,2 + ### 3,1 expected: 3,1 + ### Recordset corresponds with template + ###< drop table crash_me_t1 + ###> OK + ###< drop table crash_me_t2 + ###> OK +storage_of_float=round # Storage of float values + ###< create table crash_q (q1 float(4,1)) + ###> OK + ###< insert into crash_q values(1.14) + ###> OK + ### + ###1.2 + ###We expected '1.1' but got '1.2' + ### + ###< drop table crash_q + ###> OK + ### + ###< create table crash_q (q1 float(4,1)) + ###> OK + ###< insert into crash_q values(1.14) + ###> OK + ### + ###1.2 + ### + ###< drop table crash_q + ###> OK +subqueries=no # subqueries + ###< select a from crash_me where crash_me.a in (select max(a) from crash_me) + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'select max(a) from crash_me)' at line 1 + ### + ###As far as some queries didnt return OK, result is NO +table_alias=yes # Table alias + ###< select b.a from crash_me as b + ###> OK + ### + ###As far as all queries returned OK, result is YES +table_name_case=no # case independent table names + ###< create table crash_q (q integer) + ###> OK + ###< drop table CRASH_Q + ###> execute error:Unknown table 'CRASH_Q' + ### + ###As far as some queries didnt return OK, result is NO +table_wildcard=yes # Select table_name.* + ###< select crash_me.* from crash_me + ###> OK + ### + ###As far as all queries returned OK, result is YES +temporary_table=yes # temporary tables + ###< create temporary table crash_q (q integer not null) + ###> OK + ###< drop table crash_q + ###> OK + ### + ###As far as all queries returned OK, result is YES +time_format_EUR=error # Supports HH.MM.SS (EUR) time format + ###< insert into crash_me_t(a) values ('20.08.16') + ###> OK + ### + ###20:08:16 + ### + ###< delete from crash_me_t + ###> OK +time_format_ISO=yes # Supports HH:MM:SS (ISO) time format + ###< insert into crash_me_t(a) values ('20:08:16') + ###> OK + ### + ###08:08:16 + ###We expected '20:08:16' but got '08:08:16' + ### + ###< delete from crash_me_t + ###> OK +time_format_inresult=iso # Time format in result + ###< insert into crash_me_t values(CURRENT_TIME) + ###> OK + ### + ###< select a from crash_me_t + ###> 19:55:21 + ###< delete from crash_me_t + ###> OK +transactions=yes # transactions + ### execute failed:Unknown column 'FALSE' in 'field list' +value_of_true=not supported # Value of TRUE + ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '('1997-01-01',1) from crash_me_d' at line 1 -func_extra_adddate=no # Function ADDDATE +func_extra_adddate=yes # Function ADDDATE ### ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '('20:02:12','00:00:03')' at line 1 + ###>20:02:15 func_extra_alpha=no # Function ALPHA ### ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '('1963-08-16') from crash_me_d' at line 1 + ###>1963-08-16 func_extra_date_format=yes # Function DATE_FORMAT ### ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '('2002-12-04','2002-12-01') from crash_me_d' at line 1 + ###>3 func_extra_datename=no # Function DATENAME ### ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '('2002-12-01') from crash_me_d' at line 1 + ###>1 func_extra_decode=no # Function DECODE ### ###5 -func_extra_last_day=no # Function LAST_DAY +func_extra_last_day=yes # Function LAST_DAY ### ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ''.')' at line 1 -func_extra_makedate=no # Function MAKEDATE +func_extra_makedate=yes # Function MAKEDATE ### ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(20,02,12)' at line 1 + ###>20:02:12 func_extra_mapchar=no # Function MAPCHAR ### ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '('19630816200212111111')' at line 1 + ###>110000 func_extra_mid=yes # Function SUBSTRING as MID ### ###1 func_extra_not_between=yes # Function NOT BETWEEN in SELECT ### @@ -879,7 +879,7 @@ func_extra_odbc_convert=no # Function ODBC CONVERT func_extra_password=yes # Function PASSWORD ### ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '('abc',2,3,'xyz')' at line 1 -func_extra_subdate=no # Function SUBDATE +func_extra_subdate=yes # Function SUBDATE ### ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '('abcd',2)' at line 1 -func_extra_substr3arg=no # Function SUBSTR (3 arg) + ###>bcd +func_extra_substr3arg=yes # Function SUBSTR (3 arg) ### ###tcx.se -func_extra_subtime=no # Function SUBTIME +func_extra_subtime=yes # Function SUBTIME ### ###2003-08-27 19:55:21 + ###>2004-04-06 13:49:05 func_extra_tail=no # Function TAIL ### ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '('20:02:12')' at line 1 + ###>20:02:12 func_extra_time_to_sec=yes # Function TIME_TO_SEC ### ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '('20:02:15','20:02:12')' at line 1 -func_extra_timestamp=no # Function TIMESTAMP + ###>00:00:03 +func_extra_timestamp=error # Function TIMESTAMP ### ###1062003321 + ###>1081248545 func_extra_userenv=no # Function USERENV ### ###5 -func_extra_weekofyear=no # Function WEEKOFYEAR +func_extra_weekofyear=yes # Function WEEKOFYEAR ### ###2003-08-27 + ###>2004-04-06 func_odbc_curtime=yes # Function CURTIME ### ###2003-08-27 19:55:21 + ###>2004-04-06 13:49:04 func_odbc_pi=yes # Function PI ### ###19:55:21 + ###>13:49:04 func_sql_current_timestamp=yes # Function CURRENT_TIMESTAMP ### ###2003-08-27 19:55:21 + ###>2004-04-06 13:49:04 func_sql_localtimestamp=yes # Function LOCALTIMESTAMP ### ###1 -func_where_eq_all=no # Function = ALL +func_where_eq_all=yes # Function = ALL ### ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(select b from crash_me)' at line 1 -func_where_eq_some=no # Function = SOME + ###>1 +func_where_eq_some=yes # Function = SOME ### ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'exists (select * from crash_me)' at line 1 + ###>1 func_where_in_num=yes # Function IN on numbers ### ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'exists (select * from crash_me where a = 2)' at line 1 + ###>1 func_where_not_like=yes # Function NOT LIKE ### ### execute failed:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(a),a from crash_me group by a' at line 1 + ###>0.0000 group_func_sql_any=no # Group function ANY ### ### 0 ###>1 @@ -1832,10 +1830,10 @@ intersect_incompat=no # intersect (incompatible lists) ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'select * from crash_me2' at line 1 ### ###As far as some queries didnt return OK, result is NO -join_tables=31 # tables in join +join_tables=61 # tables in join ###We are trying (example with N=5): ###select crash_me.a,t0.a,t1.a,t2.a,t3.a,t4.a from crash_me,crash_me t0,crash_me t1,crash_me t2,crash_me t3,crash_me t4 - ### 32:FAIL 7:OK 19:OK 25:OK 28:OK 30:OK 31:FAIL + ### 32:OK 48:OK 56:OK 60:OK 62:FAIL 61:FAIL left_outer_join=yes # left outer join ###< select crash_me.a from crash_me left join crash_me2 ON crash_me.a=crash_me2.a ###> OK @@ -1890,39 +1888,39 @@ logical_value=1 # Value of logical operation (1=1) ###>1 max_big_expressions=10 # big expressions ###We are trying (example with N=5): - ###select 0+(1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+...(14308) + ###select 0+(1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+...(8168) ### 50:FAIL 10:OK 30:FAIL 14:FAIL 11:FAIL -max_char_size=255 # max char() size +max_char_size=1048543 # max char() size ###We are trying (example with N=5): ###create table crash_q (q char(5)) ###insert into crash_q values ('aaaaa') ###select * from crash_q - ### 524287:FAIL 104858:FAIL 20972:FAIL 4195:FAIL 839:FAIL 168:OK 503:FAIL 235:OK 369:FAIL 262:FAIL 241:OK 251:OK 256:FAIL 252:OK 254:OK 255:OK + ### 524287:OK 786431:OK 917503:OK 983039:OK 1015807:OK 1032191:OK 1040383:OK 1044479:OK 1046527:OK 1047551:OK 1048063:OK 1048319:OK 1048447:OK 1048511:OK 1048543:OK 1048559:FAIL 1048546:FAIL 1048544:FAIL max_column_name=64 # column name length ###We are trying (example with N=5): ###create table crash_q (qaaaaa integer) ###insert into crash_q (qaaaaa) values(1) ###select qaaaaa from crash_q ### 256:FAIL 51:OK 153:FAIL 72:FAIL 55:OK 63:OK 67:FAIL 64:FAIL -max_columns=3398 # Columns in table +max_columns=2599 # Columns in table ###We are trying (example with N=5): ###create table crash_q (a integer ,a0 integer,a1 integer,a2 integer,a3 integer,a4 integer) - ### 4096:FAIL 819:OK 2457:OK 3276:OK 3686:FAIL 3358:OK 3522:FAIL 3391:OK 3456:FAIL 3404:FAIL 3394:OK 3399:FAIL 3395:OK 3397:OK 3398:FAIL + ### 4096:FAIL 819:OK 2457:OK 3276:FAIL 2621:FAIL 2490:OK 2555:OK 2588:OK 2604:FAIL 2591:OK 2597:OK 2600:FAIL 2598:OK 2599:FAIL max_conditions=85660 # OR and AND in WHERE ###We are trying (example with N=5): ###select a from crash_me where a=1 and b='a' or a=0 and b='0' or a=1 and b='1' or a=2 and b='2' or a=3 and b='3' or a=4 and b='4' ### 27592:OK 41389:OK 48287:FAIL 42769:OK 45528:FAIL 43321:FAIL 42880:FAIL 42791:OK 42835:FAIL 42800:OK 42817:OK 42826:OK 42830:OK 42832:FAIL 42831:FAIL -max_expressions=1450 # simple expressions +max_expressions=836 # simple expressions ###We are trying (example with N=5): ###select 1+1+1+1+1+1 - ### 5000:FAIL 1000:OK 3000:FAIL 1400:OK 2200:FAIL 1560:FAIL 1432:OK 1496:FAIL 1445:OK 1470:FAIL 1450:OK 1460:FAIL 1452:FAIL 1451:FAIL + ### 5000:FAIL 1000:FAIL 200:OK 600:OK 800:OK 900:FAIL 820:OK 860:FAIL 828:OK 844:FAIL 831:OK 837:FAIL 832:OK 834:OK 835:OK 836:OK max_index=32 # max index ### max_unique_index=32 ,so max_index must be same -max_index_length=500 # index length +max_index_length=1000 # index length ###We are trying (example with N=5): ###create table crash_q (q0 char(5) not null,unique (q0)) ###insert into crash_q values('aaaaa') - ### 4096:FAIL 819:FAIL 164:OK 491:OK 655:FAIL 524:FAIL 498:OK 511:FAIL 501:FAIL 499:OK 500:OK + ### 4096:FAIL 819:OK 2457:FAIL 1147:FAIL 885:OK 1016:FAIL 911:OK 963:OK 989:OK 1002:FAIL 992:OK 997:OK 999:OK 1000:OK 1001:FAIL max_index_name=64 # index name length ###We are trying (example with N=5): ###create index crash_qaaaaa on crash_me (a) @@ -1932,6 +1930,7 @@ max_index_part_length=255 # max index part length ###create table crash_q (q char(5) not null,unique(q)) ###insert into crash_q (q) values ('aaaaa') ###select q from crash_q + ### 524271:FAIL 104854:FAIL 20971:FAIL 4194:FAIL 839:FAIL 168:OK 503:FAIL 235:OK 369:FAIL 262:FAIL 241:OK 251:OK 256:FAIL 252:OK 254:OK 255:OK max_index_parts=16 # index parts ###We are trying (example with N=5): ###create table crash_q (q0 integer not null,q1 integer not null,q2 integer not null,q3 integer not null,q4 integer not nul...(1263) @@ -1943,11 +1942,12 @@ max_index_varchar_part_length=255 # index varchar part length ###create table crash_q (q varchar(5) not null,unique(q)) ###insert into crash_q (q) values ('aaaaa') ###select q from crash_q + ### 524271:FAIL 104854:FAIL 20971:FAIL 4194:FAIL 839:FAIL 168:OK 503:FAIL 235:OK 369:FAIL 262:FAIL 241:OK 251:OK 256:FAIL 252:OK 254:OK 255:OK max_row_length=65534 # max table row length (without blobs) ###We are trying (example with N=5): ###create table crash_q (q0 char(5) not null) ###insert into crash_q values ('aaaaa') - ### 433245:FAIL 86649:FAIL 17330:OK 51989:OK 69319:FAIL 55455:OK 62387:OK 65853:FAIL 63080:OK 64466:OK 65159:OK 65506:OK 65679:FAIL 65541:FAIL 65513:OK 65527:OK 65534:OK 65537:FAIL 65535:FAIL + ### 331372:FAIL 66275:FAIL 13255:OK 39765:OK 53020:OK 59647:OK 62961:OK 64618:OK 65446:OK 65860:FAIL 65529:OK 65694:FAIL 65562:FAIL 65536:FAIL 65531:OK 65533:OK 65534:OK 65535:FAIL max_row_length_with_null=65502 # table row length with nulls (without blobs) ###We are trying (example with N=5): ###create table crash_q (q0 char(5) ) @@ -1956,10 +1956,10 @@ max_row_length_with_null=65502 # table row length with nulls (without blobs) max_select_alias_name=+512 # select alias name length ###We are trying (example with N=5): ###select b as aaaaa from crash_me -max_stack_expression=1450 # stacked expressions +max_stack_expression=836 # stacked expressions ###We are trying (example with N=5): ###select 1+(1+(1+(1+(1+(1))))) - ### 1000:OK 1500:FAIL 1100:OK 1300:OK 1400:OK 1450:OK 1475:FAIL 1455:FAIL 1451:FAIL + ### 1000:FAIL 200:OK 600:OK 800:OK 900:FAIL 820:OK 860:FAIL 828:OK 844:FAIL 831:OK 837:FAIL 832:OK 834:OK 835:OK 836:OK max_table_alias_name=+512 # table alias name length ###We are trying (example with N=5): ###select aaaaa.b from crash_me aaaaa @@ -1981,12 +1981,12 @@ max_unique_index=32 # unique indexes ###insert into crash_q (q,q1,q2,q3,q4,q5) values (1,1,1,1,1,1) ###select q from crash_q ### 32:OK 48:FAIL 35:FAIL 33:FAIL -max_varchar_size=255 # max varchar() size +max_varchar_size=1048543 # max varchar() size ###We are trying (example with N=5): ###create table crash_q (q varchar(5)) ###insert into crash_q values ('aaaaa') ###select * from crash_q - ### 524287:FAIL 104858:FAIL 20972:FAIL 4195:FAIL 839:FAIL 168:OK 503:FAIL 235:OK 369:FAIL 262:FAIL 241:OK 251:OK 256:FAIL 252:OK 254:OK 255:OK + ### 524287:OK 786431:OK 917503:OK 983039:OK 1015807:OK 1032191:OK 1040383:OK 1044479:OK 1046527:OK 1047551:OK 1048063:OK 1048319:OK 1048447:OK 1048511:OK 1048543:OK 1048559:FAIL 1048546:FAIL 1048544:FAIL minus=no # minus ###< select * from crash_me minus select * from crash_me3 ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'select * from crash_me3' at line 1 @@ -2129,7 +2129,7 @@ odbc_left_outer_join=yes # left outer join odbc style ###> OK ### ###As far as all queries returned OK, result is YES -operating_system=Linux 2.4.20-64GB-SMP i686 # crash-me tested on +operating_system=Linux 2.4.21-199-smp4G i686 # crash-me tested on order_by=yes # Order by ###< select a from crash_me order by a ###> OK @@ -2267,6 +2267,9 @@ quote_with_"=yes # Allows ' and " as string markers ###> OK ### ###As far as all queries returned OK, result is YES +recursive_subqueries=+64 # recursive subqueries + ###We are trying (example with N=5): + ###select a from crash_me where a in (select a from crash_me where a in (select a from crash_me where a in (select a from c...(82) remember_end_space=no # Remembers end space in char() ###< create table crash_q (a char(10)) ###> OK @@ -2300,10 +2303,10 @@ rename_table=yes # rename table ###> OK ### ###As far as all queries returned OK, result is YES -repeat_string_size=1047552 # return string size from function +repeat_string_size=1048576 # return string size from function ###We are trying (example with N=5): ###select repeat('a',5) - ### 4000000:FAIL 800000:OK 2400000:FAIL 1120000:FAIL 864000:OK 992000:OK 1056000:FAIL 1004800:OK 1030400:OK 1043200:OK 1049600:FAIL 1044480:OK 1047040:OK 1048320:FAIL 1047296:OK 1047808:FAIL 1047399:OK 1047603:FAIL 1047440:OK 1047521:OK 1047562:FAIL 1047529:OK 1047545:OK 1047553:FAIL 1047547:OK 1047550:OK 1047551:OK 1047552:OK + ### 4000000:FAIL 800000:OK 2400000:FAIL 1120000:FAIL 864000:OK 992000:OK 1056000:FAIL 1004800:OK 1030400:OK 1043200:OK 1049600:FAIL 1044480:OK 1047040:OK 1048320:OK 1048960:FAIL 1048448:OK 1048704:FAIL 1048499:OK 1048601:FAIL 1048520:OK 1048560:OK 1048580:FAIL 1048564:OK 1048572:OK 1048576:OK 1048578:FAIL 1048577:FAIL reserved_word_ansi-92/99_absolute=no # Keyword ABSOLUTE ###< create table crash_me10 (ABSOLUTE int not null) ###> OK @@ -2416,13 +2419,13 @@ reserved_word_ansi-92/99_authorization=no # Keyword AUTHORIZATION ###> OK ### ###As far as all queries returned OK, result is NO -reserved_word_ansi-92/99_before=no # Keyword BEFORE +reserved_word_ansi-92/99_before=yes # Keyword BEFORE ###< create table crash_me10 (BEFORE int not null) - ###> OK + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'BEFORE int not null)' at line 1 ###< drop table crash_me10 - ###> OK + ###> execute error:Unknown table 'crash_me10' ### - ###As far as all queries returned OK, result is NO + ###As far as some queries didnt return OK, result is YES reserved_word_ansi-92/99_begin=no # Keyword BEGIN ###< create table crash_me10 (BEGIN int not null) ###> OK @@ -2535,13 +2538,13 @@ reserved_word_ansi-92/99_close=no # Keyword CLOSE ###> OK ### ###As far as all queries returned OK, result is NO -reserved_word_ansi-92/99_collate=no # Keyword COLLATE +reserved_word_ansi-92/99_collate=yes # Keyword COLLATE ###< create table crash_me10 (COLLATE int not null) - ###> OK + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'COLLATE int not null)' at line 1 ###< drop table crash_me10 - ###> OK + ###> execute error:Unknown table 'crash_me10' ### - ###As far as all queries returned OK, result is NO + ###As far as some queries didnt return OK, result is YES reserved_word_ansi-92/99_collation=no # Keyword COLLATION ###< create table crash_me10 (COLLATION int not null) ###> OK @@ -2913,13 +2916,13 @@ reserved_word_ansi-92/99_external=no # Keyword EXTERNAL ###> OK ### ###As far as all queries returned OK, result is NO -reserved_word_ansi-92/99_false=no # Keyword FALSE +reserved_word_ansi-92/99_false=yes # Keyword FALSE ###< create table crash_me10 (FALSE int not null) - ###> OK + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'FALSE int not null)' at line 1 ###< drop table crash_me10 - ###> OK + ###> execute error:Unknown table 'crash_me10' ### - ###As far as all queries returned OK, result is NO + ###As far as some queries didnt return OK, result is YES reserved_word_ansi-92/99_fetch=no # Keyword FETCH ###< create table crash_me10 (FETCH int not null) ###> OK @@ -3223,7 +3226,7 @@ reserved_word_ansi-92/99_level=no # Keyword LEVEL ###As far as all queries returned OK, result is NO reserved_word_ansi-92/99_like=yes # Keyword LIKE ###< create table crash_me10 (LIKE int not null) - ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIKE int not null)' at line 1 + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'int not null)' at line 1 ###< drop table crash_me10 ###> execute error:Unknown table 'crash_me10' ### @@ -3466,13 +3469,13 @@ reserved_word_ansi-92/99_parameters=no # Keyword PARAMETERS ###> OK ### ###As far as all queries returned OK, result is NO -reserved_word_ansi-92/99_partial=yes # Keyword PARTIAL +reserved_word_ansi-92/99_partial=no # Keyword PARTIAL ###< create table crash_me10 (PARTIAL int not null) - ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'PARTIAL int not null)' at line 1 + ###> OK ###< drop table crash_me10 - ###> execute error:Unknown table 'crash_me10' + ###> OK ### - ###As far as some queries didnt return OK, result is YES + ###As far as all queries returned OK, result is NO reserved_word_ansi-92/99_precision=yes # Keyword PRECISION ###< create table crash_me10 (PRECISION int not null) ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'PRECISION int not null)' at line 1 @@ -3900,13 +3903,13 @@ reserved_word_ansi-92/99_trigger=no # Keyword TRIGGER ###> OK ### ###As far as all queries returned OK, result is NO -reserved_word_ansi-92/99_true=no # Keyword TRUE +reserved_word_ansi-92/99_true=yes # Keyword TRUE ###< create table crash_me10 (TRUE int not null) - ###> OK + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'TRUE int not null)' at line 1 ###< drop table crash_me10 - ###> OK + ###> execute error:Unknown table 'crash_me10' ### - ###As far as all queries returned OK, result is NO + ###As far as some queries didnt return OK, result is YES reserved_word_ansi-92/99_under=no # Keyword UNDER ###< create table crash_me10 (UNDER int not null) ###> OK @@ -4124,13 +4127,13 @@ reserved_word_ansi92_coalesce=no # Keyword COALESCE ###> OK ### ###As far as all queries returned OK, result is NO -reserved_word_ansi92_convert=no # Keyword CONVERT +reserved_word_ansi92_convert=yes # Keyword CONVERT ###< create table crash_me10 (CONVERT int not null) - ###> OK + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'CONVERT int not null)' at line 1 ###< drop table crash_me10 - ###> OK + ###> execute error:Unknown table 'crash_me10' ### - ###As far as all queries returned OK, result is NO + ###As far as some queries didnt return OK, result is YES reserved_word_ansi92_count=no # Keyword COUNT ###< create table crash_me10 (COUNT int not null) ###> OK @@ -5321,13 +5324,13 @@ reserved_word_extra_low_priority=yes # Keyword LOW_PRIORITY ###> execute error:Unknown table 'crash_me10' ### ###As far as some queries didnt return OK, result is YES -reserved_word_extra_master_server_id=yes # Keyword MASTER_SERVER_ID +reserved_word_extra_master_server_id=no # Keyword MASTER_SERVER_ID ###< create table crash_me10 (MASTER_SERVER_ID int not null) - ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'MASTER_SERVER_ID int not null)' at line 1 + ###> OK ###< drop table crash_me10 - ###> execute error:Unknown table 'crash_me10' + ###> OK ### - ###As far as some queries didnt return OK, result is YES + ###As far as all queries returned OK, result is NO reserved_word_extra_maxextents=no # Keyword MAXEXTENTS ###< create table crash_me10 (MAXEXTENTS int not null) ###> OK @@ -5720,13 +5723,13 @@ reserved_word_extra_soname=yes # Keyword SONAME ###> execute error:Unknown table 'crash_me10' ### ###As far as some queries didnt return OK, result is YES -reserved_word_extra_spatial=no # Keyword SPATIAL +reserved_word_extra_spatial=yes # Keyword SPATIAL ###< create table crash_me10 (SPATIAL int not null) - ###> OK + ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'int not null)' at line 1 ###< drop table crash_me10 - ###> OK + ###> execute error:Unknown table 'crash_me10' ### - ###As far as all queries returned OK, result is NO + ###As far as some queries didnt return OK, result is YES reserved_word_extra_sql_big_result=yes # Keyword SQL_BIG_RESULT ###< create table crash_me10 (SQL_BIG_RESULT int not null) ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'SQL_BIG_RESULT int not null)' at line 1 @@ -6038,13 +6041,16 @@ select_limit3=yes # SELECT with LIMIT # OFFSET # select_string_size=1048565 # constant string size in SELECT ###We are trying (example with N=5): ###select 'aaaaa' -select_table_update=no # Update with sub select +select_table_update=yes # Update with sub select ###< create table crash_q (a integer,b char(10)) ###> OK ###< insert into crash_q values(1,'c') ###> OK ###< update crash_q set b= (select b from crash_me where crash_q.a = crash_me.a) - ###> execute error:You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'select b from crash_me where crash_q.a = crash_me.a)' at line 1 + ###> OK + ### + ### execute failed:Unknown column 'FALSE' in 'field list' -value_of_true=not supported # Value of TRUE + ###>0 +value_of_true=1 # Value of TRUE ###