Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1

into sanja.is.com.ua:/home/bell/mysql/bk/work-ps3-4.1
This commit is contained in:
bell@sanja.is.com.ua 2004-04-07 15:23:05 +03:00
commit 61fd95d168
66 changed files with 8274 additions and 673 deletions

View File

@ -52,6 +52,7 @@ hf@genie.(none)
igor@hundin.mysql.fi igor@hundin.mysql.fi
igor@rurik.mysql.com igor@rurik.mysql.com
ingo@mysql.com ingo@mysql.com
jani@a80-186-24-72.elisa-laajakaista.fi
jani@dsl-jkl1657.dial.inet.fi jani@dsl-jkl1657.dial.inet.fi
jani@dsl-kpogw4gb5.dial.inet.fi jani@dsl-kpogw4gb5.dial.inet.fi
jani@hynda.(none) jani@hynda.(none)

View File

@ -425,8 +425,9 @@ int main(int argc,char *argv[])
} }
#endif #endif
sprintf(buff, "%s", sprintf(buff, "%s",
#ifndef NOT_YET
"Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.\n"); "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"); "Type 'help [[%]function name[%]]' to get help on usage of function.\n");
#endif #endif
put_info(buff,INFO_INFO); put_info(buff,INFO_INFO);

View File

@ -2358,7 +2358,7 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
if (display_metadata) 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 ; for (field= mysql_fetch_fields(res), field_end= field+num_fields ;
field < field_end ; field < field_end ;
field++) field++)
@ -2394,6 +2394,9 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
dynstr_append_mem(ds, "\t", 1); dynstr_append_mem(ds, "\t", 1);
int10_to_str((int) field->decimals, buff, 10); int10_to_str((int) field->decimals, buff, 10);
dynstr_append(ds, buff); 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); dynstr_append_mem(ds, "\n", 1);
} }
} }

View File

@ -1120,10 +1120,10 @@ typedef union {
*((T)+1)=(((A) >> 16));\ *((T)+1)=(((A) >> 16));\
*((T)+0)=(((A) >> 24)); } *((T)+0)=(((A) >> 24)); }
#define doubleget(V,M) memcpy((byte*) &V,(byte*) (M),sizeof(double)) #define doubleget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(double))
#define doublestore(T,V) memcpy((byte*) (T),(byte*) &V,sizeof(double)) #define doublestore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(double))
#define longlongget(V,M) memcpy((byte*) &V,(byte*) (M),sizeof(ulonglong)) #define longlongget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(ulonglong))
#define longlongstore(T,V) memcpy((byte*) (T),(byte*) &V,sizeof(ulonglong)) #define longlongstore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(ulonglong))
#else #else

View File

@ -119,7 +119,7 @@ enum enum_server_command
#define CLIENT_SECURE_CONNECTION 32768 /* New 4.1 authentication */ #define CLIENT_SECURE_CONNECTION 32768 /* New 4.1 authentication */
#define CLIENT_MULTI_STATEMENTS 65536 /* Enable/disable multi-stmt support */ #define CLIENT_MULTI_STATEMENTS 65536 /* Enable/disable multi-stmt support */
#define CLIENT_MULTI_RESULTS 131072 /* Enable/disable multi-results */ #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_IN_TRANS 1 /* Transaction has started */
#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */ #define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */

View File

@ -88,9 +88,9 @@ libmysqld.a: libmysqld_int.a $(INC_LIB)
cd tmp ; \ cd tmp ; \
for file in *.a ; do \ for file in *.a ; do \
bfile=`basename $$file .a` ; \ bfile=`basename $$file .a` ; \
ar x $$file; \ $(AR) x $$file; \
for obj in *.o ; do mv $$obj $${bfile}_$$obj ; done ; \ 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 ; \ rm -f *.o ; \
done done
mv libmysqld_int2.a libmysqld.a mv libmysqld_int2.a libmysqld.a

View File

@ -428,7 +428,6 @@ int emb_load_querycache_result(THD *thd, Querycache_stream *src)
*prev_row= row; *prev_row= row;
row->data= columns; row->data= columns;
MYSQL_ROW col_end= columns + mysql->field_count; MYSQL_ROW col_end= columns + mysql->field_count;
uint len;
for (; columns < col_end; columns++) for (; columns < col_end; columns++)
src->load_column(&data->alloc, columns); src->load_column(&data->alloc, columns);

View File

@ -332,10 +332,10 @@ char ** copy_arguments_ptr= 0;
int init_embedded_server(int argc, char **argv, char **groups) 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
/* This mess is to allow people to call the init function without having to mess with a fake argv
* having to mess with a fake argv */ */
int *argcp; int *argcp;
char ***argvp; char ***argvp;
int fake_argc = 1; int fake_argc = 1;

View File

@ -286,6 +286,21 @@ void mi_copy_status(void* to,void *from)
((MI_INFO*) to)->state= &((MI_INFO*) from)->save_state; ((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) my_bool mi_check_status(void* param)
{ {
MI_INFO *info=(MI_INFO*) param; MI_INFO *info=(MI_INFO*) param;

View File

@ -57,47 +57,45 @@ int mi_rnext(MI_INFO *info, byte *buf, int inx)
} }
else else
{ {
switch(info->s->keyinfo[inx].key_alg) switch (info->s->keyinfo[inx].key_alg) {
{ case HA_KEY_ALG_RTREE:
case HA_KEY_ALG_RTREE:
/* /*
Note that rtree doesn't support that the table Note that rtree doesn't support that the table
may be changed since last call, so we do need may be changed since last call, so we do need
to skip rows inserted by other threads like in btree to skip rows inserted by other threads like in btree
*/ */
error=rtree_get_next(info,inx,info->lastkey_length); error= rtree_get_next(info,inx,info->lastkey_length);
break; break;
case HA_KEY_ALG_BTREE: case HA_KEY_ALG_BTREE:
default: default:
if (!changed) if (!changed)
{ error= _mi_search_next(info,info->s->keyinfo+inx,info->lastkey,
error=_mi_search_next(info,info->s->keyinfo+inx,info->lastkey, info->lastkey_length,flag,
info->lastkey_length,flag, info->s->state.key_root[inx]);
info->s->state.key_root[inx]); else
} error= _mi_search(info,info->s->keyinfo+inx,info->lastkey,
else USE_WHOLE_KEY,flag, info->s->state.key_root[inx]);
{
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;
}
}
} }
} }
if (info->s->concurrent_insert) 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]); rw_unlock(&info->s->key_root_lock[inx]);
}
/* Don't clear if database-changed */ /* Don't clear if database-changed */
info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
info->update|= HA_STATE_NEXT_FOUND; info->update|= HA_STATE_NEXT_FOUND;

View File

@ -52,21 +52,22 @@ int mi_rprev(MI_INFO *info, byte *buf, int inx)
error=_mi_search(info,share->keyinfo+inx,info->lastkey, error=_mi_search(info,share->keyinfo+inx,info->lastkey,
USE_WHOLE_KEY, flag, share->state.key_root[inx]); 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 (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]); rw_unlock(&share->key_root_lock[inx]);
}
info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
info->update|= HA_STATE_PREV_FOUND; info->update|= HA_STATE_PREV_FOUND;
if (error) if (error)

View File

@ -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_PRINT("enter",("cache_size: %lu", cache_size));
DBUG_ASSERT(!info->bulk_insert && 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++) for (i=total_keylength=num_keys=0 ; i < share->base.keys ; i++)
{ {

View File

@ -1,4 +0,0 @@
-- require r/have_debug.require
disable_query_log;
select instr(version(),convert('debug' using utf8))!=0;
enable_query_log;

View File

@ -59,11 +59,16 @@ grp group_concat(d order by a desc)
1 a 1 a
2 b,a 2 b,a
3 c,d,d,b,b,a 3 c,d,d,b,b,a
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;
grp group_concat(a order by a,d+c) grp group_concat(a order by a,d+c-ascii(c)-a)
1 1 1 1
2 2,3 2 2,3
3 4,5,6,7,8,9 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; select grp,group_concat(c order by 1) from t1 group by grp;
grp group_concat(c order by 1) grp group_concat(c order by 1)
1 a 1 a
@ -136,17 +141,7 @@ grp ROUND(group_concat(a separator ""))
3 456789 3 456789
drop table t1; drop table t1;
create table t1 (grp int, c char(10)); create table t1 (grp int, c char(10));
insert into t1 values (1,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);
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);
select grp,group_concat(c order by c) from t1 group by grp; select grp,group_concat(c order by c) from t1 group by grp;
grp group_concat(c order by c) grp group_concat(c order by c)
1 NULL 1 NULL
@ -207,9 +202,21 @@ NULL
drop table t1; drop table t1;
drop table t2; drop table t2;
create table t1 (bar varchar(32)); create table t1 (bar varchar(32));
insert into t1 values('test'),('test2'); insert into t1 values('test1'),('test2');
select * from t1 having group_concat(bar)=''; 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 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; drop table t1;
create table t1 (a int, a1 varchar(10)); create table t1 (a int, a1 varchar(10));
create table t2 (a0 int); create table t2 (a0 int);
@ -222,3 +229,75 @@ select group_concat(a1 order by (t1.a)) from t1;
group_concat(a1 order by (t1.a)) group_concat(a1 order by (t1.a))
b,a,c b,a,c
drop table t1, t2; 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;
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;

View File

@ -5,6 +5,9 @@ grant all privileges on `my\_%`.* to mysqltest_1@localhost with grant option;
select current_user(); select current_user();
current_user() current_user()
mysqltest_1@localhost 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\_1`.* to mysqltest_2@localhost with grant option;
grant all privileges on `my_%`.* to mysqltest_3@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_%' ERROR 42000: Access denied for user: 'mysqltest_1'@'localhost' to database 'my_%'

View File

@ -2,6 +2,12 @@ drop table if exists test.t1,mysqltest.t1,mysqltest.t2;
drop database if exists mysqltest; drop database if exists mysqltest;
reset query cache; reset query cache;
flush status; 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 database if not exists mysqltest;
create table mysqltest.t1 (a int,b int,c int); create table mysqltest.t1 (a int,b int,c int);
create table mysqltest.t2 (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 mysqltest.t1 to mysqltest_2@localhost;
grant SELECT on test.t1 to mysqltest_2@localhost; grant SELECT on test.t1 to mysqltest_2@localhost;
grant SELECT(a) on mysqltest.t1 to mysqltest_3@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"; show status like "Qcache_queries_in_cache";
Variable_name Value Variable_name Value
Qcache_queries_in_cache 6 Qcache_queries_in_cache 6
@ -101,6 +111,9 @@ Qcache_hits 3
show status like "Qcache_not_cached"; show status like "Qcache_not_cached";
Variable_name Value Variable_name Value
Qcache_not_cached 1 Qcache_not_cached 1
show grants for current_user();
Grants for @localhost
GRANT USAGE ON *.* TO ''@'localhost'
select "user2"; select "user2";
user2 user2
user2 user2
@ -158,6 +171,10 @@ Qcache_not_cached 7
select "user4"; select "user4";
user4 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; select a from t1;
ERROR 3D000: No Database Selected ERROR 3D000: No Database Selected
select * from mysqltest.t1,test.t1; select * from mysqltest.t1,test.t1;

View File

@ -1,2 +0,0 @@
instr(version(),convert('debug' using utf8))!=0;
1

View File

@ -13,7 +13,7 @@ SHOW CREATE TABLE T1;
Table Create Table Table Create Table
T1 CREATE TABLE `T1` ( T1 CREATE TABLE `T1` (
`a` int(11) default NULL `a` int(11) default NULL
) TYPE=MyISAM ) ENGINE=MyISAM DEFAULT CHARSET=latin1
RENAME TABLE T1 TO T2; RENAME TABLE T1 TO T2;
SHOW TABLES LIKE "T2"; SHOW TABLES LIKE "T2";
Tables_in_test (T2) Tables_in_test (T2)
@ -68,7 +68,7 @@ SHOW CREATE TABLE T1;
Table Create Table Table Create Table
T1 CREATE TABLE `T1` ( T1 CREATE TABLE `T1` (
`a` int(11) default NULL `a` int(11) default NULL
) TYPE=InnoDB ) ENGINE=InnoDB DEFAULT CHARSET=latin
RENAME TABLE T1 TO T2; RENAME TABLE T1 TO T2;
SHOW TABLES LIKE "T2"; SHOW TABLES LIKE "T2";
Tables_in_test (T2) Tables_in_test (T2)

View File

@ -1,36 +1,36 @@
drop table if exists t1,t2; drop table if exists t1,t2;
select 1, 1.0, -1, "hello", NULL; select 1, 1.0, -1, "hello", NULL;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals 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 def 1 8 1 1 N 32769 0 8
def 1.0 5 3 3 N 32769 1 def 1.0 5 3 3 N 32769 1 8
def -1 8 1 2 N 32769 0 def -1 8 1 2 N 32769 0 8
def hello 254 5 5 N 1 31 def hello 254 5 5 N 1 31 8
def NULL 6 0 0 Y 32768 0 def NULL 6 0 0 Y 32768 0 8
1 1.0 -1 hello NULL 1 1.0 -1 hello NULL
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)); 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; select * from t1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals 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 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 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 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 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 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 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 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 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 def test t1 t1 i i 13 4 0 Y 32864 0 63
def test t1 t1 j j 10 10 0 Y 0 0 def test t1 t1 j j 10 10 0 Y 128 0 63
def test t1 t1 k k 7 19 0 N 1089 0 def test t1 t1 k k 7 19 0 N 1217 0 63
def test t1 t1 l l 12 19 0 Y 0 0 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 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 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 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 a b c d e f g h i j k l m n o
select a b, b c from t1 as t2; 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 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 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 def test t1 t2 b c 2 6 0 Y 32768 0 63
b c b c
drop table t1; drop table t1;
CREATE TABLE t1 (id tinyint(3) default NULL, data varchar(255) default NULL); 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'); CREATE TABLE t2 (id tinyint(3) unsigned default NULL, data char(3) default '0');
INSERT INTO t2 VALUES (1,'yes'),(2,'no'); INSERT INTO t2 VALUES (1,'yes'),(2,'no');
select t1.id, t1.data, t2.data from t1, t2 where t1.id = t2.id; 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 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 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 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 def test t2 t2 data data 254 3 3 Y 0 0 8
id data data id data data
1 male yes 1 male yes
2 female no 2 female no
select t1.id, t1.data, t2.data from t1, t2 where t1.id = t2.id order by t1.id; 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 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 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 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 def test t2 t2 data data 254 3 3 Y 0 0 8
id data data id data data
1 male yes 1 male yes
2 female no 2 female no
select t1.id from t1 union select t2.id from t2; 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 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 def test t1 t1 id id 1 3 1 Y 32768 0 63
id id
1 1
2 2

View File

@ -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 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 t3 HEAP Fixed 0 9 # # # 9 NULL NULL NULL NULL latin1_swedish_ci NULL
drop table t1, t2, t3; 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;

View File

@ -1,23 +1,162 @@
CREATE TABLE t1 (a int); CREATE TABLE t1 (x1 int);
CREATE TABLE t2 LIKE t1; ALTER TABLE t1 CHANGE x1 x2 int;
ALTER TABLE t1 add key(a); CREATE TABLE t2 LIKE t1;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`a` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2; DROP TABLE t2;
CREATE TABLE t1 (a int); ALTER TABLE t1 CHANGE x2 x1 int;
CREATE TABLE t2 LIKE t1; 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)
-----------
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`b` int(11) default NULL `xx` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) 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;

View File

@ -693,7 +693,7 @@ testc
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`dt` char(19) default NULL `dt` binary(19) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
create table t1 SELECT dt from t2 UNION select sv from t2; create table t1 SELECT dt from t2 UNION select sv from t2;
@ -704,7 +704,7 @@ testv
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`dt` char(19) default NULL `dt` binary(19) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
create table t1 SELECT sc from t2 UNION select sv from t2; create table t1 SELECT sc from t2 UNION select sv from t2;
@ -726,7 +726,7 @@ tetetetetest
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`dt` longblob `dt` blob
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
create table t1 SELECT sv from t2 UNION select b from t2; create table t1 SELECT sv from t2 UNION select b from t2;

View File

@ -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(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) from t1 group by grp;
select grp,group_concat(d order by a desc) 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 1) from t1 group by grp;
select grp,group_concat(c order by "c") 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; select grp,group_concat(distinct c order by c) from t1 group by grp;
@ -50,22 +51,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 from t1 group by grp;
select grp, group_concat(a separator "")+0.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; select grp, ROUND(group_concat(a separator "")) from t1 group by grp;
drop table t1;
# Test NULL values # Test NULL values
drop table t1;
create table t1 (grp int, c char(10)); create table t1 (grp int, c char(10));
insert into t1 values (1,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);
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);
select grp,group_concat(c order by c) from t1 group by grp; select grp,group_concat(c order by c) from t1 group by grp;
# Test warnings # Test warnings
@ -118,8 +109,12 @@ drop table t2;
# check having # check having
create table t1 (bar varchar(32)); create table t1 (bar varchar(32));
insert into t1 values('test'),('test2'); insert into t1 values('test1'),('test2');
select * from t1 having group_concat(bar)=''; 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; drop table t1;
# ORDER BY fix_fields() # ORDER BY fix_fields()
@ -130,3 +125,57 @@ 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 IN (select a0 from t2))) from t1;
select group_concat(a1 order by (t1.a)) from t1; select group_concat(a1 order by (t1.a)) from t1;
drop table t1, t2; 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,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
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;

View File

@ -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; select max(t1.a2),max(t2.a1) from t1 left outer join t2 on t1.a1=10;
drop table t1,t2; drop table t1,t2;
# #
# Tests to check MIN/MAX query optimization # Tests to check MIN/MAX query optimization
# #

View File

@ -15,6 +15,7 @@ grant all privileges on `my\_%`.* to mysqltest_1@localhost with grant option;
connect (user1,localhost,mysqltest_1,,); connect (user1,localhost,mysqltest_1,,);
connection user1; connection user1;
select current_user(); select current_user();
select current_user;
grant all privileges on `my\_1`.* to mysqltest_2@localhost with grant option; grant all privileges on `my\_1`.* to mysqltest_2@localhost with grant option;
--error 1044 --error 1044
grant all privileges on `my_%`.* to mysqltest_3@localhost with grant option; grant all privileges on `my_%`.* to mysqltest_3@localhost with grant option;

View File

@ -12,6 +12,8 @@ reset query cache;
flush status; flush status;
connect (root,localhost,root,,test,$MASTER_MYPORT,master.sock); connect (root,localhost,root,,test,$MASTER_MYPORT,master.sock);
connection root; connection root;
show grants for current_user;
show grants;
--disable_warnings --disable_warnings
create database if not exists mysqltest; create database if not exists mysqltest;
--enable_warnings --enable_warnings
@ -43,6 +45,7 @@ grant SELECT(a) on mysqltest.t1 to mysqltest_3@localhost;
# The following queries should be fetched from cache # The following queries should be fetched from cache
connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,master.sock); connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,master.sock);
connection user1; connection user1;
show grants for current_user();
show status like "Qcache_queries_in_cache"; show status like "Qcache_queries_in_cache";
show status like "Qcache_hits"; show status like "Qcache_hits";
show status like "Qcache_not_cached"; 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_hits";
show status like "Qcache_not_cached"; 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 # The following queries should be fetched from cache
connect (user2,localhost,mysqltest_2,,mysqltest,$MASTER_MYPORT,master.sock); connect (user2,localhost,mysqltest_2,,mysqltest,$MASTER_MYPORT,master.sock);
connection user2; connection user2;
@ -104,6 +111,7 @@ show status like "Qcache_not_cached";
connect (user4,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,master.sock); connect (user4,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,master.sock);
connection user4; connection user4;
select "user4"; select "user4";
show grants;
--error 1046 --error 1046
select a from t1; select a from t1;
# The following query is not cached before (different database) # The following query is not cached before (different database)

View File

@ -256,3 +256,51 @@ delete from t3 where a=5;
show table status; show table status;
drop table t1, t2, t3; 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;

View File

@ -1 +0,0 @@
--exit-info=2048

View File

@ -1,45 +1,33 @@
-- source include/have_crypt.inc
# #
# Test for Bug #2385 CREATE TABLE LIKE lacks locking on source and destination table # Test for Bug #2385 CREATE TABLE LIKE lacks locking on source and destination table
# #
connect (con_to_sleep,localhost,lock_controller,,); connect (con1,localhost,root,,);
connect (con_to_harm_sleeper,localhost,root,,); connect (con2,localhost,root,,);
# locking of source: # locking of source:
connection con_to_sleep;
CREATE TABLE t1 (a int);
send CREATE TABLE t2 LIKE t1;
connection con_to_harm_sleeper; CREATE TABLE t1 (x1 int);
sleep 1; let $1= 10;
ALTER TABLE t1 add key(a); while ($1)
{
connection con_to_sleep; connection con1;
sleep 4; send ALTER TABLE t1 CHANGE x1 x2 int;
SHOW CREATE TABLE t2; connection con2;
drop table t1, t2; CREATE TABLE t2 LIKE t1;
replace_result x1 xx x2 xx;
# locking of destination: SHOW CREATE TABLE t2;
connection con_to_sleep; DROP TABLE t2;
CREATE TABLE t1 (a int); connection con1;
send CREATE TABLE t2 LIKE t1; reap;
send ALTER TABLE t1 CHANGE x2 x1 int;
connection con_to_harm_sleeper; connection con2;
sleep 1; CREATE TABLE t2 LIKE t1;
CREATE TABLE t2 (b int); replace_result x1 xx x2 xx;
disable_query_log; SHOW CREATE TABLE t2;
select "-----------" as "let's take a look at result of create .. like : "; DROP TABLE t2;
enable_query_log; connection con1;
reap;
connection con_to_sleep; dec $1;
sleep 1; }
--error 1 DROP TABLE t1;
reap;
disable_query_log;
select "" as "-----------";
enable_query_log;
SHOW CREATE TABLE t2;
drop table t1, t2;

View File

@ -4,12 +4,12 @@ use Getopt::Long;
use POSIX qw(strftime); use POSIX qw(strftime);
$|=1; $|=1;
$VER="2.5"; $VER="2.6";
$opt_config_file = undef(); $opt_config_file = undef();
$opt_example = 0; $opt_example = 0;
$opt_help = 0; $opt_help = 0;
$opt_log = "/tmp/mysqld_multi.log"; $opt_log = "";
$opt_mysqladmin = "@bindir@/mysqladmin"; $opt_mysqladmin = "@bindir@/mysqladmin";
$opt_mysqld = "@libexecdir@/mysqld"; $opt_mysqld = "@libexecdir@/mysqld";
$opt_no_log = 0; $opt_no_log = 0;
@ -18,6 +18,9 @@ $opt_tcp_ip = 0;
$opt_user = "root"; $opt_user = "root";
$opt_version = 0; $opt_version = 0;
my $my_print_defaults_exists= 1;
my $logdir= undef();
my ($mysqld, $mysqladmin, $groupids, $homedir, $my_progname); my ($mysqld, $mysqladmin, $groupids, $homedir, $my_progname);
$homedir = $ENV{HOME}; $homedir = $ENV{HOME};
@ -42,7 +45,9 @@ sub main
print "Please make sure you have this command available and\n"; print "Please make sure you have this command available and\n";
print "in your path. The command is available from the latest\n"; print "in your path. The command is available from the latest\n";
print "MySQL distribution.\n"; print "MySQL distribution.\n";
$my_print_defaults_exists= 0;
} }
init_log();
my @defops = `my_print_defaults mysqld_multi`; my @defops = `my_print_defaults mysqld_multi`;
chop @defops; chop @defops;
splice @ARGV, 0, 0, @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 #### Report living and not running MySQL servers
#### ####

File diff suppressed because it is too large Load Diff

View File

@ -82,7 +82,7 @@ alter_drop_unique=with drop key # Alter table drop unique
###< alter table crash_q drop constraint u1 restrict ###< 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 ###> 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 ###< alter table crash_q drop key u1
###> OK ###> OK
alter_modify_col=yes # Alter table modify column alter_modify_col=yes # Alter table modify column
###< alter table crash_q modify c1 CHAR(20) ###< alter table crash_q modify c1 CHAR(20)
@ -345,7 +345,7 @@ date_format_inresult=iso # Date format in result
###> OK ###> OK
### ###
###< select a from crash_me_d ###< select a from crash_me_d
###> 2003-08-27 ###> 2004-04-06
###< delete from crash_me_d ###< delete from crash_me_d
###> OK ###> OK
date_infinity=error # Supports 'infinity dates date_infinity=error # Supports 'infinity dates
@ -558,14 +558,14 @@ func_extra_add_months=no # Function ADD_MONTHS
### ###
###<select add_months('1997-01-01',1) from crash_me_d ###<select add_months('1997-01-01',1) from crash_me_d
###> 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 ###> 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
### ###
###<select ADDDATE('2002-12-01',3) from crash_me_d ###<select ADDDATE('2002-12-01',3) from crash_me_d
###> 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 ###>2002-12-04
func_extra_addtime=no # Function ADDTIME func_extra_addtime=yes # Function ADDTIME
### ###
###<select ADDTIME('20:02:12','00:00:03') ###<select ADDTIME('20:02:12','00:00:03')
###> 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 func_extra_alpha=no # Function ALPHA
### ###
###<select alpha('Aâ',2) ###<select alpha('Aâ',2)
@ -648,10 +648,10 @@ func_extra_cosh=no # Function COSH
### ###
###<select cosh(0) ###<select cosh(0)
###> 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 '(0)' 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 '(0)' at line 1
func_extra_date=no # Function DATE func_extra_date=yes # Function DATE
### ###
###<select date('1963-08-16') from crash_me_d ###<select date('1963-08-16') from crash_me_d
###> 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 func_extra_date_format=yes # Function DATE_FORMAT
### ###
###<select date_format('1997-01-02 03:04:05','M W D Y y m d h i s w') from crash_me_d ###<select date_format('1997-01-02 03:04:05','M W D Y y m d h i s w') from crash_me_d
@ -663,11 +663,11 @@ func_extra_dateadd=no # Function DATEADD
func_extra_datediff=no # Function DATEDIFF func_extra_datediff=no # Function DATEDIFF
### ###
###<select datediff(month,'Oct 21 1997','Nov 30 1997') from crash_me_d ###<select datediff(month,'Oct 21 1997','Nov 30 1997') from crash_me_d
###> 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,'Oct 21 1997','Nov 30 1997') from crash_me_d' 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 ''Nov 30 1997') from crash_me_d' at line 1
func_extra_datediff2arg=no # Function DATEDIFF (2 arg) func_extra_datediff2arg=yes # Function DATEDIFF (2 arg)
### ###
###<select DATEDIFF('2002-12-04','2002-12-01') from crash_me_d ###<select DATEDIFF('2002-12-04','2002-12-01') from crash_me_d
###> 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 func_extra_datename=no # Function DATENAME
### ###
###<select datename(month,'Nov 30 1997') from crash_me_d ###<select datename(month,'Nov 30 1997') from crash_me_d
@ -676,10 +676,10 @@ func_extra_datepart=no # Function DATEPART
### ###
###<select datepart(month,'July 20 1997') from crash_me_d ###<select datepart(month,'July 20 1997') from crash_me_d
###> 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 ###> 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 func_extra_day=yes # Function DAY
### ###
###<select DAY('2002-12-01') from crash_me_d ###<select DAY('2002-12-01') from crash_me_d
###> 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 func_extra_decode=no # Function DECODE
### ###
###<select DECODE('S-103','T72',1,'S-103',2,'Leopard',3) ###<select DECODE('S-103','T72',1,'S-103',2,'Leopard',3)
@ -695,7 +695,7 @@ func_extra_elt=yes # Function ELT
func_extra_encrypt=yes # Function ENCRYPT func_extra_encrypt=yes # Function ENCRYPT
### ###
###<select encrypt('hello') ###<select encrypt('hello')
###>tHrzZO8Aq1FG6 ###>VNeu3dE4DbVJY
func_extra_expand2arg=no # Function EXPAND func_extra_expand2arg=no # Function EXPAND
### ###
###<select expand('abcd',6) ###<select expand('abcd',6)
@ -772,10 +772,10 @@ func_extra_interval=yes # Function INTERVAL
### ###
###<select interval(55,10,20,30,40,50,60,70,80,90,100) ###<select interval(55,10,20,30,40,50,60,70,80,90,100)
###>5 ###>5
func_extra_last_day=no # Function LAST_DAY func_extra_last_day=yes # Function LAST_DAY
### ###
###<select last_day('1997-04-01') from crash_me_d ###<select last_day('1997-04-01') from crash_me_d
###> 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-04-01') from crash_me_d' at line 1 ###>1997-04-30
func_extra_last_insert_id=yes # Function LAST_INSERT_ID func_extra_last_insert_id=yes # Function LAST_INSERT_ID
### ###
###<select last_insert_id() ###<select last_insert_id()
@ -825,14 +825,14 @@ func_extra_ltrim2arg=no # Function LTRIM (2 arg)
### ###
###<select ltrim('..abcd..','.') ###<select ltrim('..abcd..','.')
###> 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 ###> 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
### ###
###<select MAKEDATE(1963,228) from crash_me_d ###<select MAKEDATE(1963,228) from crash_me_d
###> 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 ###>1963-08-16
func_extra_maketime=no # Function MAKETIME func_extra_maketime=yes # Function MAKETIME
### ###
###<select MAKETIME(20,02,12) ###<select MAKETIME(20,02,12)
###> 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 func_extra_mapchar=no # Function MAPCHAR
### ###
###<select mapchar('Aâ') ###<select mapchar('Aâ')
@ -841,10 +841,10 @@ func_extra_mdy=no # Function MDY
### ###
###<select mdy(7,1,1998) from crash_me_d ###<select mdy(7,1,1998) from crash_me_d
###> 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 '(7,1,1998) from crash_me_d' 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 '(7,1,1998) from crash_me_d' at line 1
func_extra_microsecond=no # Function MICROSECOND func_extra_microsecond=yes # Function MICROSECOND
### ###
###<select MICROSECOND('19630816200212111111') ###<select MICROSECOND('19630816200212111111')
###> 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 func_extra_mid=yes # Function SUBSTRING as MID
### ###
###<select mid('hello',3,2) ###<select mid('hello',3,2)
@ -858,7 +858,7 @@ func_extra_noround=no # Function NOROUND
###> 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 ###> 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 func_extra_not=yes # Function NOT in SELECT
### ###
###<select not 0 ###<select not false
###>1 ###>1
func_extra_not_between=yes # Function NOT BETWEEN in SELECT 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 func_extra_password=yes # Function PASSWORD
### ###
###<select password('hello') ###<select password('hello')
###>70de51425df9d787 ###>*6B4F89A54E2D27ECD7E8DA05B4AB8FD9D1D8B119
func_extra_paste=no # Function PASTE func_extra_paste=no # Function PASTE
### ###
###<select paste('ABCDEFG',3,2,'1234') ###<select paste('ABCDEFG',3,2,'1234')
@ -964,18 +964,18 @@ func_extra_stuff=no # Function STUFF
### ###
###<select stuff('abc',2,3,'xyz') ###<select stuff('abc',2,3,'xyz')
###> 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 ###> 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
### ###
###<select SUBDATE('2002-12-04',3) from crash_me_d ###<select SUBDATE('2002-12-04',3) from crash_me_d
###> 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 ###>2002-12-01
func_extra_substr2arg=no # Function SUBSTR (2 arg) func_extra_substr2arg=yes # Function SUBSTR (2 arg)
### ###
###<select substr('abcd',2) ###<select substr('abcd',2)
###> 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 ###>bcd
func_extra_substr3arg=no # Function SUBSTR (3 arg) func_extra_substr3arg=yes # Function SUBSTR (3 arg)
### ###
###<select substr('abcd',2,2) ###<select substr('abcd',2,2)
###> 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 ###>bc
func_extra_substrb=no # Function SUBSTRB func_extra_substrb=no # Function SUBSTRB
### ###
###<select SUBSTRB('ABCDEFG',5,4.2) ###<select SUBSTRB('ABCDEFG',5,4.2)
@ -984,14 +984,14 @@ func_extra_substring_index=yes # Function SUBSTRING_INDEX
### ###
###<select substring_index('www.tcx.se','.',-2) ###<select substring_index('www.tcx.se','.',-2)
###>tcx.se ###>tcx.se
func_extra_subtime=no # Function SUBTIME func_extra_subtime=yes # Function SUBTIME
### ###
###<select SUBTIME('20:02:15','00:00:03') ###<select SUBTIME('20:02:15','00:00:03')
###> 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','00:00:03')' at line 1 ###>20:02:12
func_extra_sysdate=yes # Function SYSDATE func_extra_sysdate=yes # Function SYSDATE
### ###
###<select sysdate() ###<select sysdate()
###>2003-08-27 19:55:21 ###>2004-04-06 13:49:05
func_extra_tail=no # Function TAIL func_extra_tail=no # Function TAIL
### ###
###<select tail('ABCDEFG',3) ###<select tail('ABCDEFG',3)
@ -1000,22 +1000,23 @@ func_extra_tanh=no # Function TANH
### ###
###<select tanh(1) ###<select tanh(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 '(1)' 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 '(1)' at line 1
func_extra_time=no # Function TIME func_extra_time=yes # Function TIME
### ###
###<select time('20:02:12') ###<select time('20:02:12')
###> 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 func_extra_time_to_sec=yes # Function TIME_TO_SEC
### ###
###<select time_to_sec('01:23:21') ###<select time_to_sec('01:23:21')
###>5001 ###>5001
func_extra_timediff=no # Function TIMEDIFF func_extra_timediff=yes # Function TIMEDIFF
### ###
###<select TIMEDIFF('20:02:15','20:02:12') ###<select TIMEDIFF('20:02:15','20:02:12')
###> 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 ###>00:00:03
func_extra_timestamp=no # Function TIMESTAMP func_extra_timestamp=error # Function TIMESTAMP
### ###
###<select timestamp('19630816','00200212') ###<select timestamp('19630816','00200212')
###> 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 ###>1963-08-16 20:02:12
###We expected '19630816200212000000' but got '1963-08-16 20:02:12'
func_extra_to_days=yes # Function TO_DAYS func_extra_to_days=yes # Function TO_DAYS
### ###
###<select to_days('1996-01-01') from crash_me_d ###<select to_days('1996-01-01') from crash_me_d
@ -1056,7 +1057,7 @@ func_extra_uid=no # Function UID
func_extra_unix_timestamp=yes # Function UNIX_TIMESTAMP func_extra_unix_timestamp=yes # Function UNIX_TIMESTAMP
### ###
###<select unix_timestamp() ###<select unix_timestamp()
###>1062003321 ###>1081248545
func_extra_userenv=no # Function USERENV func_extra_userenv=no # Function USERENV
### ###
###<select userenv ###<select userenv
@ -1068,15 +1069,15 @@ func_extra_value=no # Function VALUE
func_extra_version=yes # Function VERSION func_extra_version=yes # Function VERSION
### ###
###<select version() ###<select version()
###>4.0.15-debug-log ###>4.1.2-alpha
func_extra_weekday=yes # Function WEEKDAY func_extra_weekday=yes # Function WEEKDAY
### ###
###<select weekday('1997-11-29') from crash_me_d ###<select weekday('1997-11-29') from crash_me_d
###>5 ###>5
func_extra_weekofyear=no # Function WEEKOFYEAR func_extra_weekofyear=yes # Function WEEKOFYEAR
### ###
###<select WEEKOFYEAR('1963-08-16') from crash_me_d ###<select WEEKOFYEAR('1963-08-16') from crash_me_d
###> 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 ###>33
func_extra_|=yes # Function | (bitwise or) func_extra_|=yes # Function | (bitwise or)
### ###
###<select 1 | 2 ###<select 1 | 2
@ -1136,11 +1137,11 @@ func_odbc_cot=yes # Function COT
func_odbc_curdate=yes # Function CURDATE func_odbc_curdate=yes # Function CURDATE
### ###
###<select curdate() ###<select curdate()
###>2003-08-27 ###>2004-04-06
func_odbc_curtime=yes # Function CURTIME func_odbc_curtime=yes # Function CURTIME
### ###
###<select curtime() ###<select curtime()
###>19:55:21 ###>13:49:04
func_odbc_database=yes # Function DATABASE func_odbc_database=yes # Function DATABASE
### ###
###<select database() ###<select database()
@ -1269,7 +1270,7 @@ func_odbc_monthname=yes # Function MONTHNAME
func_odbc_now=yes # Function NOW func_odbc_now=yes # Function NOW
### ###
###<select now() ###<select now()
###>2003-08-27 19:55:21 ###>2004-04-06 13:49:04
func_odbc_pi=yes # Function PI func_odbc_pi=yes # Function PI
### ###
###<select pi() ###<select pi()
@ -1416,20 +1417,17 @@ func_sql_concat_as_||=error # Function concatenation with ||
func_sql_current_date=yes # Function CURRENT_DATE func_sql_current_date=yes # Function CURRENT_DATE
### ###
###<select current_date ###<select current_date
###>2003-08-27 ###>2004-04-06
func_sql_current_time=yes # Function CURRENT_TIME func_sql_current_time=yes # Function CURRENT_TIME
### ###
###<select current_time ###<select current_time
###>19:55:21 ###>13:49:04
func_sql_current_timestamp=yes # Function CURRENT_TIMESTAMP func_sql_current_timestamp=yes # Function CURRENT_TIMESTAMP
### ###
###<select current_timestamp ###<select current_timestamp
###>2003-08-27 19:55:21 ###>2004-04-06 13:49:04
func_sql_current_user=with_parenthesis # CURRENT_USER func_sql_current_user=yes # CURRENT_USER
###< select CURRENT_USER ###< select CURRENT_USER
###> execute error:Unknown column 'CURRENT_USER' in 'field list'
###
###< select CURRENT_USER()
###> OK ###> OK
func_sql_extract_sql=yes # Function EXTRACT func_sql_extract_sql=yes # Function EXTRACT
### ###
@ -1438,11 +1436,11 @@ func_sql_extract_sql=yes # Function EXTRACT
func_sql_localtime=yes # Function LOCALTIME func_sql_localtime=yes # Function LOCALTIME
### ###
###<select localtime ###<select localtime
###>2003-08-27 19:55:21 ###>2004-04-06 13:49:04
func_sql_localtimestamp=yes # Function LOCALTIMESTAMP func_sql_localtimestamp=yes # Function LOCALTIMESTAMP
### ###
###<select localtimestamp ###<select localtimestamp
###>2003-08-27 19:55:21 ###>2004-04-06 13:49:04
func_sql_lower=yes # Function LOWER func_sql_lower=yes # Function LOWER
### ###
###<select LOWER('ABC') ###<select LOWER('ABC')
@ -1505,22 +1503,22 @@ func_where_between=yes # Function BETWEEN
### ###
###<select a from crash_me where 5 between 4 and 6 ###<select a from crash_me where 5 between 4 and 6
###>1 ###>1
func_where_eq_all=no # Function = ALL func_where_eq_all=yes # Function = ALL
### ###
###<select a from crash_me where b =all (select b from crash_me) ###<select a from crash_me where b =all (select b from crash_me)
###> 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 ###>1
func_where_eq_any=no # Function = ANY func_where_eq_any=yes # Function = ANY
### ###
###<select a from crash_me where b =any (select b from crash_me) ###<select a from crash_me where b =any (select b from crash_me)
###> 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 ###>1
func_where_eq_some=no # Function = SOME func_where_eq_some=yes # Function = SOME
### ###
###<select a from crash_me where b =some (select b from crash_me) ###<select a from crash_me where b =some (select b from crash_me)
###> 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 ###>1
func_where_exists=no # Function EXISTS func_where_exists=yes # Function EXISTS
### ###
###<select a from crash_me where exists (select * from crash_me) ###<select a from crash_me where exists (select * from crash_me)
###> 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 func_where_in_num=yes # Function IN on numbers
### ###
###<select a from crash_me where 2 in (3,2,5,9,5,1) ###<select a from crash_me where 2 in (3,2,5,9,5,1)
@ -1549,10 +1547,10 @@ func_where_not_between=yes # Function NOT BETWEEN
### ###
###<select a from crash_me where 7 not between 4 and 6 ###<select a from crash_me where 7 not between 4 and 6
###>1 ###>1
func_where_not_exists=no # Function NOT EXISTS func_where_not_exists=yes # Function NOT EXISTS
### ###
###<select a from crash_me where not exists (select * from crash_me where a = 2) ###<select a from crash_me where not exists (select * from crash_me where a = 2)
###> 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 func_where_not_like=yes # Function NOT LIKE
### ###
###<select a from crash_me where b not like 'b%' ###<select a from crash_me where b not like 'b%'
@ -1623,10 +1621,10 @@ group_func_extra_stddev=yes # Group function STDDEV
### ###
###<select stddev(a),a from crash_me group by a ###<select stddev(a),a from crash_me group by a
###>0.0000 ###>0.0000
group_func_extra_variance=no # Group function VARIANCE group_func_extra_variance=yes # Group function VARIANCE
### ###
###<select variance(a),a from crash_me group by a ###<select variance(a),a from crash_me group by a
###> 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 group_func_sql_any=no # Group function ANY
### ###
###<select any(a),a from crash_me group by a ###<select any(a),a from crash_me group by a
@ -1690,9 +1688,9 @@ group_on_unused=yes # Group on unused column
###> OK ###> OK
### ###
###As far as all queries returned OK, result is YES ###As far as all queries returned OK, result is YES
has_true_false=no # TRUE and FALSE has_true_false=yes # TRUE and FALSE
###< select (1=1)=true ###< select (1=1)=true
###> execute error:Unknown column 'true' in 'field list' ###> OK
having=yes # Having having=yes # Having
###<select a from crash_me group by a having a > 0 ###<select a from crash_me group by a having a > 0
###>1 ###>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 ###> 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 ###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): ###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 ###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 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 ###< select crash_me.a from crash_me left join crash_me2 ON crash_me.a=crash_me2.a
###> OK ###> OK
@ -1890,39 +1888,39 @@ logical_value=1 # Value of logical operation (1=1)
###>1 ###>1
max_big_expressions=10 # big expressions max_big_expressions=10 # big expressions
###We are trying (example with N=5): ###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 ### 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): ###We are trying (example with N=5):
###create table crash_q (q char(5)) ###create table crash_q (q char(5))
###insert into crash_q values ('aaaaa') ###insert into crash_q values ('aaaaa')
###select * from crash_q ###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 max_column_name=64 # column name length
###We are trying (example with N=5): ###We are trying (example with N=5):
###create table crash_q (qaaaaa integer) ###create table crash_q (qaaaaa integer)
###insert into crash_q (qaaaaa) values(1) ###insert into crash_q (qaaaaa) values(1)
###select qaaaaa from crash_q ###select qaaaaa from crash_q
### 256:FAIL 51:OK 153:FAIL 72:FAIL 55:OK 63:OK 67:FAIL 64:FAIL ### 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): ###We are trying (example with N=5):
###create table crash_q (a integer ,a0 integer,a1 integer,a2 integer,a3 integer,a4 integer) ###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 max_conditions=85660 # OR and AND in WHERE
###We are trying (example with N=5): ###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' ###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 ### 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): ###We are trying (example with N=5):
###select 1+1+1+1+1+1 ###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_index=32 # max index
### max_unique_index=32 ,so max_index must be same ### 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): ###We are trying (example with N=5):
###create table crash_q (q0 char(5) not null,unique (q0)) ###create table crash_q (q0 char(5) not null,unique (q0))
###insert into crash_q values('aaaaa') ###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 max_index_name=64 # index name length
###We are trying (example with N=5): ###We are trying (example with N=5):
###create index crash_qaaaaa on crash_me (a) ###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)) ###create table crash_q (q char(5) not null,unique(q))
###insert into crash_q (q) values ('aaaaa') ###insert into crash_q (q) values ('aaaaa')
###select q from crash_q ###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 max_index_parts=16 # index parts
###We are trying (example with N=5): ###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) ###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)) ###create table crash_q (q varchar(5) not null,unique(q))
###insert into crash_q (q) values ('aaaaa') ###insert into crash_q (q) values ('aaaaa')
###select q from crash_q ###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) max_row_length=65534 # max table row length (without blobs)
###We are trying (example with N=5): ###We are trying (example with N=5):
###create table crash_q (q0 char(5) not null) ###create table crash_q (q0 char(5) not null)
###insert into crash_q values ('aaaaa') ###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) max_row_length_with_null=65502 # table row length with nulls (without blobs)
###We are trying (example with N=5): ###We are trying (example with N=5):
###create table crash_q (q0 char(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 max_select_alias_name=+512 # select alias name length
###We are trying (example with N=5): ###We are trying (example with N=5):
###select b as aaaaa from crash_me ###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): ###We are trying (example with N=5):
###select 1+(1+(1+(1+(1+(1))))) ###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 max_table_alias_name=+512 # table alias name length
###We are trying (example with N=5): ###We are trying (example with N=5):
###select aaaaa.b from crash_me aaaaa ###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) ###insert into crash_q (q,q1,q2,q3,q4,q5) values (1,1,1,1,1,1)
###select q from crash_q ###select q from crash_q
### 32:OK 48:FAIL 35:FAIL 33:FAIL ### 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): ###We are trying (example with N=5):
###create table crash_q (q varchar(5)) ###create table crash_q (q varchar(5))
###insert into crash_q values ('aaaaa') ###insert into crash_q values ('aaaaa')
###select * from crash_q ###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 minus=no # minus
###< select * from crash_me minus select * from crash_me3 ###< 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 ###> 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 ###> OK
### ###
###As far as all queries returned OK, result is YES ###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 order_by=yes # Order by
###< select a from crash_me order by a ###< select a from crash_me order by a
###> OK ###> OK
@ -2267,6 +2267,9 @@ quote_with_"=yes # Allows ' and " as string markers
###> OK ###> OK
### ###
###As far as all queries returned OK, result is YES ###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() remember_end_space=no # Remembers end space in char()
###< create table crash_q (a char(10)) ###< create table crash_q (a char(10))
###> OK ###> OK
@ -2300,10 +2303,10 @@ rename_table=yes # rename table
###> OK ###> OK
### ###
###As far as all queries returned OK, result is YES ###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): ###We are trying (example with N=5):
###select repeat('a',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 reserved_word_ansi-92/99_absolute=no # Keyword ABSOLUTE
###< create table crash_me10 (ABSOLUTE int not null) ###< create table crash_me10 (ABSOLUTE int not null)
###> OK ###> OK
@ -2416,13 +2419,13 @@ reserved_word_ansi-92/99_authorization=no # Keyword AUTHORIZATION
###> OK ###> OK
### ###
###As far as all queries returned OK, result is NO ###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) ###< 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 ###< 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 reserved_word_ansi-92/99_begin=no # Keyword BEGIN
###< create table crash_me10 (BEGIN int not null) ###< create table crash_me10 (BEGIN int not null)
###> OK ###> OK
@ -2535,13 +2538,13 @@ reserved_word_ansi-92/99_close=no # Keyword CLOSE
###> OK ###> OK
### ###
###As far as all queries returned OK, result is NO ###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) ###< 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 ###< 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 reserved_word_ansi-92/99_collation=no # Keyword COLLATION
###< create table crash_me10 (COLLATION int not null) ###< create table crash_me10 (COLLATION int not null)
###> OK ###> OK
@ -2913,13 +2916,13 @@ reserved_word_ansi-92/99_external=no # Keyword EXTERNAL
###> OK ###> OK
### ###
###As far as all queries returned OK, result is NO ###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) ###< 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 ###< 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 reserved_word_ansi-92/99_fetch=no # Keyword FETCH
###< create table crash_me10 (FETCH int not null) ###< create table crash_me10 (FETCH int not null)
###> OK ###> OK
@ -3223,7 +3226,7 @@ reserved_word_ansi-92/99_level=no # Keyword LEVEL
###As far as all queries returned OK, result is NO ###As far as all queries returned OK, result is NO
reserved_word_ansi-92/99_like=yes # Keyword LIKE reserved_word_ansi-92/99_like=yes # Keyword LIKE
###< create table crash_me10 (LIKE int not null) ###< 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 ###< drop table crash_me10
###> execute error:Unknown table 'crash_me10' ###> execute error:Unknown table 'crash_me10'
### ###
@ -3466,13 +3469,13 @@ reserved_word_ansi-92/99_parameters=no # Keyword PARAMETERS
###> OK ###> OK
### ###
###As far as all queries returned OK, result is NO ###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) ###< 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 ###< 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 reserved_word_ansi-92/99_precision=yes # Keyword PRECISION
###< create table crash_me10 (PRECISION int not null) ###< 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 ###> 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 ###> OK
### ###
###As far as all queries returned OK, result is NO ###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) ###< 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 ###< 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 reserved_word_ansi-92/99_under=no # Keyword UNDER
###< create table crash_me10 (UNDER int not null) ###< create table crash_me10 (UNDER int not null)
###> OK ###> OK
@ -4124,13 +4127,13 @@ reserved_word_ansi92_coalesce=no # Keyword COALESCE
###> OK ###> OK
### ###
###As far as all queries returned OK, result is NO ###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) ###< 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 ###< 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 reserved_word_ansi92_count=no # Keyword COUNT
###< create table crash_me10 (COUNT int not null) ###< create table crash_me10 (COUNT int not null)
###> OK ###> OK
@ -5321,13 +5324,13 @@ reserved_word_extra_low_priority=yes # Keyword LOW_PRIORITY
###> execute error:Unknown table 'crash_me10' ###> execute error:Unknown table 'crash_me10'
### ###
###As far as some queries didnt return OK, result is YES ###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) ###< 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 ###< 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 reserved_word_extra_maxextents=no # Keyword MAXEXTENTS
###< create table crash_me10 (MAXEXTENTS int not null) ###< create table crash_me10 (MAXEXTENTS int not null)
###> OK ###> OK
@ -5720,13 +5723,13 @@ reserved_word_extra_soname=yes # Keyword SONAME
###> execute error:Unknown table 'crash_me10' ###> execute error:Unknown table 'crash_me10'
### ###
###As far as some queries didnt return OK, result is YES ###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) ###< 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 ###< 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 reserved_word_extra_sql_big_result=yes # Keyword SQL_BIG_RESULT
###< create table crash_me10 (SQL_BIG_RESULT int not null) ###< 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 ###> 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 select_string_size=1048565 # constant string size in SELECT
###We are trying (example with N=5): ###We are trying (example with N=5):
###select 'aaaaa' ###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)) ###< create table crash_q (a integer,b char(10))
###> OK ###> OK
###< insert into crash_q values(1,'c') ###< insert into crash_q values(1,'c')
###> OK ###> OK
###< update crash_q set b= (select b from crash_me where crash_q.a = crash_me.a) ###< 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
###
###<select b from crash_q
###>a
### ###
###< drop table crash_q ###< drop table crash_q
###> OK ###> OK
@ -6053,7 +6059,7 @@ select_without_from=yes # SELECT without FROM
###> OK ###> OK
### ###
###As far as all queries returned OK, result is YES ###As far as all queries returned OK, result is YES
server_version=MySQL 4.0.15 debug log/ # server version server_version=MySQL 4.1.2 alpha # server version
simple_joins=yes # ANSI SQL simple joins simple_joins=yes # ANSI SQL simple joins
###< select crash_me.a from crash_me, crash_me t0 ###< select crash_me.a from crash_me, crash_me t0
###> OK ###> OK
@ -6148,11 +6154,11 @@ storage_of_float=round # Storage of float values
### ###
###< drop table crash_q ###< drop table crash_q
###> OK ###> OK
subqueries=no # subqueries subqueries=yes # subqueries
###< select a from crash_me where crash_me.a in (select max(a) from crash_me) ###< 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 ###> OK
### ###
###As far as some queries didnt return OK, result is NO ###As far as all queries returned OK, result is YES
table_alias=yes # Table alias table_alias=yes # Table alias
###< select b.a from crash_me as b ###< select b.a from crash_me as b
###> OK ###> OK
@ -6220,7 +6226,7 @@ time_format_inresult=iso # Time format in result
###> OK ###> OK
### ###
###< select a from crash_me_t ###< select a from crash_me_t
###> 19:55:21 ###> 13:49:05
###< delete from crash_me_t ###< delete from crash_me_t
###> OK ###> OK
transactions=yes # transactions transactions=yes # transactions
@ -6439,13 +6445,13 @@ type_extra_line=no # Type line
###> execute error:Unknown table 'crash_q' ###> execute error:Unknown table 'crash_q'
### ###
###As far as some queries didnt return OK, result is NO ###As far as some queries didnt return OK, result is NO
type_extra_long=no # Type long type_extra_long=yes # Type long
###< create table crash_q (q long) ###< create table crash_q (q long)
###> 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 ###> OK
###< drop table crash_q ###< drop table crash_q
###> execute error:Unknown table 'crash_q' ###> OK
### ###
###As far as some queries didnt return OK, result is NO ###As far as all queries returned OK, result is YES
type_extra_long_raw=no # Type long raw type_extra_long_raw=no # Type long raw
###< create table crash_q (q long raw) ###< create table crash_q (q long raw)
###> 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 'raw)' 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 'raw)' at line 1
@ -6558,20 +6564,20 @@ type_extra_path=no # Type path
###> execute error:Unknown table 'crash_q' ###> execute error:Unknown table 'crash_q'
### ###
###As far as some queries didnt return OK, result is NO ###As far as some queries didnt return OK, result is NO
type_extra_point=no # Type point type_extra_point=yes # Type point
###< create table crash_q (q point) ###< create table crash_q (q point)
###> 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 'point)' at line 1 ###> OK
###< drop table crash_q ###< drop table crash_q
###> execute error:Unknown table 'crash_q' ###> OK
### ###
###As far as some queries didnt return OK, result is NO ###As far as all queries returned OK, result is YES
type_extra_polygon=no # Type polygon type_extra_polygon=yes # Type polygon
###< create table crash_q (q polygon) ###< create table crash_q (q polygon)
###> 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 'polygon)' at line 1 ###> OK
###< drop table crash_q ###< drop table crash_q
###> execute error:Unknown table 'crash_q' ###> OK
### ###
###As far as some queries didnt return OK, result is NO ###As far as all queries returned OK, result is YES
type_extra_raw(1_arg)=no # Type raw(1 arg) type_extra_raw(1_arg)=no # Type raw(1 arg)
###< create table crash_q (q raw(16)) ###< create table crash_q (q raw(16))
###> 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 'raw(16))' 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 'raw(16))' at line 1
@ -6593,13 +6599,13 @@ type_extra_rowid=no # Type rowid
###> execute error:Unknown table 'crash_q' ###> execute error:Unknown table 'crash_q'
### ###
###As far as some queries didnt return OK, result is NO ###As far as some queries didnt return OK, result is NO
type_extra_serial=no # Type serial type_extra_serial=yes # Type serial
###< create table crash_q (q serial) ###< create table crash_q (q serial)
###> 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 'serial)' at line 1 ###> OK
###< drop table crash_q ###< drop table crash_q
###> execute error:Unknown table 'crash_q' ###> OK
### ###
###As far as some queries didnt return OK, result is NO ###As far as all queries returned OK, result is YES
type_extra_set(1_arg)=yes # Type set(1 arg) type_extra_set(1_arg)=yes # Type set(1 arg)
###< create table crash_q (q set('red')) ###< create table crash_q (q set('red'))
###> OK ###> OK
@ -6635,13 +6641,13 @@ type_extra_text=yes # Type text
###> OK ###> OK
### ###
###As far as all queries returned OK, result is YES ###As far as all queries returned OK, result is YES
type_extra_text(1_arg)=no # Type text(1 arg) type_extra_text(1_arg)=yes # Type text(1 arg)
###< create table crash_q (q text(10)) ###< create table crash_q (q text(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 '(10))' at line 1 ###> OK
###< drop table crash_q ###< drop table crash_q
###> execute error:Unknown table 'crash_q' ###> OK
### ###
###As far as some queries didnt return OK, result is NO ###As far as all queries returned OK, result is YES
type_extra_timespan=no # Type timespan type_extra_timespan=no # Type timespan
###< create table crash_q (q timespan) ###< create table crash_q (q timespan)
###> 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 'timespan)' 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 'timespan)' at line 1
@ -6726,13 +6732,13 @@ type_sql_bit_varying(1_arg)=no # Type bit varying(1 arg)
###> execute error:Unknown table 'crash_q' ###> execute error:Unknown table 'crash_q'
### ###
###As far as some queries didnt return OK, result is NO ###As far as some queries didnt return OK, result is NO
type_sql_boolean=no # Type boolean type_sql_boolean=yes # Type boolean
###< create table crash_q (q boolean) ###< create table crash_q (q boolean)
###> 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 'boolean)' at line 1 ###> OK
###< drop table crash_q ###< drop table crash_q
###> execute error:Unknown table 'crash_q' ###> OK
### ###
###As far as some queries didnt return OK, result is NO ###As far as all queries returned OK, result is YES
type_sql_char(1_arg)=yes # Type char(1 arg) type_sql_char(1_arg)=yes # Type char(1 arg)
###< create table crash_q (q char(1)) ###< create table crash_q (q char(1))
###> OK ###> OK
@ -7032,12 +7038,12 @@ unique_null_in_create=yes # unique null in create
###> OK ###> OK
### ###
###As far as all queries returned OK, result is YES ###As far as all queries returned OK, result is YES
value_of_false=not supported # Value of FALSE value_of_false=0 # Value of FALSE
###<select FALSE ###<select FALSE
###> execute failed:Unknown column 'FALSE' in 'field list' ###>0
value_of_true=not supported # Value of TRUE value_of_true=1 # Value of TRUE
###<select TRUE ###<select TRUE
###> execute failed:Unknown column 'TRUE' in 'field list' ###>1
views=no # views views=no # views
###< create view crash_q as select a from crash_me ###< create view crash_q as select 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 'view crash_q as select a from crash_me' 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 'view crash_q as select a from crash_me' at line 1

View File

@ -2044,7 +2044,7 @@ error:
/* Free alloced memory */ /* Free alloced memory */
end_server(mysql); end_server(mysql);
mysql_close_free(mysql); mysql_close_free(mysql);
if (!(client_flag & CLIENT_REMEMBER_OPTIONS)) if (!(((ulong) client_flag) & CLIENT_REMEMBER_OPTIONS))
mysql_close_free_options(mysql); mysql_close_free_options(mysql);
} }
DBUG_RETURN(0); DBUG_RETURN(0);

View File

@ -50,7 +50,7 @@ static bool read_texts(const char *file_name,const char ***point,
char name[FN_REFLEN]; char name[FN_REFLEN];
const char *buff; const char *buff;
uchar head[32],*pos; uchar head[32],*pos;
CHARSET_INFO *cset; CHARSET_INFO *cset; // For future
DBUG_ENTER("read_texts"); DBUG_ENTER("read_texts");
*point=0; // If something goes wrong *point=0; // If something goes wrong
@ -137,7 +137,7 @@ err1:
if (file != FERR) if (file != FERR)
VOID(my_close(file,MYF(MY_WME))); VOID(my_close(file,MYF(MY_WME)));
unireg_abort(1); unireg_abort(1);
DBUG_RETURN(1); // Impossible DBUG_RETURN(1); // keep compiler happy
} /* read_texts */ } /* read_texts */

View File

@ -161,13 +161,6 @@ static bool test_if_real(const char *str,int length, CHARSET_INFO *cs)
} }
#endif #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. 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), field_name(field_name_arg),
query_id(0), key_start(0), part_of_key(0), part_of_sortkey(0), query_id(0), key_start(0), part_of_key(0), part_of_sortkey(0),
unireg_check(unireg_check_arg), 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; flags=null_ptr ? 0: NOT_NULL_FLAG;
comment.str= (char*) ""; comment.str= (char*) "";
@ -2789,14 +2782,8 @@ int Field_double::cmp(const char *a_ptr, const char *b_ptr)
else else
#endif #endif
{ {
/* could this ALWAYS be 2 calls to doubleget() ?? */
#if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN)
doubleget(a, a_ptr); doubleget(a, a_ptr);
doubleget(b, b_ptr); doubleget(b, b_ptr);
#else
memcpy_fixed(&a,a_ptr,sizeof(double));
memcpy_fixed(&b,b_ptr,sizeof(double));
#endif
} }
return (a < b) ? -1 : (a > b) ? 1 : 0; return (a < b) ? -1 : (a > b) ? 1 : 0;
} }
@ -2816,12 +2803,7 @@ void Field_double::sort_string(char *to,uint length __attribute__((unused)))
} }
else else
#endif #endif
/* could this ALWAYS be 2 calls to doubleget() ?? */
#if defined(__FLOAT_WORD_ORDER) && (__FLOAT_WORD_ORDER == __BIG_ENDIAN)
doubleget(nr,ptr); doubleget(nr,ptr);
#else
memcpy_fixed(&nr,ptr,sizeof(nr));
#endif
change_double_for_sort(nr, (byte*) to); change_double_for_sort(nr, (byte*) to);
} }
@ -5597,7 +5579,7 @@ uint32 calc_pack_length(enum_field_types type,uint32 length)
case FIELD_TYPE_ENUM: abort(); return 0; // This shouldn't happen case FIELD_TYPE_ENUM: abort(); return 0; // This shouldn't happen
default: return 0; default: return 0;
} }
return 0; // This shouldn't happen return 0; // Keep compiler happy
} }
@ -5630,6 +5612,18 @@ Field *make_field(char *ptr, uint32 field_length,
null_pos=0; null_pos=0;
null_bit=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_alpha(pack_flag))
{ {
if (!f_is_packed(pack_flag)) if (!f_is_packed(pack_flag))

View File

@ -87,7 +87,6 @@ public:
uint32 field_length; // Length of field uint32 field_length; // Length of field
uint16 flags; uint16 flags;
uchar null_bit; // Bit used to test null bit 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, Field(char *ptr_arg,uint32 length_arg,uchar *null_ptr_arg,uchar null_bit_arg,
utype unireg_check_arg, const char *field_name_arg, utype unireg_check_arg, const char *field_name_arg,

View File

@ -663,9 +663,22 @@ static void make_sortkey(register SORTPARAM *param,
for ( ; (field= addonf->field) ; addonf++) for ( ; (field= addonf->field) ; addonf++)
{ {
if (addonf->null_bit && field->is_null()) if (addonf->null_bit && field->is_null())
{
nulls[addonf->null_offset]|= addonf->null_bit; nulls[addonf->null_offset]|= addonf->null_bit;
#ifdef HAVE_purify
bzero(to, addonf->length);
#endif
}
else 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; to+= addonf->length;
} }
} }

View File

@ -134,7 +134,6 @@ static mysql_byte* innobase_get_key(INNOBASE_SHARE *share,uint *length,
my_bool not_used __attribute__((unused))); my_bool not_used __attribute__((unused)));
static INNOBASE_SHARE *get_share(const char *table_name); static INNOBASE_SHARE *get_share(const char *table_name);
static void free_share(INNOBASE_SHARE *share); static void free_share(INNOBASE_SHARE *share);
static void innobase_print_error(const char* db_errpfx, char* buffer);
/* General functions */ /* General functions */
@ -1292,18 +1291,6 @@ innobase_close_connection(
return(0); 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 ** InnoDB database tables

View File

@ -841,14 +841,11 @@ void ha_myisam::deactivate_non_unique_index(ha_rows rows)
if (file->state->records == 0 && if (file->state->records == 0 &&
(!rows || rows >= MI_MIN_ROWS_TO_DISABLE_INDEXES)) (!rows || rows >= MI_MIN_ROWS_TO_DISABLE_INDEXES))
mi_disable_non_unique_index(file,rows); mi_disable_non_unique_index(file,rows);
else else if (!file->bulk_insert &&
if (!file->bulk_insert && (!rows || rows >= MI_MIN_ROWS_TO_USE_BULK_INSERT))
(!rows || rows >= MI_MIN_ROWS_TO_USE_BULK_INSERT))
{
mi_init_bulk_insert(file, mi_init_bulk_insert(file,
current_thd->variables.bulk_insert_buff_size, current_thd->variables.bulk_insert_buff_size,
rows); rows);
}
} }
} }
enable_activate_all_index=1; enable_activate_all_index=1;

View File

@ -46,7 +46,5 @@ void unireg_init(ulong options)
log_10[i]= nr ; nr*= 10.0; log_10[i]= nr ; nr*= 10.0;
} }
specialflag|=options; /* Set options from argv */ specialflag|=options; /* Set options from argv */
thread_stack_min=thread_stack - STACK_MIN_SIZE;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }

View File

@ -771,7 +771,6 @@ String *Item_param::query_val_str(String* str)
case INT_RESULT: case INT_RESULT:
case REAL_RESULT: case REAL_RESULT:
return val_str(str); return val_str(str);
break;
default: default:
str->set("'", 1, default_charset()); str->set("'", 1, default_charset());

View File

@ -1472,16 +1472,12 @@ cmp_item* cmp_item::get_comparator(Item *item)
switch (item->result_type()) { switch (item->result_type()) {
case STRING_RESULT: case STRING_RESULT:
return new cmp_item_sort_string(item->collation.collation); return new cmp_item_sort_string(item->collation.collation);
break;
case INT_RESULT: case INT_RESULT:
return new cmp_item_int; return new cmp_item_int;
break;
case REAL_RESULT: case REAL_RESULT:
return new cmp_item_real; return new cmp_item_real;
break;
case ROW_RESULT: case ROW_RESULT:
return new cmp_item_row; return new cmp_item_row;
break;
default: default:
DBUG_ASSERT(0); DBUG_ASSERT(0);
break; break;

View File

@ -1143,7 +1143,6 @@ String *Item_func_min_max::val_str(String *str)
// This case should never be choosen // This case should never be choosen
DBUG_ASSERT(0); DBUG_ASSERT(0);
return 0; return 0;
} }
return 0; // Keep compiler happy return 0; // Keep compiler happy
} }
@ -2442,7 +2441,6 @@ Item_func_set_user_var::check()
save_result.vint= args[0]->val_int(); save_result.vint= args[0]->val_int();
break; break;
} }
break;
case STRING_RESULT: case STRING_RESULT:
{ {
save_result.vstr= args[0]->val_str(&value); 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); INT_RESULT, &my_charset_bin, DERIVATION_NONE);
break; break;
} }
break;
case STRING_RESULT: case STRING_RESULT:
{ {
if (!save_result.vstr) // Null value if (!save_result.vstr) // Null value

View File

@ -66,7 +66,6 @@ String *Item_func_geometry_from_wkb::val_str(String *str)
String arg_val; String arg_val;
String *wkb= args[0]->val_str(&arg_val); String *wkb= args[0]->val_str(&arg_val);
Geometry_buffer buffer; Geometry_buffer buffer;
Geometry *geom;
uint32 srid= 0; uint32 srid= 0;
if ((arg_count == 2) && !args[1]->null_value) 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); str->q_append(srid);
if ((null_value= if ((null_value=
(args[0]->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)))) str->append(*wkb))))
return 0; return 0;
return str; return str;
@ -126,12 +125,11 @@ String *Item_func_as_wkb::val_str(String *str)
String arg_val; String arg_val;
String *swkb= args[0]->val_str(&arg_val); String *swkb= args[0]->val_str(&arg_val);
Geometry_buffer buffer; Geometry_buffer buffer;
Geometry *geom;
if ((null_value= if ((null_value=
(args[0]->null_value || (args[0]->null_value ||
!(geom= Geometry::create_from_wkb(&buffer, swkb->ptr() + SRID_SIZE, !(Geometry::create_from_wkb(&buffer, swkb->ptr() + SRID_SIZE,
swkb->length() - SRID_SIZE))))) swkb->length() - SRID_SIZE)))))
return 0; return 0;
str->copy(swkb->ptr() + SRID_SIZE, swkb->length() - SRID_SIZE, str->copy(swkb->ptr() + SRID_SIZE, swkb->length() - SRID_SIZE,
@ -701,10 +699,10 @@ longlong Item_func_srid::val_int()
Geometry_buffer buffer; Geometry_buffer buffer;
Geometry *geom; Geometry *geom;
null_value= !swkb || null_value= (!swkb ||
!(geom= Geometry::create_from_wkb(&buffer, !Geometry::create_from_wkb(&buffer,
swkb->ptr() + SRID_SIZE, swkb->ptr() + SRID_SIZE,
swkb->length() - SRID_SIZE)); swkb->length() - SRID_SIZE));
if (null_value) if (null_value)
return 0; return 0;

View File

@ -41,7 +41,11 @@ Item_sum::Item_sum(List<Item> &list)
list.empty(); // Fields are used 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_sum::Item_sum(THD *thd, Item_sum *item):
Item_result_field(thd, item), arg_count(item->arg_count), Item_result_field(thd, item), arg_count(item->arg_count),
quick_group(item->quick_group) quick_group(item->quick_group)
@ -1538,10 +1542,17 @@ String *Item_sum_udf_str::val_str(String *str)
/***************************************************************************** /*****************************************************************************
GROUP_CONCAT function GROUP_CONCAT function
Syntax:
GROUP_CONCAT([DISTINCT] expr,... [ORDER BY col [ASC|DESC],...] SQL SYNTAX:
[SEPARATOR str_const]) GROUP_CONCAT([DISTINCT] expr,... [ORDER BY col [ASC|DESC],...]
[SEPARATOR str_const])
concat of values from "group by" operation 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
*****************************************************************************/ *****************************************************************************/
/* /*
@ -1552,23 +1563,26 @@ String *Item_sum_udf_str::val_str(String *str)
int group_concat_key_cmp_with_distinct(void* arg, byte* key1, int group_concat_key_cmp_with_distinct(void* arg, byte* key1,
byte* key2) byte* key2)
{ {
Item_func_group_concat* item= (Item_func_group_concat*)arg; Item_func_group_concat* grp_item= (Item_func_group_concat*)arg;
Item **field_item, **end;
char *record= (char*) grp_item->table->record[0];
for (uint i= 0; i < item->arg_count_field; i++) for (field_item= grp_item->args, end= field_item + grp_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(); We have to use get_tmp_table_field() instead of
real_item()->get_tmp_table_field() because we want the field in
the temporary table, not the original field
*/
Field *field= (*field_item)->get_tmp_table_field();
if (field) if (field)
{ {
uint offset= field->abs_offset; int res;
uint offset= (uint) (field->ptr - record);
int res= field->key_cmp(key1 + offset, key2 + offset); if ((res= field->key_cmp(key1 + offset, key2 + offset)))
/* return res;
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;
} }
} }
return 0; return 0;
@ -1582,25 +1596,33 @@ int group_concat_key_cmp_with_distinct(void* arg, byte* key1,
int group_concat_key_cmp_with_order(void* arg, byte* key1, byte* key2) int group_concat_key_cmp_with_order(void* arg, byte* key1, byte* key2)
{ {
Item_func_group_concat* item= (Item_func_group_concat*)arg; Item_func_group_concat* grp_item= (Item_func_group_concat*) arg;
ORDER **order_item, **end;
char *record= (char*) grp_item->table->record[0];
for (uint i=0; i < item->arg_count_order; i++) for (order_item= grp_item->order, end=order_item+ grp_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(); We have to use get_tmp_table_field() instead of
real_item()->get_tmp_table_field() because we want the field in
the temporary table, not the original field
*/
Field *field= item->get_tmp_table_field();
if (field) if (field)
{ {
uint offset= field->abs_offset; int res;
uint offset= (uint) (field->ptr - record);
bool dir= order_item->asc; if ((res= field->key_cmp(key1 + offset, key2 + offset)))
int res= field->key_cmp(key1 + offset, key2 + offset); return (*order_item)->asc ? res : -res;
if (res)
return dir ? res : -res;
} }
} }
/* /*
We can't return 0 because tree class remove this item as double value. We can't return 0 because in that case the tree class would remove this
item as double value. This would cause problems for case-changes and
if the the returned values are not the same we do the sort on.
*/ */
return 1; return 1;
} }
@ -1609,6 +1631,11 @@ int group_concat_key_cmp_with_order(void* arg, byte* key1, byte* key2)
/* /*
function of sort for syntax: function of sort for syntax:
GROUP_CONCAT(DISTINCT expr,... ORDER BY col,... ) 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, int group_concat_key_cmp_with_distinct_and_order(void* arg,byte* key1,
@ -1621,58 +1648,61 @@ int group_concat_key_cmp_with_distinct_and_order(void* arg,byte* key1,
/* /*
create result Append data from current leaf to item->result
item is pointer to Item_func_group_concat
*/ */
int dump_leaf_key(byte* key, uint32 count __attribute__((unused)), 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]; char buff[MAX_FIELD_WIDTH];
String tmp((char *)&buff,sizeof(buff),default_charset_info); String tmp((char*) &buff, sizeof(buff), default_charset_info);
String tmp2((char *)&buff,sizeof(buff),default_charset_info); String tmp2((char *) &buff, sizeof(buff), default_charset_info);
char *record= (char*) item->table->record[0];
tmp.length(0); 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()) if (!show_item->const_item())
{ {
Field *f= show_item->real_item()->get_tmp_table_field(); /*
char *sv= f->ptr; We have to use get_tmp_table_field() instead of
f->ptr= (char *)key + f->abs_offset; real_item()->get_tmp_table_field() because we want the field in
String *res= f->val_str(&tmp,&tmp2); the temporary table, not the original field
group_concat_item->result.append(*res); */
f->ptr= sv; Field *field= show_item->get_tmp_table_field();
String *res;
char *save_ptr= field->ptr;
uint offset= (uint) (save_ptr - record);
DBUG_ASSERT(offset < item->table->reclength);
field->ptr= (char *) key + offset;
res= field->val_str(&tmp,&tmp2);
item->result.append(*res);
field->ptr= save_ptr;
} }
else else
{ {
String *res= show_item->val_str(&tmp); String *res= show_item->val_str(&tmp);
if (res) 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++; item->show_elements++;
if (group_concat_item->show_elements < if (item->show_elements < item->tree->elements_in_tree)
group_concat_item->tree->elements_in_tree) item->result.append(*item->separator);
group_concat_item->result.append(*group_concat_item->separator);
} }
else 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); item->count_cut_values++;
} item->result.length(item->group_concat_max_len);
/* item->warning_for_row= TRUE;
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;
return 1; return 1;
} }
return 0; return 0;
@ -1692,58 +1722,88 @@ Item_func_group_concat::Item_func_group_concat(bool is_distinct,
SQL_LIST *is_order, SQL_LIST *is_order,
String *is_separator) String *is_separator)
:Item_sum(), tmp_table_param(0), max_elements_in_tree(0), warning(0), :Item_sum(), tmp_table_param(0), max_elements_in_tree(0), warning(0),
warning_available(0), key_length(0), rec_offset(0), warning_available(0), key_length(0),
tree_mode(0), distinct(is_distinct), warning_for_row(0), tree_mode(0), distinct(is_distinct), warning_for_row(0),
separator(is_separator), tree(&tree_base), table(0), separator(is_separator), tree(&tree_base), table(0),
order(0), tables_list(0), order(0), tables_list(0),
show_elements(0), arg_count_order(0), arg_count_field(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; original= 0;
quick_group= 0; quick_group= 0;
mark_as_sum_func(); mark_as_sum_func();
order= 0; order= 0;
group_concat_max_len= current_thd->variables.group_concat_max_len; group_concat_max_len= current_thd->variables.group_concat_max_len;
arg_count_field= is_select->elements;
arg_show_fields= arg_count_field= is_select->elements;
arg_count_order= is_order ? is_order->elements : 0; 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: We need to allocate:
args - arg_count+arg_count_order (for possible order items in temporare args - arg_count_field+arg_count_order
tables) (for possible order items in temporare tables)
order - arg_count_order order - arg_count_order
*/ */
args= (Item**) sql_alloc(sizeof(Item*)*(arg_count+arg_count_order)+ if (!(args= (Item**) sql_alloc(sizeof(Item*) * arg_count +
sizeof(ORDER*)*arg_count_order); sizeof(ORDER*)*arg_count_order)))
if (!args)
return; return;
/* fill args items of show and sort */ order= (ORDER**)(args + arg_count);
int i= 0;
List_iterator_fast<Item> li(*is_select);
Item *item_select;
for ( ; (item_select= li++) ; i++) /* fill args items of show and sort */
args[i]= item_select; List_iterator_fast<Item> li(*is_select);
for (arg_ptr=args ; (item_select= li++) ; arg_ptr++)
*arg_ptr= item_select;
if (arg_count_order) if (arg_count_order)
{ {
i= 0; ORDER **order_ptr= order;
order= (ORDER**)(args + arg_count + arg_count_order);
for (ORDER *order_item= (ORDER*) is_order->first; for (ORDER *order_item= (ORDER*) is_order->first;
order_item != NULL; order_item != NULL;
order_item= order_item->next) 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),
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),
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() void Item_func_group_concat::cleanup()
{ {
DBUG_ENTER("Item_func_group_concat::cleanup"); DBUG_ENTER("Item_func_group_concat::cleanup");
@ -1785,12 +1845,11 @@ Item_func_group_concat::~Item_func_group_concat()
*/ */
if (!original) if (!original)
{ {
THD *thd= current_thd;
if (warning_available) if (warning_available)
{ {
char warn_buff[MYSQL_ERRMSG_SIZE]; char warn_buff[MYSQL_ERRMSG_SIZE];
sprintf(warn_buff, ER(ER_CUT_VALUE_GROUP_CONCAT), count_cut_values); 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);
} }
} }
} }
@ -1826,33 +1885,31 @@ bool Item_func_group_concat::add()
copy_fields(tmp_table_param); copy_fields(tmp_table_param);
copy_funcs(tmp_table_param->items_to_copy); copy_funcs(tmp_table_param->items_to_copy);
bool record_is_null= TRUE; for (uint i= 0; i < arg_count_field; i++)
for (uint i= 0; i < arg_show_fields; i++)
{ {
Item *show_item= args[i]; Item *show_item= args[i];
if (!show_item->const_item()) if (!show_item->const_item())
{ {
/*
Here we use real_item as we want the original field data that should
be written to table->record[0]
*/
Field *f= show_item->real_item()->get_tmp_table_field(); Field *f= show_item->real_item()->get_tmp_table_field();
if (!f->is_null()) if (f->is_null())
{ return 0; // Skip row if it contains null
record_is_null= FALSE;
break;
}
} }
} }
if (record_is_null)
return 0;
null_value= FALSE; null_value= FALSE;
if (tree_mode) if (tree_mode)
{ {
if (!tree_insert(tree, table->record[0] + rec_offset, 0, tree->custom_arg)) if (!tree_insert(tree, table->record[0], 0, tree->custom_arg))
return 1; return 1;
} }
else else
{ {
if (result.length() <= group_concat_max_len && !warning_for_row) if (result.length() <= group_concat_max_len && !warning_for_row)
dump_leaf_key(table->record[0] + rec_offset, 1, dump_leaf_key(table->record[0], 1, this);
(Item_func_group_concat*)this);
} }
return 0; return 0;
} }
@ -1884,24 +1941,19 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
thd->allow_sum_func= 0; thd->allow_sum_func= 0;
maybe_null= 0; maybe_null= 0;
item_thd= thd; item_thd= thd;
/*
Fix fields for select list and ORDER clause
*/
for (i= 0 ; i < arg_count ; i++) for (i= 0 ; i < arg_count ; i++)
{ {
if (args[i]->fix_fields(thd, tables, args + i) || args[i]->check_cols(1)) if (args[i]->fix_fields(thd, tables, args + i) || args[i]->check_cols(1))
return 1; return 1;
maybe_null |= args[i]->maybe_null; if (i < arg_count_field && args[i]->maybe_null)
} maybe_null= 0;
/*
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;
} }
result_field= 0; result_field= 0;
null_value= 1; null_value= 1;
max_length= group_concat_max_len; max_length= group_concat_max_len;
@ -1916,23 +1968,29 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
bool Item_func_group_concat::setup(THD *thd) bool Item_func_group_concat::setup(THD *thd)
{ {
DBUG_ENTER("Item_func_group_concat::setup");
List<Item> list; List<Item> list;
SELECT_LEX *select_lex= thd->lex->current_select; SELECT_LEX *select_lex= thd->lex->current_select;
uint const_fields;
byte *record;
qsort_cmp2 compare_key;
DBUG_ENTER("Item_func_group_concat::setup");
if (select_lex->linkage == GLOBAL_OPTIONS_TYPE) if (select_lex->linkage == GLOBAL_OPTIONS_TYPE)
DBUG_RETURN(1); DBUG_RETURN(1);
/* /*
push all not constant fields to list and create temp table push all not constant fields to list and create temp table
*/ */
const_fields= 0;
always_null= 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]; Item *item= args[i];
if (list.push_back(item)) if (list.push_back(item))
DBUG_RETURN(1); DBUG_RETURN(1);
if (item->const_item()) if (item->const_item())
{ {
const_fields++;
(void) item->val_int(); (void) item->val_int();
if (item->null_value) if (item->null_value)
always_null= 1; always_null= 1;
@ -1952,12 +2010,19 @@ bool Item_func_group_concat::setup(THD *thd)
count_field_types(tmp_table_param,all_fields,0); count_field_types(tmp_table_param,all_fields,0);
if (table) 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); free_tmp_table(thd, table);
tmp_table_param->cleanup(); 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). (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, if (!(table=create_tmp_table(thd, tmp_table_param, all_fields, 0,
0, 0, 0,select_lex->options | thd->options, 0, 0, 0,select_lex->options | thd->options,
@ -1966,27 +2031,17 @@ bool Item_func_group_concat::setup(THD *thd)
table->file->extra(HA_EXTRA_NO_ROWS); table->file->extra(HA_EXTRA_NO_ROWS);
table->no_rows= 1; table->no_rows= 1;
key_length= table->reclength;
record= table->record[0];
Field** field, **field_end; /* Offset to first result field in table */
field_end = (field = table->field) + table->fields; field_list_offset= table->fields - (list.elements - const_fields);
uint offset = 0;
for (key_length = 0; field < field_end; ++field)
{
uint32 length= (*field)->pack_length();
(*field)->abs_offset= offset;
offset+= length;
key_length += length;
}
rec_offset = table->reclength - key_length;
if (tree_mode) if (tree_mode)
delete_tree(tree); delete_tree(tree);
/*
choise function of sort /* choose function of sort */
*/
tree_mode= distinct || arg_count_order; tree_mode= distinct || arg_count_order;
qsort_cmp2 compare_key;
if (tree_mode) if (tree_mode)
{ {
if (arg_count_order) if (arg_count_order)
@ -1998,21 +2053,20 @@ bool Item_func_group_concat::setup(THD *thd)
} }
else else
{ {
compare_key= NULL;
if (distinct) if (distinct)
compare_key= (qsort_cmp2) group_concat_key_cmp_with_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 Create a tree of sort. Tree is used for a sort and a remove double
values (according with syntax of the function). If function does't values (according with syntax of the function). If function doesn't
contain DISTINCT and ORDER BY clauses, we don't create this tree. contain DISTINCT and ORDER BY clauses, we don't create this tree.
*/ */
init_tree(tree, min(thd->variables.max_heap_table_size, 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); key_length, compare_key, 0, NULL, (void*) this);
max_elements_in_tree= ((key_length) ? max_elements_in_tree= (key_length ?
thd->variables.max_heap_table_size/key_length : 1); thd->variables.max_heap_table_size/key_length : 1);
}; };
/* /*
@ -2027,6 +2081,7 @@ bool Item_func_group_concat::setup(THD *thd)
DBUG_RETURN(0); DBUG_RETURN(0);
} }
/* This is used by rollup to create a separate usable copy of the function */ /* This is used by rollup to create a separate usable copy of the function */
void Item_func_group_concat::make_unique() void Item_func_group_concat::make_unique()
@ -2069,7 +2124,7 @@ void Item_func_group_concat::print(String *str)
str->append("group_concat(", 13); str->append("group_concat(", 13);
if (distinct) if (distinct)
str->append("distinct ", 9); str->append("distinct ", 9);
for (uint i= 0; i < arg_count; i++) for (uint i= 0; i < arg_count_field; i++)
{ {
if (i) if (i)
str->append(','); str->append(',');

View File

@ -197,18 +197,24 @@ class Item_sum_count_distinct :public Item_sum_int
uint key_length; uint key_length;
CHARSET_INFO *key_charset; 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; 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 The first few bytes of record ( at least one)
// they will just bloat the tree without providing any valuable info 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; 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 If there are no blobs, we can use a tree, which
// to help get things set up, but we insert nothing in it 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 use_tree;
bool always_null; // Set to 1 if the result is always NULL bool always_null; // Set to 1 if the result is always NULL
@ -312,18 +318,17 @@ public:
void fix_length_and_dec() {} 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 - avg(a))^2 / count(a) ) = (sum(ai^2) - sum(2*ai*avg(a)) + sum(avg(a)^2))/count(a) =
= sum (ai^2 - 2*ai*avg(a) + avg(a)^2) / count(a) = (sum(ai^2) - 2*avg(a)*sum(a) + count(a)*avg(a)^2)/count(a) =
= (sum(ai^2) - sum(2*ai*avg(a)) + sum(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*avg(a)*sum(a) + count(a)*avg(a)^2)/count(a) = = (sum(ai^2) - 2*sum(a)^2/count(a) + sum(a)^2/count(a) )/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) - sum(a)^2/count(a))/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 class Item_sum_variance : public Item_sum_num
@ -509,8 +514,9 @@ class Item_sum_xor :public Item_sum_bit
/* /*
** user defined aggregates User defined aggregates
*/ */
#ifdef HAVE_DLOPEN #ifdef HAVE_DLOPEN
class Item_udf_sum : public Item_sum class Item_udf_sum : public Item_sum
@ -668,7 +674,6 @@ class Item_func_group_concat : public Item_sum
MYSQL_ERROR *warning; MYSQL_ERROR *warning;
bool warning_available; bool warning_available;
uint key_length; uint key_length;
int rec_offset;
bool tree_mode; bool tree_mode;
bool distinct; bool distinct;
bool warning_for_row; bool warning_for_row;
@ -676,12 +681,13 @@ class Item_func_group_concat : public Item_sum
friend int group_concat_key_cmp_with_distinct(void* arg, byte* key1, friend int group_concat_key_cmp_with_distinct(void* arg, byte* key1,
byte* key2); 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, friend int group_concat_key_cmp_with_distinct_and_order(void* arg,
byte* key1, byte* key1,
byte* key2); byte* key2);
friend int dump_leaf_key(byte* key, uint32 count __attribute__((unused)), 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: public:
String result; String result;
@ -695,7 +701,7 @@ class Item_func_group_concat : public Item_sum
uint show_elements; uint show_elements;
uint arg_count_order; uint arg_count_order;
uint arg_count_field; uint arg_count_field;
uint arg_show_fields; uint field_list_offset;
uint count_cut_values; uint count_cut_values;
/* /*
Following is 0 normal object and pointer to original one for copy Following is 0 normal object and pointer to original one for copy
@ -706,38 +712,12 @@ class Item_func_group_concat : public Item_sum
Item_func_group_concat(bool is_distinct,List<Item> *is_select, Item_func_group_concat(bool is_distinct,List<Item> *is_select,
SQL_LIST *is_order,String *is_separator); SQL_LIST *is_order,String *is_separator);
Item_func_group_concat(THD *thd, Item_func_group_concat *item) 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(); ~Item_func_group_concat();
void cleanup(); void cleanup();
enum Sumfunctype sum_func () const {return GROUP_CONCAT_FUNC;} enum Sumfunctype sum_func () const {return GROUP_CONCAT_FUNC;}
const char *func_name() const { return "group_concat"; } 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; } virtual Item_result result_type () const { return STRING_RESULT; }
void clear(); void clear();
bool add(); bool add();

View File

@ -122,6 +122,7 @@ static SYMBOL symbols[] = {
{ "CURRENT_DATE", SYM(CURDATE)}, { "CURRENT_DATE", SYM(CURDATE)},
{ "CURRENT_TIME", SYM(CURTIME)}, { "CURRENT_TIME", SYM(CURTIME)},
{ "CURRENT_TIMESTAMP", SYM(NOW_SYM)}, { "CURRENT_TIMESTAMP", SYM(NOW_SYM)},
{ "CURRENT_USER", SYM(CURRENT_USER)},
{ "DATA", SYM(DATA_SYM)}, { "DATA", SYM(DATA_SYM)},
{ "DATABASE", SYM(DATABASE)}, { "DATABASE", SYM(DATABASE)},
{ "DATABASES", SYM(DATABASES)}, { "DATABASES", SYM(DATABASES)},
@ -481,7 +482,6 @@ static SYMBOL sql_functions[] = {
{ "CAST", SYM(CAST_SYM)}, { "CAST", SYM(CAST_SYM)},
{ "CEIL", F_SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ceiling)}, { "CEIL", F_SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ceiling)},
{ "CEILING", 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)}, { "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)}, { "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)}, { "CHAR_LENGTH", F_SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_char_length)},

View File

@ -507,7 +507,6 @@ int MYSQL_LOG::find_log_pos(LOG_INFO *linfo, const char *log_name,
RETURN VALUES RETURN VALUES
0 ok 0 ok
LOG_INFO_EOF End of log-index-file found 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 LOG_INFO_IO Got IO error while reading file
*/ */

View File

@ -83,7 +83,7 @@ inline int ignored_error_code(int err_code)
pretty_print_str() pretty_print_str()
*/ */
#ifndef MYSQL_CLIENT #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
static char *pretty_print_str(char *packet, char *str, int len) static char *pretty_print_str(char *packet, char *str, int len)
{ {
char *end= str + len; char *end= str + len;

View File

@ -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 strmov(fn_ext(pidfile_name),".pid"); // Add proper extension
#ifndef DBUG_OFF #ifndef DBUG_OFF
if (*(MYSQL_SERVER_SUFFIX)) if (!*(MYSQL_SERVER_SUFFIX))
strxmov(strend(server_version),MYSQL_SERVER_SUFFIX,"-debug",NullS); strmov(strend(server_version),"-debug");
else else
strmov(strend(server_version),"--debug");
#else
strmov(strend(server_version),MYSQL_SERVER_SUFFIX);
#endif #endif
strmov(strend(server_version),MYSQL_SERVER_SUFFIX);
load_defaults(conf_file_name, groups, &argc, &argv); load_defaults(conf_file_name, groups, &argc, &argv);
defaults_argv=argv; defaults_argv=argv;
@ -2364,9 +2362,8 @@ Now disabling --log-slave-updates.");
{ {
if (global_system_variables.log_warnings) if (global_system_variables.log_warnings)
sql_print_error("Warning: Failed to lock memory. Errno: %d\n",errno); sql_print_error("Warning: Failed to lock memory. Errno: %d\n",errno);
locked_in_memory= 0;
} }
else
locked_in_memory=1;
} }
#else #else
locked_in_memory=0; locked_in_memory=0;
@ -2530,6 +2527,8 @@ int main(int argc, char **argv)
} }
} }
#endif #endif
thread_stack_min=thread_stack - STACK_MIN_SIZE;
(void) thr_setconcurrency(concurrency); // 10 by default (void) thr_setconcurrency(concurrency); // 10 by default
/* /*

View File

@ -166,10 +166,10 @@ net_printf(THD *thd, uint errcode, ...)
const char *format; const char *format;
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
const char *text_pos; const char *text_pos;
int head_length= NET_HEADER_SIZE;
#else #else
char text_pos[1024]; char text_pos[1024];
#endif #endif
int head_length= NET_HEADER_SIZE;
NET *net= &thd->net; NET *net= &thd->net;
DBUG_ENTER("net_printf"); DBUG_ENTER("net_printf");
@ -530,7 +530,10 @@ bool Protocol::send_fields(List<Item> *list, uint flag)
/* Store fixed length fields */ /* Store fixed length fields */
pos= (char*) local_packet->ptr()+local_packet->length(); pos= (char*) local_packet->ptr()+local_packet->length();
*pos++= 12; // Length of packed fields *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); int4store(pos+2, field.length);
pos[6]= field.type; pos[6]= field.type;
int2store(pos+7,field.flags); int2store(pos+7,field.flags);

View File

@ -839,7 +839,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); char *res= 0, *old_value=(char *)(var ? var->value->str_value.ptr() : 0);
uint new_length= (var ? var->value->str_value.length() : 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)))) if (!(res= my_strdup_with_length(old_value, new_length, MYF(0))))
return 1; return 1;
/* /*

View File

@ -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 In this case, we will use the same IO_CACHE pointer to
read data as the IO thread is using to write data. 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 && rli->cur_log= rli->relay_log.get_log_file();
check_binlog_magic(rli->cur_log,errmsg)) if (my_b_tell(rli->cur_log) == 0 &&
check_binlog_magic(rli->cur_log, errmsg))
goto err; goto err;
rli->cur_log_old_open_count=rli->relay_log.get_open_count(); rli->cur_log_old_open_count=rli->relay_log.get_open_count();
} }
@ -1673,7 +1674,18 @@ int init_master_info(MASTER_INFO* mi, const char* master_info_fname,
DBUG_ENTER("init_master_info"); DBUG_ENTER("init_master_info");
if (mi->inited) 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); DBUG_RETURN(0);
}
mi->mysql=0; mi->mysql=0;
mi->file_id=1; mi->file_id=1;
fn_format(fname, master_info_fname, mysql_data_home, "", 4+32); fn_format(fname, master_info_fname, mysql_data_home, "", 4+32);
@ -3617,13 +3629,16 @@ int queue_event(MASTER_INFO* mi,const char* buf, ulong event_len)
mi->master_log_pos+= inc_pos; 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)); 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)))) if (likely(!(error= rli->relay_log.appendv(buf,event_len,0))))
{ {
mi->master_log_pos+= inc_pos; mi->master_log_pos+= inc_pos;
DBUG_PRINT("info", ("master_log_pos: %d", (ulong) mi->master_log_pos)); DBUG_PRINT("info", ("master_log_pos: %d", (ulong) mi->master_log_pos));
rli->relay_log.harvest_bytes_written(&rli->log_space_total); rli->relay_log.harvest_bytes_written(&rli->log_space_total);
} }
}
err: err:
pthread_mutex_unlock(&mi->data_lock); pthread_mutex_unlock(&mi->data_lock);
@ -4091,8 +4106,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)) if (rli->relay_log.is_active(rli->linfo.log_file_name))
{ {
#ifdef EXTRA_DEBUG #ifdef EXTRA_DEBUG
sql_print_error("next log '%s' is currently active", if (global_system_variables.log_warnings)
rli->linfo.log_file_name); sql_print_error("next log '%s' is currently active",
rli->linfo.log_file_name);
#endif #endif
rli->cur_log= cur_log= rli->relay_log.get_log_file(); rli->cur_log= cur_log= rli->relay_log.get_log_file();
rli->cur_log_old_open_count= rli->relay_log.get_open_count(); rli->cur_log_old_open_count= rli->relay_log.get_open_count();
@ -4120,8 +4136,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. from hot to cold, but not from cold to hot). No need for LOCK_log.
*/ */
#ifdef EXTRA_DEBUG #ifdef EXTRA_DEBUG
sql_print_error("next log '%s' is not active", if (global_system_variables.log_warnings)
rli->linfo.log_file_name); sql_print_error("next log '%s' is not active",
rli->linfo.log_file_name);
#endif #endif
// open_binlog() will check the magic header // open_binlog() will check the magic header
if ((rli->cur_log_fd=open_binlog(cur_log,rli->linfo.log_file_name, if ((rli->cur_log_fd=open_binlog(cur_log,rli->linfo.log_file_name,

View File

@ -1807,7 +1807,7 @@ Field *find_field_in_table(THD *thd,TABLE *table,const char *name,uint length,
if (cached_field_index < table->fields && if (cached_field_index < table->fields &&
!my_strcasecmp(system_charset_info, !my_strcasecmp(system_charset_info,
table->field[cached_field_index]->field_name, name)) 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) else if (table->name_hash.records)
field_ptr= (Field**)hash_search(&table->name_hash,(byte*) name, field_ptr= (Field**)hash_search(&table->name_hash,(byte*) name,
length); length);

View File

@ -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) // It is success (nobody can prevent us write data)
STRUCT_UNLOCK(&structure_guard_mutex); STRUCT_UNLOCK(&structure_guard_mutex);
byte *rest = (byte*) data;
Query_cache_block *block = *result_block;
uint headers_len = (ALIGN_SIZE(sizeof(Query_cache_block)) + uint headers_len = (ALIGN_SIZE(sizeof(Query_cache_block)) +
ALIGN_SIZE(sizeof(Query_cache_result))); ALIGN_SIZE(sizeof(Query_cache_result)));
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
Query_cache_block *block= *result_block;
byte *rest= (byte*) data;
// Now fill list of blocks that created by allocate_data_chain // Now fill list of blocks that created by allocate_data_chain
do do
{ {

View File

@ -115,7 +115,6 @@ static int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit,
TABLE *table; TABLE *table;
int res; int res;
select_union *derived_result; select_union *derived_result;
TABLE_LIST *tables= (TABLE_LIST *)first_select->table_list.first;
bool is_union= first_select->next_select() && bool is_union= first_select->next_select() &&
first_select->next_select()->linkage == UNION_TYPE; first_select->next_select()->linkage == UNION_TYPE;
bool is_subsel= first_select->first_inner_unit() ? 1: 0; bool is_subsel= first_select->first_inner_unit() ? 1: 0;

View File

@ -21,12 +21,14 @@
#include "sql_acl.h" #include "sql_acl.h"
static int check_null_fields(THD *thd,TABLE *entry); static int check_null_fields(THD *thd,TABLE *entry);
#ifndef EMBEDDED_LIBRARY
static TABLE *delayed_get_table(THD *thd,TABLE_LIST *table_list); static TABLE *delayed_get_table(THD *thd,TABLE_LIST *table_list);
static int write_delayed(THD *thd,TABLE *table, enum_duplicates dup, static int write_delayed(THD *thd,TABLE *table, enum_duplicates dup,
char *query, uint query_length, int log_on); char *query, uint query_length, int log_on);
static void end_delayed_insert(THD *thd); static void end_delayed_insert(THD *thd);
extern "C" pthread_handler_decl(handle_delayed_insert,arg); extern "C" pthread_handler_decl(handle_delayed_insert,arg);
static void unlink_blobs(register TABLE *table); static void unlink_blobs(register TABLE *table);
#endif
/* Define to force use of my_malloc() if the allocated memory block is big */ /* 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; TABLE *table;
List_iterator_fast<List_item> its(values_list); List_iterator_fast<List_item> its(values_list);
List_item *values; List_item *values;
char *query=thd->query; #ifndef EMBEDDED_LIBRARY
char *query= thd->query;
#endif
thr_lock_type lock_type = table_list->lock_type; thr_lock_type lock_type = table_list->lock_type;
TABLE_LIST *insert_table_list= (TABLE_LIST*) TABLE_LIST *insert_table_list= (TABLE_LIST*)
thd->lex->select_lex.table_list.first; thd->lex->select_lex.table_list.first;

View File

@ -1389,7 +1389,7 @@ create_total_list_n_last_return(THD *thd_arg,
} }
} }
} }
end:
if (slave_list_first) if (slave_list_first)
{ {
*new_table_list= slave_list_first; *new_table_list= slave_list_first;

View File

@ -396,6 +396,7 @@ public:
SQL_LIST order_list; /* ORDER clause */ SQL_LIST order_list; /* ORDER clause */
List<List_item> expr_list; List<List_item> expr_list;
List<List_item> when_list; /* WHEN clause (expression) */ List<List_item> when_list; /* WHEN clause (expression) */
SQL_LIST *gorder_list;
ha_rows select_limit, offset_limit; /* LIMIT clause parameters */ ha_rows select_limit, offset_limit; /* LIMIT clause parameters */
// Arrays of pointers to top elements of all_fields list // Arrays of pointers to top elements of all_fields list
Item **ref_pointer_array; Item **ref_pointer_array;
@ -538,7 +539,6 @@ typedef struct st_lex
gptr yacc_yyss,yacc_yyvs; gptr yacc_yyss,yacc_yyvs;
THD *thd; THD *thd;
CHARSET_INFO *charset; CHARSET_INFO *charset;
SQL_LIST *gorder_list;
List<key_part_spec> col_list; List<key_part_spec> col_list;
List<key_part_spec> ref_list; List<key_part_spec> ref_list;

View File

@ -48,7 +48,9 @@
extern "C" int gethostname(char *name, int namelen); extern "C" int gethostname(char *name, int namelen);
#endif #endif
#ifndef NO_EMBEDDED_ACCESS_CHECKS
static int check_for_max_user_connections(THD *thd, USER_CONN *uc); static int check_for_max_user_connections(THD *thd, USER_CONN *uc);
#endif
static void decrease_user_connections(USER_CONN *uc); static void decrease_user_connections(USER_CONN *uc);
static bool check_db_used(THD *thd,TABLE_LIST *tables); static bool check_db_used(THD *thd,TABLE_LIST *tables);
static bool check_merge_table_access(THD *thd, char *db, 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 1 error
*/ */
#ifndef NO_EMBEDDED_ACCESS_CHECKS
static int check_for_max_user_connections(THD *thd, USER_CONN *uc) static int check_for_max_user_connections(THD *thd, USER_CONN *uc)
{ {
int error=0; 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); (void) pthread_mutex_unlock(&LOCK_user_conn);
DBUG_RETURN(error); DBUG_RETURN(error);
} }
#endif /* NO_EMBEDDED_ACCESS_CHECKS */
/* /*
Decrease user connection count 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) static bool check_mqh(THD *thd, uint check_command)
{ {
#ifdef NO_EMBEDDED_ACCESS_CHECKS
return(0);
#else
bool error=0; bool error=0;
time_t check_time = thd->start_time ? thd->start_time : time(NULL); time_t check_time = thd->start_time ? thd->start_time : time(NULL);
USER_CONN *uc=thd->user_connect; USER_CONN *uc=thd->user_connect;
DBUG_ENTER("check_mqh"); DBUG_ENTER("check_mqh");
DBUG_ASSERT(uc != 0); 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 more than a hour since last check, reset resource checking */
if (check_time - uc->intime >= 3600) if (check_time - uc->intime >= 3600)
{ {
@ -3158,7 +3162,7 @@ unsent_create_error:
net_printf(thd,ER_WRONG_DB_NAME, lex->name); net_printf(thd,ER_WRONG_DB_NAME, lex->name);
break; break;
} }
if (check_access(thd,DROP_ACL,lex->name,0,1,0)) if (check_access(thd,SELECT_ACL,lex->name,0,1,0))
break; break;
if (thd->locked_tables || thd->active_transaction()) if (thd->locked_tables || thd->active_transaction())
{ {
@ -3548,7 +3552,10 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
DBUG_ENTER("check_access"); DBUG_ENTER("check_access");
DBUG_PRINT("enter",("want_access: %lu master_access: %lu", want_access, DBUG_PRINT("enter",("want_access: %lu master_access: %lu", want_access,
thd->master_access)); thd->master_access));
ulong db_access,dummy; #ifndef NO_EMBEDDED_ACCESS_CHECKS
ulong db_access;
#endif
ulong dummy;
if (save_priv) if (save_priv)
*save_priv=0; *save_priv=0;
else else
@ -3740,6 +3747,10 @@ static bool check_db_used(THD *thd,TABLE_LIST *tables)
#define used_stack(A,B) (long) (B - A) #define used_stack(A,B) (long) (B - A)
#endif #endif
#ifndef DBUG_OFF
long max_stack_used;
#endif
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
bool check_stack_overrun(THD *thd,char *buf __attribute__((unused))) bool check_stack_overrun(THD *thd,char *buf __attribute__((unused)))
{ {
@ -3752,6 +3763,9 @@ bool check_stack_overrun(THD *thd,char *buf __attribute__((unused)))
thd->fatal_error(); thd->fatal_error();
return 1; return 1;
} }
#ifndef DBUG_OFF
max_stack_used= max(max_stack_used, stack_used);
#endif
return 0; return 0;
} }
#endif /* EMBEDDED_LIBRARY */ #endif /* EMBEDDED_LIBRARY */

View File

@ -802,7 +802,7 @@ static int mysql_test_select_fields(Prepared_statement *stmt,
if (check_table_access(thd, privilege, tables,0)) if (check_table_access(thd, privilege, tables,0))
DBUG_RETURN(1); 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); DBUG_RETURN(1);
#endif #endif
if ((&lex->select_lex != lex->all_selects_list && if ((&lex->select_lex != lex->all_selects_list &&
@ -1123,9 +1123,10 @@ static void reset_stmt_for_execute(Prepared_statement *stmt)
void mysql_stmt_execute(THD *thd, char *packet, uint packet_length) void mysql_stmt_execute(THD *thd, char *packet, uint packet_length)
{ {
ulong stmt_id= uint4korr(packet); ulong stmt_id= uint4korr(packet);
#ifndef EMBEDDED_LIBRARY
uchar *packet_end= (uchar *) packet + packet_length - 1; uchar *packet_end= (uchar *) packet + packet_length - 1;
#endif
Prepared_statement *stmt; Prepared_statement *stmt;
DBUG_ENTER("mysql_stmt_execute"); DBUG_ENTER("mysql_stmt_execute");
packet+= 9; /* stmt_id + 5 bytes of flags */ packet+= 9; /* stmt_id + 5 bytes of flags */

View File

@ -3610,7 +3610,6 @@ static void
make_join_readinfo(JOIN *join, uint options) make_join_readinfo(JOIN *join, uint options)
{ {
uint i; uint i;
SELECT_LEX *select_lex= &join->thd->lex->select_lex;
bool statistics= test(!(join->select_options & SELECT_DESCRIBE)); bool statistics= test(!(join->select_options & SELECT_DESCRIBE));
DBUG_ENTER("make_join_readinfo"); DBUG_ENTER("make_join_readinfo");
@ -3880,9 +3879,7 @@ JOIN::join_free(bool full)
else else
{ {
for (tab= join_tab, end= tab+tables; tab != end; tab++) for (tab= join_tab, end= tab+tables; tab != end; tab++)
{
tab->cleanup(); tab->cleanup();
}
table= 0; table= 0;
} }
} }
@ -4789,7 +4786,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
else else
return new Field_double(item_sum->max_length,maybe_null, return new Field_double(item_sum->max_length,maybe_null,
item->name, table, item_sum->decimals); 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: case Item_sum::STD_FUNC:
if (group) if (group)
return new Field_string(sizeof(double)*2+sizeof(longlong), return new Field_string(sizeof(double)*2+sizeof(longlong),
@ -4817,17 +4814,19 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
default: default:
// This case should never be choosen // This case should never be choosen
DBUG_ASSERT(0); DBUG_ASSERT(0);
thd->fatal_error();
return 0; return 0;
} }
} }
thd->fatal_error(); /* We never come here */
return 0; // Error
} }
case Item::FIELD_ITEM: case Item::FIELD_ITEM:
case Item::DEFAULT_VALUE_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); item, table, modify_item);
}
case Item::FUNC_ITEM: case Item::FUNC_ITEM:
case Item::COND_ITEM: case Item::COND_ITEM:
case Item::FIELD_AVG_ITEM: case Item::FIELD_AVG_ITEM:
@ -8405,12 +8404,11 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
Item *pos; Item *pos;
List_iterator_fast<Item> li(all_fields); List_iterator_fast<Item> li(all_fields);
Copy_field *copy; Copy_field *copy;
DBUG_ENTER("setup_copy_fields");
res_selected_fields.empty(); res_selected_fields.empty();
res_all_fields.empty(); res_all_fields.empty();
List_iterator_fast<Item> itr(res_all_fields); List_iterator_fast<Item> itr(res_all_fields);
uint i, border= all_fields.elements - elements; uint i, border= all_fields.elements - elements;
DBUG_ENTER("setup_copy_fields");
if (!(copy=param->copy_field= new Copy_field[param->field_count])) if (!(copy=param->copy_field= new Copy_field[param->field_count]))
goto err2; goto err2;
@ -8545,6 +8543,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<Item> &field_list, List<Item> &send_fields, bool JOIN::make_sum_func_list(List<Item> &field_list, List<Item> &send_fields,
bool before_group_by) bool before_group_by)
{ {
@ -8581,7 +8596,7 @@ bool JOIN::make_sum_func_list(List<Item> &field_list, List<Item> &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. new list of all items.
change_to_use_tmp_fields() change_to_use_tmp_fields()
@ -9081,7 +9096,6 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
List<Item> field_list; List<Item> field_list;
List<Item> item_list; List<Item> item_list;
THD *thd=join->thd; THD *thd=join->thd;
SELECT_LEX *select_lex= &join->thd->lex->select_lex;
select_result *result=join->result; select_result *result=join->result;
Item *item_null= new Item_null(); Item *item_null= new Item_null();
CHARSET_INFO *cs= &my_charset_latin1; CHARSET_INFO *cs= &my_charset_latin1;

View File

@ -31,9 +31,11 @@ static const char *grant_names[]={
"select","insert","update","delete","create","drop","reload","shutdown", "select","insert","update","delete","create","drop","reload","shutdown",
"process","file","grant","references","index","alter"}; "process","file","grant","references","index","alter"};
#ifndef NO_EMBEDDED_ACCESS_CHECKS
static TYPELIB grant_types = { sizeof(grant_names)/sizeof(char **), static TYPELIB grant_types = { sizeof(grant_names)/sizeof(char **),
"grant_types", "grant_types",
grant_names}; grant_names};
#endif
static int mysql_find_files(THD *thd,List<char> *files, const char *db, static int mysql_find_files(THD *thd,List<char> *files, const char *db,
const char *path, const char *wild, bool dir); const char *path, const char *wild, bool dir);
@ -367,7 +369,9 @@ mysql_find_files(THD *thd,List<char> *files, const char *db,const char *path,
char *ext; char *ext;
MY_DIR *dirp; MY_DIR *dirp;
FILEINFO *file; FILEINFO *file;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
uint col_access=thd->col_access; uint col_access=thd->col_access;
#endif
TABLE_LIST table_list; TABLE_LIST table_list;
DBUG_ENTER("mysql_find_files"); DBUG_ENTER("mysql_find_files");
@ -829,7 +833,9 @@ int mysqld_show_create_db(THD *thd, char *dbname,
char path[FN_REFLEN]; char path[FN_REFLEN];
char buff[2048]; char buff[2048];
String buffer(buff, sizeof(buff), system_charset_info); String buffer(buff, sizeof(buff), system_charset_info);
#ifndef NO_EMBEDDED_ACCESS_CHECKS
uint db_access; uint db_access;
#endif
bool found_libchar; bool found_libchar;
HA_CREATE_INFO create; HA_CREATE_INFO create;
uint create_options = create_info ? create_info->options : 0; uint create_options = create_info ? create_info->options : 0;
@ -1138,7 +1144,6 @@ append_identifier(THD *thd, String *packet, const char *name, uint length)
{ {
const char *name_end; const char *name_end;
char quote_char; char quote_char;
uint part_len;
if (thd->variables.sql_mode & MODE_ANSI_QUOTES) if (thd->variables.sql_mode & MODE_ANSI_QUOTES)
quote_char= '\"'; quote_char= '\"';
@ -1274,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 more standard
*/ */
has_now_default= table->timestamp_field == field && has_now_default= table->timestamp_field == field &&

View File

@ -628,15 +628,15 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
if (!timestamps) if (!timestamps)
{ {
sql_field->unireg_check= Field::TIMESTAMP_DNUN_FIELD; sql_field->unireg_check= Field::TIMESTAMP_DNUN_FIELD;
++timestamps_with_niladic; timestamps_with_niladic++;
} }
else else
sql_field->unireg_check= Field::NONE; sql_field->unireg_check= Field::NONE;
} }
else if(sql_field->unireg_check != Field::NONE) else if (sql_field->unireg_check != Field::NONE)
++timestamps_with_niladic; timestamps_with_niladic++;
++timestamps; timestamps++;
/* fall-through */ /* fall-through */
default: default:
sql_field->pack_flag=(FIELDFLAG_NUMBER | sql_field->pack_flag=(FIELDFLAG_NUMBER |
@ -1963,11 +1963,6 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table,
/* /*
Create a new table by copying from source 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))) if (my_copy(src_path, dst_path, MYF(MY_WME|MY_DONT_OVERWRITE_FILE)))
goto err; goto err;

View File

@ -210,6 +210,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token CONCURRENT %token CONCURRENT
%token CONSTRAINT %token CONSTRAINT
%token CONVERT_SYM %token CONVERT_SYM
%token CURRENT_USER
%token DATABASES %token DATABASES
%token DATA_SYM %token DATA_SYM
%token DEFAULT %token DEFAULT
@ -2684,6 +2685,8 @@ simple_expr:
$$= new Item_func_curtime_local($3); $$= new Item_func_curtime_local($3);
Lex->safe_to_cache_query=0; Lex->safe_to_cache_query=0;
} }
| CURRENT_USER optional_braces
{ $$= create_func_current_user(); }
| DATE_ADD_INTERVAL '(' expr ',' interval_expr interval ')' | DATE_ADD_INTERVAL '(' expr ',' interval_expr interval ')'
{ $$= new Item_date_add_interval($3,$5,$6,0); } { $$= new Item_date_add_interval($3,$5,$6,0); }
| DATE_SUB_INTERVAL '(' expr ',' interval_expr interval ')' | DATE_SUB_INTERVAL '(' expr ',' interval_expr interval ')'
@ -3060,11 +3063,15 @@ sum_expr:
{ $$=new Item_sum_variance($3); } { $$=new Item_sum_variance($3); }
| SUM_SYM '(' in_sum_expr ')' | SUM_SYM '(' in_sum_expr ')'
{ $$=new Item_sum_sum($3); } { $$=new Item_sum_sum($3); }
| GROUP_CONCAT_SYM '(' opt_distinct expr_list opt_gorder_clause | GROUP_CONCAT_SYM '(' opt_distinct
opt_gconcat_separator ')' { Select->in_sum_expr++; }
expr_list opt_gorder_clause
opt_gconcat_separator
')'
{ {
$$=new Item_func_group_concat($3,$4,Lex->gorder_list,$6); Select->in_sum_expr--;
$4->empty(); $$=new Item_func_group_concat($3,$5,Select->gorder_list,$7);
$5->empty();
}; };
opt_distinct: opt_distinct:
@ -3079,16 +3086,15 @@ opt_gconcat_separator:
opt_gorder_clause: opt_gorder_clause:
/* empty */ /* empty */
{ {
LEX *lex=Lex; Select->gorder_list = NULL;
lex->gorder_list = NULL;
} }
| order_clause | order_clause
{ {
LEX *lex=Lex; SELECT_LEX *select= Select;
lex->gorder_list= select->gorder_list=
(SQL_LIST*) sql_memdup((char*) &lex->current_select->order_list, (SQL_LIST*) sql_memdup((char*) &select->order_list,
sizeof(st_sql_list)); sizeof(st_sql_list));
lex->current_select->order_list.empty(); select->order_list.empty();
}; };
@ -4170,6 +4176,29 @@ show_param:
{ Lex->sql_command= SQLCOM_SHOW_LOGS; WARN_DEPRECATED("SHOW BDB LOGS", "SHOW ENGINE BDB LOGS"); } { Lex->sql_command= SQLCOM_SHOW_LOGS; WARN_DEPRECATED("SHOW BDB LOGS", "SHOW ENGINE BDB LOGS"); }
| LOGS_SYM | LOGS_SYM
{ Lex->sql_command= SQLCOM_SHOW_LOGS; WARN_DEPRECATED("SHOW LOGS", "SHOW ENGINE BDB LOGS"); } { 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 | GRANTS FOR_SYM user
{ {
LEX *lex=Lex; LEX *lex=Lex;
@ -4760,7 +4789,25 @@ user:
if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user)))) if (!($$=(LEX_USER*) thd->alloc(sizeof(st_lex_user))))
YYABORT; YYABORT;
$$->user = $1; $$->host=$3; $$->user = $1; $$->host=$3;
}; }
| CURRENT_USER optional_braces
{
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 */ /* Keyword that we allow for identifiers */

View File

@ -465,7 +465,6 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
goto err_not_open; /* purecov: inspected */ goto err_not_open; /* purecov: inspected */
} }
reg_field->comment=comment; reg_field->comment=comment;
reg_field->set_charset(charset);
if (!(reg_field->flags & NOT_NULL_FLAG)) if (!(reg_field->flags & NOT_NULL_FLAG))
{ {
if ((null_bit<<=1) == 256) if ((null_bit<<=1) == 256)
@ -1288,7 +1287,7 @@ bool check_db_name(char *name)
/* Used to catch empty names and names with end space */ /* Used to catch empty names and names with end space */
bool last_char_is_space= TRUE; 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); my_casedn_str(files_charset_info, name);
while (*name) while (*name)