diff options
108 files changed, 1119 insertions, 1422 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index 0b6485172e4..b249ccbfbc5 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -133,7 +133,8 @@ static my_bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0, opt_compress=0, using_opt_local_infile=0, vertical=0, line_numbers=1, column_names=1,opt_html=0, opt_xml=0,opt_nopager=1, opt_outfile=0, named_cmds= 0, - tty_password= 0, opt_nobeep=0, opt_reconnect=1; + tty_password= 0, opt_nobeep=0, opt_reconnect=1, + default_charset_used= 0; static uint verbose=0,opt_silent=0,opt_mysql_port=0, opt_local_infile=0; static my_string opt_mysql_unix_port=0; static int connect_flag=CLIENT_INTERACTIVE; @@ -651,6 +652,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), strmov(mysql_charsets_dir, argument); charsets_dir = mysql_charsets_dir; break; + case OPT_DEFAULT_CHARSET: + default_charset_used= 1; + break; case OPT_DELIMITER: if (argument == disabled_my_option) strmov(delimiter, DEFAULT_DELIMITER); @@ -2563,7 +2567,8 @@ sql_real_connect(char *host,char *database,char *user,char *password, select_limit,max_join_size); mysql_options(&mysql, MYSQL_INIT_COMMAND, init_command); } - mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset); + if (default_charset_used) + mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset); if (!mysql_real_connect(&mysql, host, user, password, database, opt_mysql_port, opt_mysql_unix_port, connect_flag | CLIENT_MULTI_QUERIES)) diff --git a/client/mysqltest.c b/client/mysqltest.c index a3b5facae9c..3b814b27810 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -722,8 +722,8 @@ int do_wait_for_slave_to_stop(struct st_query* q __attribute__((unused))) int done; LINT_INIT(res); - if (mysql_query(mysql,"show status like 'Slave_running'") - || !(res=mysql_store_result(mysql))) + if (mysql_query(mysql,"show status like 'Slave_running'") || + !(res=mysql_store_result(mysql))) die("Query failed while probing slave for stop: %s", mysql_error(mysql)); if (!(row=mysql_fetch_row(res)) || !row[1]) @@ -2183,19 +2183,21 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags) goto end; /* Ok */ } } + DBUG_PRINT("info",("i: %d expected_errors: %d", i, q->expected_errors)); + dynstr_append_mem(ds,"ERROR ",6); + replace_dynstr_append_mem(ds, mysql_sqlstate(mysql), + strlen(mysql_sqlstate(mysql))); + dynstr_append_mem(ds,": ",2); + replace_dynstr_append_mem(ds, mysql_error(mysql), + strlen(mysql_error(mysql))); + dynstr_append_mem(ds,"\n",1); if (i) { - replace_dynstr_append_mem(ds, mysql_error(mysql), - strlen(mysql_error(mysql))); - dynstr_append_mem(ds,"\n",1); verbose_msg("query '%s' failed with wrong errno %d instead of %d...", q->query, mysql_errno(mysql), q->expected_errno[0]); - error=1; + error= 1; goto end; } - replace_dynstr_append_mem(ds,mysql_error(mysql), - strlen(mysql_error(mysql))); - dynstr_append_mem(ds,"\n",1); verbose_msg("query '%s' failed: %d: %s", q->query, mysql_errno(mysql), mysql_error(mysql)); /* @@ -2608,7 +2610,8 @@ int main(int argc, char **argv) } dynstr_free(&ds_res); - if (!silent) { + if (!silent) + { if (error) printf("not ok\n"); else diff --git a/heap/hp_create.c b/heap/hp_create.c index 5265607ce53..02725576c8f 100644 --- a/heap/hp_create.c +++ b/heap/hp_create.c @@ -50,6 +50,7 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef, length+= keyinfo->seg[j].length; if (keyinfo->seg[j].null_bit) { + length++; if (!(keyinfo->flag & HA_NULL_ARE_EQUAL)) keyinfo->flag|= HA_NULL_PART_KEY; if (keyinfo->algorithm == HA_KEY_ALG_BTREE) diff --git a/include/m_ctype.h b/include/m_ctype.h index f6b5a1ca44f..4ae6734a48c 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -79,7 +79,7 @@ enum my_lex_states { MY_LEX_START, MY_LEX_CHAR, MY_LEX_IDENT, MY_LEX_IDENT_SEP, MY_LEX_IDENT_START, - MY_LEX_FOUND_IDENT, MY_LEX_SIGNED_NUMBER, MY_LEX_REAL, MY_LEX_HEX_NUMBER, + MY_LEX_FOUND_IDENT, MY_LEX_REAL, MY_LEX_HEX_NUMBER, MY_LEX_CMP_OP, MY_LEX_LONG_CMP_OP, MY_LEX_STRING, MY_LEX_COMMENT, MY_LEX_END, MY_LEX_OPERATOR_OR_IDENT, MY_LEX_NUMBER_IDENT, MY_LEX_INT_OR_REAL, MY_LEX_REAL_OR_POINT, MY_LEX_BOOL, MY_LEX_EOL, MY_LEX_ESCAPE, diff --git a/include/my_global.h b/include/my_global.h index 98f666548a5..0e576730ca3 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -742,9 +742,6 @@ typedef unsigned __int64 my_ulonglong; typedef unsigned long long my_ulonglong; #endif -/* typedef used for length of string; Should be unsigned! */ -typedef ulong size_str; - #ifdef USE_RAID /* The following is done with a if to not get problems with pre-processors diff --git a/include/mysql_com.h b/include/mysql_com.h index acfcd221432..b1c94e5c735 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -253,8 +253,8 @@ unsigned long my_net_read(NET *net); Currently it's used internally by manager.c */ struct sockaddr; -my_bool my_connect(my_socket s, const struct sockaddr *name, - unsigned int namelen, unsigned int timeout); +int my_connect(my_socket s, const struct sockaddr *name, unsigned int namelen, + unsigned int timeout); struct rand_struct { unsigned long seed1,seed2,max_value; diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 57613b68448..19cfedce51d 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -46,11 +46,10 @@ #ifdef HAVE_SYS_SELECT_H #include <sys/select.h> #endif -#endif +#endif /* !defined(MSDOS) && !defined(__WIN__) */ #ifdef HAVE_POLL #include <sys/poll.h> #endif -#endif /* !defined(MSDOS) && !defined(__WIN__) */ #ifdef HAVE_SYS_UN_H #include <sys/un.h> #endif diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am index e61e7833451..b22ff9e5001 100644 --- a/libmysqld/Makefile.am +++ b/libmysqld/Makefile.am @@ -26,7 +26,8 @@ DEFS = -DEMBEDDED_LIBRARY -DMYSQL_SERVER \ -DDATADIR="\"$(MYSQLDATAdir)\"" \ -DSHAREDIR="\"$(MYSQLSHAREdir)\"" INCLUDES= @MT_INCLUDES@ @bdb_includes@ -I$(top_srcdir)/include \ - -I$(top_srcdir)/sql -I$(top_srcdir)/regex + -I$(top_srcdir)/sql -I$(top_srcdir)/regex \ + $(openssl_includes) noinst_LIBRARIES = libmysqld_int.a pkglib_LIBRARIES = libmysqld.a diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result index 03cfcc50e17..8c898bae699 100644 --- a/mysql-test/r/auto_increment.result +++ b/mysql-test/r/auto_increment.result @@ -1,4 +1,5 @@ drop table if exists t1; +SET SQL_WARNINGS=1; create table t1 (a int not null auto_increment,b int, primary key (a)) type=myisam auto_increment=3; insert into t1 values (1,1),(NULL,3),(NULL,4); delete from t1 where a=4; @@ -130,7 +131,7 @@ last_insert_id() 255 insert into t1 set i = null; Warnings: -Warning 1262 Data truncated, out of range for column 'i' at row 1 +Warning 1263 Data truncated, out of range for column 'i' at row 1 select last_insert_id(); last_insert_id() 255 @@ -181,7 +182,7 @@ a b delete from t1 where a=0; update t1 set a=NULL where b=6; Warnings: -Warning 1261 Data truncated, NULL supplied to NOT NULL column 'a' at row 4 +Warning 1262 Data truncated, NULL supplied to NOT NULL column 'a' at row 4 update t1 set a=300 where b=7; SET SQL_MODE=''; insert into t1(a,b)values(NULL,8); @@ -223,7 +224,7 @@ a b delete from t1 where a=0; update t1 set a=NULL where b=13; Warnings: -Warning 1261 Data truncated, NULL supplied to NOT NULL column 'a' at row 9 +Warning 1262 Data truncated, NULL supplied to NOT NULL column 'a' at row 9 update t1 set a=500 where b=14; select * from t1 order by b; a b diff --git a/mysql-test/r/convert.result b/mysql-test/r/convert.result deleted file mode 100644 index f8dad8c69ba..00000000000 --- a/mysql-test/r/convert.result +++ /dev/null @@ -1,17 +0,0 @@ -select @@convert_character_set; -@@convert_character_set - -select @@global.convert_character_set; -@@global.convert_character_set - -show variables like "%convert_character_set%"; -Variable_name Value -convert_character_set -SET CHARACTER SET cp1251_koi8; -select @@convert_character_set; -@@convert_character_set -cp1251_koi8 -SET CHARACTER SET DEFAULT; -select @@convert_character_set; -@@convert_character_set - diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 2f907880cbe..b51836f39e0 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -10,7 +10,7 @@ create table t1 (b char(0) not null); create table if not exists t1 (b char(0) not null); insert into t1 values (""),(null); Warnings: -Warning 1261 Data truncated, NULL supplied to NOT NULL column 'b' at row 2 +Warning 1262 Data truncated, NULL supplied to NOT NULL column 'b' at row 2 select * from t1; b @@ -193,7 +193,7 @@ SELECT @@table_type; GEMINI CREATE TABLE t1 (a int not null); Warnings: -Warning 1264 Using storage engine MYISAM for table 't1' +Warning 1265 Using storage engine MYISAM for table 't1' show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -302,7 +302,7 @@ SELECT @@table_type; GEMINI CREATE TABLE t1 (a int not null); Warnings: -Warning 1264 Using storage engine MYISAM for table 't1' +Warning 1265 Using storage engine MYISAM for table 't1' show create table t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/r/ctype_latin1_de.result b/mysql-test/r/ctype_latin1_de.result index 7f116c1fc52..3db2f3d5519 100644 --- a/mysql-test/r/ctype_latin1_de.result +++ b/mysql-test/r/ctype_latin1_de.result @@ -1,3 +1,6 @@ +select @@collation_connection; +@@collation_connection +latin1_german2_ci drop table if exists t1; create table t1 (a char (20) not null, b int not null auto_increment, index (a,b)); insert into t1 (a) values ('ä'),('ac'),('ae'),('ad'),('Äc'),('aeb'); diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result index 3c6769e797b..c7ce157a670 100644 --- a/mysql-test/r/distinct.result +++ b/mysql-test/r/distinct.result @@ -173,9 +173,9 @@ INSERT INTO t2 values (1),(2),(3); INSERT INTO t3 VALUES (1,'1'),(2,'2'),(1,'1'),(2,'2'); explain SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 2 Using temporary -1 SIMPLE t2 ref a a 4 test.t1.a 2 Using index +1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 4 Using temporary 1 SIMPLE t3 ref a a 5 test.t1.b 2 Using where; Using index +1 SIMPLE t2 index a a 4 NULL 4 Using where; Using index; Distinct SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a; a 1 diff --git a/mysql-test/r/drop.result b/mysql-test/r/drop.result index 6029cc90d1d..367b28e9bf7 100644 --- a/mysql-test/r/drop.result +++ b/mysql-test/r/drop.result @@ -1,4 +1,5 @@ drop table if exists t1; +drop database if exists mysqltest; drop table t1; ERROR 42S02: Unknown table 't1' create table t1(n int); @@ -11,9 +12,6 @@ drop table t1; select * from t1; n 1 -drop database if exists mysqltest; -Warnings: -Note 1008 Can't drop database 'mysqltest'; database doesn't exist create database mysqltest; drop database if exists mysqltest; create database mysqltest; @@ -25,8 +23,6 @@ n drop database if exists mysqltest; create database mysqltest; drop database mysqltest; -Warnings: -Note 1008 Can't drop database 'mysqltest'; database doesn't exist flush tables with read lock; create database mysqltest; Got one of the listed errors diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result index 157beec2c01..e2d35973383 100644 --- a/mysql-test/r/fulltext.result +++ b/mysql-test/r/fulltext.result @@ -23,6 +23,36 @@ a b Only MyISAM tables support collections Full-text indexes are called collections Full-text indexes are called collections +explain select * from t1 where MATCH(a,b) AGAINST ("collections"); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 fulltext a a 0 1 Using where +explain select * from t1 where MATCH(a,b) AGAINST ("collections")>0; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 fulltext a a 0 1 Using where +explain select * from t1 where MATCH(a,b) AGAINST ("collections")>1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 fulltext a a 0 1 Using where +explain select * from t1 where MATCH(a,b) AGAINST ("collections")>=0; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +explain select * from t1 where MATCH(a,b) AGAINST ("collections")>=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 fulltext a a 0 1 Using where +explain select * from t1 where 0<MATCH(a,b) AGAINST ("collections"); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 fulltext a a 0 1 Using where +explain select * from t1 where 1<MATCH(a,b) AGAINST ("collections"); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 fulltext a a 0 1 Using where +explain select * from t1 where 0<=MATCH(a,b) AGAINST ("collections"); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using where +explain select * from t1 where 1<=MATCH(a,b) AGAINST ("collections"); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 fulltext a a 0 1 Using where +explain select * from t1 where MATCH(a,b) AGAINST ("collections")>0 and a like '%ll%'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 fulltext a a 0 1 Using where select * from t1 where MATCH(a,b) AGAINST("support -collections" IN BOOLEAN MODE); a b MySQL has now support for full-text search @@ -97,6 +127,11 @@ select * from t1 where MATCH b AGAINST ("sear*" IN BOOLEAN MODE); a b MySQL has now support for full-text search Function MATCH ... AGAINST() is used to do a search +select * from t1 where MATCH(a,b) AGAINST ("collections") UNION ALL select * from t1 where MATCH(a,b) AGAINST ("indexes"); +a b +Only MyISAM tables support collections +Full-text indexes are called collections +Full-text indexes are called collections delete from t1 where a like "MySQL%"; update t1 set a='some test foobar' where MATCH a,b AGAINST ('model'); delete from t1 where MATCH(a,b) AGAINST ("indexes"); @@ -226,3 +261,14 @@ select ref_mag from t1 where match ref_mag against ('+test' in boolean mode); ref_mag test drop table t1; +create table t1 (t1_id int(11) primary key, name varchar(32)); +insert into t1 values (1, 'data1'); +insert into t1 values (2, 'data2'); +create table t2 (t2_id int(11) primary key, t1_id int(11), name varchar(32)); +insert into t2 values (1, 1, 'xxfoo'); +insert into t2 values (2, 1, 'xxbar'); +insert into t2 values (3, 1, 'xxbuz'); +select * from t1 join t2 using(`t1_id`) where match (t1.name, t2.name) against('xxfoo' in boolean mode); +t1_id name t2_id t1_id name +1 data1 1 1 xxfoo +drop table t1,t2; diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result index 15b406bcdda..a4493e7c95c 100644 --- a/mysql-test/r/func_gconcat.result +++ b/mysql-test/r/func_gconcat.result @@ -148,10 +148,10 @@ grp group_concat(c) 4 5 NULL Warnings: -Warning 1258 1 line(s) was(were) cut by group_concat() +Warning 1259 1 line(s) was(were) cut by group_concat() show warnings; Level Code Message -Warning 1258 1 line(s) was(were) cut by group_concat() +Warning 1259 1 line(s) was(were) cut by group_concat() set group_concat_max_len = 1024; select group_concat(sum(a)) from t1 group by grp; ERROR HY000: Invalid use of group function diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index 06f63b525cd..82f68cdaa84 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -496,7 +496,7 @@ insert(_latin2'abcd',2,3,_latin2'ef'), replace(_latin2'abcd',_latin2'b',_latin2'B') ; Warnings: -Warning 1263 Data truncated for column 'format(130,10)' at row 1 +Warning 1264 Data truncated for column 'format(130,10)' at row 1 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -571,9 +571,7 @@ elt(status_wnio,data_podp) NULL NULL DROP TABLE t1; -CREATE TABLE t1 ( -title text -) TYPE=MyISAM; +CREATE TABLE t1 (title text) TYPE=MyISAM; INSERT INTO t1 VALUES ('Congress reconvenes in September to debate welfare and adult education'); INSERT INTO t1 VALUES ('House passes the CAREERS bill'); SELECT CONCAT("</a>",RPAD("",(55 - LENGTH(title)),".")) from t1; diff --git a/mysql-test/r/func_test.result b/mysql-test/r/func_test.result index 9ae7b0c3ef1..e3a0d066a85 100644 --- a/mysql-test/r/func_test.result +++ b/mysql-test/r/func_test.result @@ -52,6 +52,20 @@ select 10 % 7, 10 mod 7, 10 div 3; select (1 << 64)-1, ((1 << 64)-1) DIV 1, ((1 << 64)-1) DIV 2; (1 << 64)-1 ((1 << 64)-1) DIV 1 ((1 << 64)-1) DIV 2 18446744073709551615 18446744073709551615 9223372036854775807 +create table t1 (a int); +insert t1 values (1); +select * from t1 where 1 xor 1; +a +drop table t1; +select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1; +5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1 +0 1 +select 1 and 2 between 2 and 10, 2 between 2 and 10 and 1; +1 and 2 between 2 and 10 2 between 2 and 10 and 1 +1 1 +select 1 and 0 or 2, 2 or 1 and 0; +1 and 0 or 2 2 or 1 and 0 +1 1 select _koi8r'a' = _koi8r'A'; _koi8r'a' = _koi8r'A' 1 @@ -109,17 +123,3 @@ select _koi8r'a' COLLATE koi8r_general_ci LIKE _koi8r'A' COLLATE koi8r_bin; ERROR HY000: Illegal mix of collations (koi8r_general_ci,EXPLICIT) and (koi8r_bin,EXPLICIT) for operation 'like' select _koi8r'a' LIKE _latin1'A'; ERROR HY000: Illegal mix of collations (koi8r_general_ci,COERCIBLE) and (latin1_swedish_ci,COERCIBLE) for operation 'like' -create table t1 (a int); -insert t1 values (1); -select * from t1 where 1 xor 1; -a -drop table t1; -select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1; -5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1 -0 1 -select 1 and 2 between 2 and 10, 2 between 2 and 10 and 1; -1 and 2 between 2 and 10 2 between 2 and 10 and 1 -1 1 -select 1 and 0 or 2, 2 or 1 and 0; -1 and 0 or 2 2 or 1 and 0 -1 1 diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index 09c2b2042b3..7d3aeb62227 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -1,5 +1,4 @@ drop table if exists t1; -create table t1 (a int); delete from mysql.user where user='mysqltest_1'; delete from mysql.db where user='mysqltest_1'; flush privileges; @@ -108,4 +107,41 @@ delete from mysql.columns_priv where user='mysqltest_1'; flush privileges; drop table t1; GRANT FILE on mysqltest.* to mysqltest_1@localhost; -Wrong usage of DB GRANT and GLOBAL PRIVILEGES +ERROR HY000: Wrong usage of DB GRANT and GLOBAL PRIVILEGES +select 1; +1 +1 +create table t1 (a int); +grant ALL PRIVILEGES on *.* to drop_user2@localhost with GRANT OPTION; +show grants for drop_user2@localhost; +Grants for drop_user2@localhost +GRANT ALL PRIVILEGES ON *.* TO 'drop_user2'@'localhost' WITH GRANT OPTION +revoke all privileges, grant from drop_user2@localhost; +drop user drop_user2@localhost; +grant ALL PRIVILEGES on *.* to drop_user@localhost with GRANT OPTION; +grant ALL PRIVILEGES on test.* to drop_user@localhost with GRANT OPTION; +grant select(a) on test.t1 to drop_user@localhost; +show grants for drop_user@localhost; +Grants for drop_user@localhost +GRANT ALL PRIVILEGES ON *.* TO 'drop_user'@'localhost' WITH GRANT OPTION +GRANT ALL PRIVILEGES ON `test`.* TO 'drop_user'@'localhost' WITH GRANT OPTION +GRANT SELECT (a) ON `test`.`t1` TO 'drop_user'@'localhost' +revoke all privileges, grant from drop_user@localhost; +show grants for drop_user@localhost; +Grants for drop_user@localhost +GRANT USAGE ON *.* TO 'drop_user'@'localhost' +drop user drop_user@localhost; +revoke all privileges, grant from drop_user@localhost; +ERROR HY000: Can't revoke all privileges, grant for one or more of the requested users +grant select(a) on test.t1 to drop_user1@localhost; +grant select on test.t1 to drop_user2@localhost; +grant select on test.* to drop_user3@localhost; +grant select on *.* to drop_user4@localhost; +drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost, +drop_user4@localhost; +ERROR HY000: Can't drop one or more of the requested users +revoke all privileges, grant from drop_user1@localhost, drop_user2@localhost, +drop_user3@localhost, drop_user4@localhost; +drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost, +drop_user4@localhost; +drop table t1; diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index de0407a8907..3cb9c59cc57 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -115,7 +115,7 @@ groupset bigint(20) DEFAULT '0' NOT NULL, assigned_to mediumint(9) DEFAULT '0' NOT NULL, bug_file_loc text, bug_severity enum('blocker','critical','major','normal','minor','trivial','enhancement') DEFAULT 'blocker' NOT NULL, -bug_status enum('NEW','ASSIGNED','REOPENED','RESOLVED','VERIFIED','CLOSED') DEFAULT 'NEW' NOT NULL, +bug_status enum('','NEW','ASSIGNED','REOPENED','RESOLVED','VERIFIED','CLOSED') DEFAULT 'NEW' NOT NULL, creation_ts datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, delta_ts timestamp(14), short_desc mediumtext, @@ -150,92 +150,34 @@ KEY qa_contact (qa_contact), KEY votes (votes) ); INSERT INTO t1 VALUES (1,0,0,'','normal','','2000-02-10 09:25:12',20000321114747,'','','Linux','P1','TestProduct','PC',3,'other','TestComponent','','M1',0,'',0); -Warnings: -Warning 1263 Data truncated for column 'bug_status' at row 1 INSERT INTO t1 VALUES (9,0,0,'','enhancement','','2000-03-10 11:49:36',20000321114747,'','','All','P5','AAAAA','PC',3,'2.00 CD - Pre','BBBBBBBBBBBBB - conversion','','',0,'',0); -Warnings: -Warning 1263 Data truncated for column 'bug_status' at row 1 INSERT INTO t1 VALUES (10,0,0,'','enhancement','','2000-03-10 18:10:16',20000321114747,'','','All','P4','AAAAA','PC',3,'2.00 CD - Pre','BBBBBBBBBBBBB - conversion','','',0,'',0); -Warnings: -Warning 1263 Data truncated for column 'bug_status' at row 1 INSERT INTO t1 VALUES (7,0,0,'','critical','','2000-03-09 10:50:21',20000321114747,'','','All','P1','AAAAA','PC',3,'2.00 CD - Pre','BBBBBBBBBBBBB - generic','','',0,'',0); -Warnings: -Warning 1263 Data truncated for column 'bug_status' at row 1 INSERT INTO t1 VALUES (6,0,0,'','normal','','2000-03-09 10:42:44',20000321114747,'','','All','P2','AAAAA','PC',3,'2.00 CD - Pre','kkkkkkkkkkk lllllllllll','','',0,'',0); -Warnings: -Warning 1263 Data truncated for column 'bug_status' at row 1 INSERT INTO t1 VALUES (8,0,0,'','major','','2000-03-09 11:32:14',20000321114747,'','','All','P3','AAAAA','PC',3,'2.00 CD - Pre','kkkkkkkkkkk lllllllllll','','',0,'',0); -Warnings: -Warning 1263 Data truncated for column 'bug_status' at row 1 INSERT INTO t1 VALUES (5,0,0,'','enhancement','','2000-03-09 10:38:59',20000321114747,'','','All','P5','CCC/CCCCCC','PC',5,'7.00','Administration','','',0,'',0); -Warnings: -Warning 1263 Data truncated for column 'bug_status' at row 1 INSERT INTO t1 VALUES (4,0,0,'','normal','','2000-03-08 18:32:14',20000321114747,'','','other','P2','TestProduct','Other',3,'other','TestComponent2','','',0,'',0); -Warnings: -Warning 1263 Data truncated for column 'bug_status' at row 1 INSERT INTO t1 VALUES (3,0,0,'','normal','','2000-03-08 18:30:52',20000321114747,'','','other','P2','TestProduct','Other',3,'other','TestComponent','','',0,'',0); -Warnings: -Warning 1263 Data truncated for column 'bug_status' at row 1 INSERT INTO t1 VALUES (2,0,0,'','enhancement','','2000-03-08 18:24:51',20000321114747,'','','All','P2','TestProduct','Other',4,'other','TestComponent2','','',0,'',0); -Warnings: -Warning 1263 Data truncated for column 'bug_status' at row 1 INSERT INTO t1 VALUES (11,0,0,'','blocker','','2000-03-13 09:43:41',20000321114747,'','','All','P2','CCC/CCCCCC','PC',5,'7.00','DDDDDDDDD','','',0,'',0); -Warnings: -Warning 1263 Data truncated for column 'bug_status' at row 1 INSERT INTO t1 VALUES (12,0,0,'','normal','','2000-03-13 16:14:31',20000321114747,'','','All','P2','AAAAA','PC',3,'2.00 CD - Pre','kkkkkkkkkkk lllllllllll','','',0,'',0); -Warnings: -Warning 1263 Data truncated for column 'bug_status' at row 1 INSERT INTO t1 VALUES (13,0,0,'','normal','','2000-03-15 16:20:44',20000321114747,'','','other','P2','TestProduct','Other',3,'other','TestComponent','','',0,'',0); -Warnings: -Warning 1263 Data truncated for column 'bug_status' at row 1 INSERT INTO t1 VALUES (14,0,0,'','blocker','','2000-03-15 18:13:47',20000321114747,'','','All','P1','AAAAA','PC',3,'2.00 CD - Pre','BBBBBBBBBBBBB - generic','','',0,'',0); -Warnings: -Warning 1263 Data truncated for column 'bug_status' at row 1 INSERT INTO t1 VALUES (15,0,0,'','minor','','2000-03-16 18:03:28',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','DDDDDDDDD','','',0,'',0); -Warnings: -Warning 1263 Data truncated for column 'bug_status' at row 1 INSERT INTO t1 VALUES (16,0,0,'','normal','','2000-03-16 18:33:41',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','Administration','','',0,'',0); -Warnings: -Warning 1263 Data truncated for column 'bug_status' at row 1 INSERT INTO t1 VALUES (17,0,0,'','normal','','2000-03-16 18:34:18',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','Administration','','',0,'',0); -Warnings: -Warning 1263 Data truncated for column 'bug_status' at row 1 INSERT INTO t1 VALUES (18,0,0,'','normal','','2000-03-16 18:34:56',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','Administration','','',0,'',0); -Warnings: -Warning 1263 Data truncated for column 'bug_status' at row 1 INSERT INTO t1 VALUES (19,0,0,'','enhancement','','2000-03-16 18:35:34',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','Administration','','',0,'',0); -Warnings: -Warning 1263 Data truncated for column 'bug_status' at row 1 INSERT INTO t1 VALUES (20,0,0,'','enhancement','','2000-03-16 18:36:23',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','Administration','','',0,'',0); -Warnings: -Warning 1263 Data truncated for column 'bug_status' at row 1 INSERT INTO t1 VALUES (21,0,0,'','enhancement','','2000-03-16 18:37:23',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','Administration','','',0,'',0); -Warnings: -Warning 1263 Data truncated for column 'bug_status' at row 1 INSERT INTO t1 VALUES (22,0,0,'','enhancement','','2000-03-16 18:38:16',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','Administration','','',0,'',0); -Warnings: -Warning 1263 Data truncated for column 'bug_status' at row 1 INSERT INTO t1 VALUES (23,0,0,'','normal','','2000-03-16 18:58:12',20000321114747,'','','All','P2','CCC/CCCCCC','Other',5,'7.00','DDDDDDDDD','','',0,'',0); -Warnings: -Warning 1263 Data truncated for column 'bug_status' at row 1 INSERT INTO t1 VALUES (24,0,0,'','normal','','2000-03-17 11:08:10',20000321114747,'','','All','P2','AAAAAAAA-AAA','PC',3,'2.8','Web Interface','','',0,'',0); -Warnings: -Warning 1263 Data truncated for column 'bug_status' at row 1 INSERT INTO t1 VALUES (25,0,0,'','normal','','2000-03-17 11:10:45',20000321114747,'','','All','P2','AAAAAAAA-AAA','PC',3,'2.8','Web Interface','','',0,'',0); -Warnings: -Warning 1263 Data truncated for column 'bug_status' at row 1 INSERT INTO t1 VALUES (26,0,0,'','normal','','2000-03-17 11:15:47',20000321114747,'','','All','P2','AAAAAAAA-AAA','PC',3,'2.8','Web Interface','','',0,'',0); -Warnings: -Warning 1263 Data truncated for column 'bug_status' at row 1 INSERT INTO t1 VALUES (27,0,0,'','normal','','2000-03-17 17:45:41',20000321114747,'','','All','P2','CCC/CCCCCC','PC',5,'7.00','DDDDDDDDD','','',0,'',0); -Warnings: -Warning 1263 Data truncated for column 'bug_status' at row 1 INSERT INTO t1 VALUES (28,0,0,'','normal','','2000-03-20 09:51:45',20000321114747,'','','Windows NT','P2','TestProduct','PC',8,'other','TestComponent','','',0,'',0); -Warnings: -Warning 1263 Data truncated for column 'bug_status' at row 1 INSERT INTO t1 VALUES (29,0,0,'','normal','','2000-03-20 11:15:09',20000321114747,'','','All','P5','AAAAAAAA-AAA','PC',3,'2.8','Web Interface','','',0,'',0); -Warnings: -Warning 1263 Data truncated for column 'bug_status' at row 1 CREATE TABLE t2 ( value tinytext, program varchar(64), diff --git a/mysql-test/r/handler.result b/mysql-test/r/handler.result index bf68057a9aa..78ccf941b88 100644 --- a/mysql-test/r/handler.result +++ b/mysql-test/r/handler.result @@ -167,30 +167,11 @@ handler t1 read first; a 6 drop table t1; -create table t1 (a int); -insert into t1 values (1),(2),(3),(4),(5),(6); -delete from t1 limit 2; -handler t1 open; -handler t1 read first; -a -3 -handler t1 read first limit 1,1; -a -4 -handler t1 read first limit 2,2; -a -5 -6 -delete from t1 limit 3; -handler t1 read first; -a -6 -drop table t1; create table t1(a int, index(a)); insert into t1 values (1), (2), (3); handler t1 open; handler t1 read a=(W); -Unknown column 'W' in 'field list' +ERROR 42S22: Unknown column 'W' in 'field list' handler t1 read a=(a); -Wrong arguments to HANDLER ... READ +ERROR HY000: Wrong arguments to HANDLER ... READ drop table t1; diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result index 4f73cfb6d72..6c5ef8f3441 100644 --- a/mysql-test/r/heap.result +++ b/mysql-test/r/heap.result @@ -163,13 +163,7 @@ id select_type table type possible_keys key key_len ref rows Extra select * from t1 where btn like "q%"; btn alter table t1 add column new_col char(1) not null, add key (btn,new_col), drop key btn; -update t1 set new_col=btn; -Warnings: -Warning 1263 Data truncated for column 'new_col' at row 1 -Warning 1263 Data truncated for column 'new_col' at row 2 -Warning 1263 Data truncated for column 'new_col' at row 3 -Warning 1263 Data truncated for column 'new_col' at row 4 -Warning 1263 Data truncated for column 'new_col' at row 5 +update t1 set new_col=left(btn,1); explain select * from t1 where btn="a"; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL btn NULL NULL NULL 11 Using where @@ -209,8 +203,8 @@ key a (a) ) TYPE=HEAP; INSERT INTO t1 VALUES (10), (10), (10); EXPLAIN SELECT * FROM t1 WHERE a=10; -table type possible_keys key key_len ref rows Extra -t1 ref a a 5 const 10 Using where +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref a a 5 const 10 Using where SELECT * FROM t1 WHERE a=10; a 10 diff --git a/mysql-test/r/heap_btree.result b/mysql-test/r/heap_btree.result index 1ba8d429fc4..c42c5e60675 100644 --- a/mysql-test/r/heap_btree.result +++ b/mysql-test/r/heap_btree.result @@ -179,13 +179,7 @@ id select_type table type possible_keys key key_len ref rows Extra select * from t1 where btn like "q%"; btn alter table t1 add column new_col char(1) not null, add key using BTREE (btn,new_col), drop key btn; -update t1 set new_col=btn; -Warnings: -Warning 1263 Data truncated for column 'new_col' at row 1 -Warning 1263 Data truncated for column 'new_col' at row 2 -Warning 1263 Data truncated for column 'new_col' at row 3 -Warning 1263 Data truncated for column 'new_col' at row 4 -Warning 1263 Data truncated for column 'new_col' at row 5 +update t1 set new_col=left(btn,1); explain select * from t1 where btn="a"; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref btn btn 10 const 1 Using where diff --git a/mysql-test/r/heap_hash.result b/mysql-test/r/heap_hash.result index 72278c5da67..7ecd1db7447 100644 --- a/mysql-test/r/heap_hash.result +++ b/mysql-test/r/heap_hash.result @@ -163,16 +163,10 @@ id select_type table type possible_keys key key_len ref rows Extra select * from t1 where btn like "q%"; btn alter table t1 add column new_col char(1) not null, add key using HASH (btn,new_col), drop key btn; -update t1 set new_col=btn; -Warnings: -Warning 1263 Data truncated for column 'new_col' at row 1 -Warning 1263 Data truncated for column 'new_col' at row 2 -Warning 1263 Data truncated for column 'new_col' at row 3 -Warning 1263 Data truncated for column 'new_col' at row 4 -Warning 1263 Data truncated for column 'new_col' at row 5 +update t1 set new_col=left(btn,1); explain select * from t1 where btn="a"; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL btn NULL NULL NULL 14 Using where +1 SIMPLE t1 ALL btn NULL NULL NULL 11 Using where explain select * from t1 where btn="a" and new_col="a"; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref btn btn 11 const,const 10 Using where diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 69268f1d5c5..8592393fd42 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -1,4 +1,5 @@ drop table if exists t1,t2,t3; +drop database if exists mysqltest; create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) type=innodb; insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt'); select id, code, name from t1 order by id; @@ -138,6 +139,15 @@ id parent_id level 1008 102 2 1010 102 2 1015 102 2 +explain select level from t1 where level=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref level level 1 const # Using where; Using index +explain select level,id from t1 where level=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref level level 1 const # Using where; Using index +explain select level,id,parent_id from t1 where level=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref level level 1 const # Using where select level,id from t1 where level=1; level id 1 1002 @@ -156,7 +166,7 @@ level id parent_id 1 1007 101 optimize table t1; Table Op Msg_type Msg_text -test.t1 optimize error The storage engine for the table doesn't support optimize +test.t1 optimize status OK show keys from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 0 PRIMARY 1 id A # NULL NULL BTREE @@ -180,7 +190,7 @@ create table t1 (a int) type=innodb; insert into t1 values (1), (2); optimize table t1; Table Op Msg_type Msg_text -test.t1 optimize error The storage engine for the table doesn't support optimize +test.t1 optimize status OK delete from t1 where a = 1; select * from t1; a @@ -202,7 +212,7 @@ Table Op Msg_type Msg_text test.t1 analyze status OK show keys from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment -t1 1 skr 1 a A 3 NULL NULL YES BTREE +t1 1 skr 1 a A # NULL NULL YES BTREE drop table t1; create table t1 (a int,b varchar(20),key(a)) type=innodb; insert into t1 values (1,""), (2,"testing"); @@ -345,12 +355,12 @@ CREATE TABLE t1 (a int not null, b int not null,c int not null, key(a),primary key(a,b), unique(c),key(a),unique(b)); show index from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment -t1 0 PRIMARY 1 a A NULL NULL NULL BTREE -t1 0 PRIMARY 2 b A 0 NULL NULL BTREE -t1 0 c 1 c A 0 NULL NULL BTREE -t1 0 b 1 b A 0 NULL NULL BTREE -t1 1 a 1 a A NULL NULL NULL BTREE -t1 1 a_2 1 a A NULL NULL NULL BTREE +t1 0 PRIMARY 1 a A # NULL NULL BTREE +t1 0 PRIMARY 2 b A # NULL NULL BTREE +t1 0 c 1 c A # NULL NULL BTREE +t1 0 b 1 b A # NULL NULL BTREE +t1 1 a 1 a A # NULL NULL BTREE +t1 1 a_2 1 a A # NULL NULL BTREE drop table t1; create table t1 (col1 int not null, col2 char(4) not null, primary key(col1)); alter table t1 type=innodb; @@ -586,6 +596,9 @@ id parent_id level 1009 102 2 1025 102 2 1016 102 2 +explain select level from t1 where level=1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref level level 1 const # Using where; Using index select level,id from t1 where level=1; level id 1 1004 @@ -712,10 +725,10 @@ world 2 hello 1 optimize table t1; Table Op Msg_type Msg_text -test.t1 optimize error The storage engine for the table doesn't support optimize +test.t1 optimize status OK show keys from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment -t1 0 PRIMARY 1 a A 2 NULL NULL BTREE +t1 0 PRIMARY 1 a A # NULL NULL BTREE drop table t1; create table t1 (i int, j int ) TYPE=innodb; insert into t1 values (1,2); @@ -747,7 +760,7 @@ create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h insert into t1 values (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); explain select * from t1 where a > 0 and a < 50; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 1 Using where +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL # Using where drop table t1; create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=innodb; insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); @@ -788,13 +801,13 @@ id id3 UNLOCK TABLES; DROP TABLE t1; create table t1 (a char(20), unique (a(5))) type=innodb; -ERROR HY000: Incorrect sub part key. The used key part isn't a string, the used length is longer than the key part or the storage engine doesn't support unique sub keys +drop table t1; create table t1 (a char(20), index (a(5))) type=innodb; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( `a` char(20) default NULL, - KEY `a` (`a`) + KEY `a` (`a`(5)) ) TYPE=InnoDB CHARSET=latin1 drop table t1; create temporary table t1 (a int not null auto_increment, primary key(a)) type=innodb; @@ -881,28 +894,28 @@ create table t1 (a int not null, b int not null, c int not null, primary key (a) insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4); explain select * from t1 order by a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 +1 SIMPLE t1 index NULL PRIMARY 4 NULL # explain select * from t1 order by b; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL b 4 NULL 4 +1 SIMPLE t1 index NULL b 4 NULL # explain select * from t1 order by c; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort +1 SIMPLE t1 ALL NULL NULL NULL NULL # Using filesort explain select a from t1 order by a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 4 Using index +1 SIMPLE t1 index NULL PRIMARY 4 NULL # Using index explain select b from t1 order by b; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL b 4 NULL 4 Using index +1 SIMPLE t1 index NULL b 4 NULL # Using index explain select a,b from t1 order by b; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL b 4 NULL 4 Using index +1 SIMPLE t1 index NULL b 4 NULL # Using index explain select a,b from t1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL b 4 NULL 4 Using index +1 SIMPLE t1 index NULL b 4 NULL # Using index explain select a,b,c from t1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 4 +1 SIMPLE t1 ALL NULL NULL NULL NULL # drop table t1; create table t1 (t int not null default 1, key (t)) type=innodb; desc t1; @@ -1249,11 +1262,11 @@ count(*) 29267 explain select * from t1 where c between 1 and 10000; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 5 NULL 1 Using where +1 SIMPLE t1 range c c 5 NULL # Using where update t1 set c=a; explain select * from t1 where c between 1 and 10000; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL c NULL NULL NULL 29537 Using where +1 SIMPLE t1 ALL c NULL NULL NULL # Using where drop table t1,t2; create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) type=innodb; insert into t1 (id) values (null),(null),(null),(null),(null); diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result index 59c598265c0..b84c846b132 100644 --- a/mysql-test/r/insert.result +++ b/mysql-test/r/insert.result @@ -60,8 +60,10 @@ test 2 drop table t1; create table t1 (id int NOT NULL DEFAULT 8); insert into t1 values(NULL); -Column 'id' cannot be null +ERROR 23000: Column 'id' cannot be null insert into t1 values (1), (NULL), (2); +Warnings: +Warning 1262 Data truncated, NULL supplied to NOT NULL column 'id' at row 2 select * from t1; id 1 diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result index d5b9b9a2117..82d5ee872a2 100644 --- a/mysql-test/r/insert_select.result +++ b/mysql-test/r/insert_select.result @@ -64,7 +64,7 @@ bulk_insert_buffer_size 8388608 INSERT INTO t1 (numeropost,icone,contenu,pseudo,date,signature,ip) SELECT 1718,icone,contenu,pseudo,date,signature,ip FROM t2 WHERE numeropost=9 ORDER BY numreponse ASC; -DROP TABLE IF EXISTS t1,t2; +DROP TABLE t1,t2; create table t1(a int, unique(a)); insert into t1 values(2); create table t2(a int); @@ -76,7 +76,6 @@ show binlog events; Log_name Pos Event_type Server_id Orig_log_pos Info master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3 drop table t1, t2; -drop table if exists t1, t2; create table t1 (a int not null); create table t2 (a int not null); insert into t1 values (1); @@ -566,14 +565,14 @@ a 5 5 insert into t1 select * from t1,t1; -Not unique table/alias: 't1' +ERROR 42000: Not unique table/alias: 't1' drop table t1,t2; create table t1 (a int not null primary key, b char(10)); create table t2 (a int not null, b char(10)); insert into t1 values (1,"t1:1"),(3,"t1:3"); insert into t2 values (2,"t2:2"), (3,"t2:3"); insert into t1 select * from t2; -Duplicate entry '3' for key 1 +ERROR 23000: Duplicate entry '3' for key 1 select * from t1; a b 1 t1:1 diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index b7d3f94cb33..b060fdfb85c 100644 --- a/mysql-test/r/join_outer.result +++ b/mysql-test/r/join_outer.result @@ -663,5 +663,5 @@ create table t3 (f3 integer,f5 integer); select * from t1 left outer join t2 using (f2) left outer join t3 using (f3); -Unknown column 'test.t2.f3' in 'on clause' +ERROR 42S22: Unknown column 'test.t2.f3' in 'on clause' drop table t1,t2,t3; diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result index e0b2b84ac16..89deab4bb1f 100644 --- a/mysql-test/r/key.result +++ b/mysql-test/r/key.result @@ -1,4 +1,5 @@ drop table if exists t1,t2,t3; +SET SQL_WARNINGS=1; CREATE TABLE t1 ( ID CHAR(32) NOT NULL, name CHAR(32) NOT NULL, @@ -33,10 +34,10 @@ INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','N','N','N','N'); INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','N','N','N','N'); INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','','','',''); Warnings: -Warning 1263 Data truncated for column 'transityes' at row 1 -Warning 1263 Data truncated for column 'shopsyes' at row 1 -Warning 1263 Data truncated for column 'schoolsyes' at row 1 -Warning 1263 Data truncated for column 'petsyes' at row 1 +Warning 1264 Data truncated for column 'transityes' at row 1 +Warning 1264 Data truncated for column 'shopsyes' at row 1 +Warning 1264 Data truncated for column 'schoolsyes' at row 1 +Warning 1264 Data truncated for column 'petsyes' at row 1 INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','Y','Y','Y','Y'); INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','Y','Y','Y','Y'); INSERT INTO t1 VALUES (900,'Vancouver','Shared/Roomate','Y','Y','Y','Y'); @@ -94,13 +95,9 @@ INSERT t1 VALUES(NULL,'/'); INSERT t1 VALUES(NULL,'[T,U]_axpby'); SELECT * FROM t1 WHERE name='[T,U]_axpy'; name_id name -Warnings: -Warning 1263 Data truncated for column 'name' at row 1 SELECT * FROM t1 WHERE name='[T,U]_axpby'; name_id name 2 [T,U]_axpby -Warnings: -Warning 1263 Data truncated for column 'name' at row 1 create table t2 ( name_id int not null auto_increment, @@ -159,8 +156,8 @@ CREATE TABLE t1 (c CHAR(10) NOT NULL,i INT NOT NULL AUTO_INCREMENT, UNIQUE (c,i)); INSERT INTO t1 (c) VALUES (NULL),(NULL); Warnings: -Warning 1261 Data truncated, NULL supplied to NOT NULL column 'c' at row 1 -Warning 1261 Data truncated, NULL supplied to NOT NULL column 'c' at row 2 +Warning 1262 Data truncated, NULL supplied to NOT NULL column 'c' at row 1 +Warning 1262 Data truncated, NULL supplied to NOT NULL column 'c' at row 2 SELECT * FROM t1; c i 1 diff --git a/mysql-test/r/key_cache.result b/mysql-test/r/key_cache.result index 8ec507b2a3f..dd45cb51d33 100644 --- a/mysql-test/r/key_cache.result +++ b/mysql-test/r/key_cache.result @@ -35,7 +35,7 @@ SELECT @@small.key_buffer_size; 1048576 SELECT @@medium.key_buffer_size; @@medium.key_buffer_size -4194304 +0 SET @@global.key_buffer_size=@save_key_buffer; SELECT @@default.key_buffer_size; ERROR 42000: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'default.key_buffer_size' at line 1 diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result index 3cd62d8b678..508e1844d84 100644 --- a/mysql-test/r/loaddata.result +++ b/mysql-test/r/loaddata.result @@ -2,12 +2,12 @@ drop table if exists t1; create table t1 (a date, b date, c date not null, d date); load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ','; Warnings: -Warning 1263 Data truncated for column 'a' at row 1 -Warning 1263 Data truncated for column 'c' at row 1 -Warning 1263 Data truncated for column 'd' at row 1 -Warning 1263 Data truncated for column 'a' at row 2 -Warning 1263 Data truncated for column 'b' at row 2 -Warning 1263 Data truncated for column 'd' at row 2 +Warning 1264 Data truncated for column 'a' at row 1 +Warning 1264 Data truncated for column 'c' at row 1 +Warning 1264 Data truncated for column 'd' at row 1 +Warning 1264 Data truncated for column 'a' at row 2 +Warning 1264 Data truncated for column 'b' at row 2 +Warning 1264 Data truncated for column 'd' at row 2 load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES; SELECT * from t1; a b c d @@ -18,10 +18,10 @@ a b c d truncate table t1; load data infile '../../std_data/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d); Warnings: -Warning 1263 Data truncated for column 'c' at row 1 -Warning 1263 Data truncated for column 'd' at row 1 -Warning 1263 Data truncated for column 'b' at row 2 -Warning 1263 Data truncated for column 'd' at row 2 +Warning 1264 Data truncated for column 'c' at row 1 +Warning 1264 Data truncated for column 'd' at row 1 +Warning 1264 Data truncated for column 'b' at row 2 +Warning 1264 Data truncated for column 'd' at row 2 SELECT * from t1; a b c d NULL NULL 0000-00-00 0000-00-00 diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 59af9b3e7f3..d158c39cba8 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -1,4 +1,5 @@ drop table if exists t1,t2; +SET SQL_WARNINGS=1; CREATE TABLE t1 ( STRING_DATA char(255) default NULL, KEY string_data (STRING_DATA) @@ -14,34 +15,6 @@ Table Op Msg_type Msg_text test.t1 check status OK drop table t1; create table t1 (a tinyint not null auto_increment, b blob not null, primary key (a)); -Warnings: -Warning 1263 Data truncated for column 'b' at row 1 -Warnings: -Warning 1263 Data truncated for column 'b' at row 1 -Warnings: -Warning 1263 Data truncated for column 'b' at row 1 -Warnings: -Warning 1263 Data truncated for column 'b' at row 1 -Warnings: -Warning 1263 Data truncated for column 'b' at row 1 -Warnings: -Warning 1263 Data truncated for column 'b' at row 1 -Warnings: -Warning 1263 Data truncated for column 'b' at row 1 -Warnings: -Warning 1263 Data truncated for column 'b' at row 1 -Warnings: -Warning 1263 Data truncated for column 'b' at row 1 -Warnings: -Warning 1263 Data truncated for column 'b' at row 1 -Warnings: -Warning 1263 Data truncated for column 'b' at row 1 -Warnings: -Warning 1263 Data truncated for column 'b' at row 1 -Warnings: -Warning 1263 Data truncated for column 'b' at row 1 -Warnings: -Warning 1263 Data truncated for column 'b' at row 1 check table t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -361,8 +334,8 @@ t1 1 c_2 1 c A 5 NULL NULL YES BTREE t1 1 c_2 2 a A 5 NULL NULL BTREE explain select * from t1,t2 where t1.a=t2.a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL a NULL NULL NULL 2 Using where -1 SIMPLE t1 ALL a NULL NULL NULL 4 +1 SIMPLE t2 ALL a NULL NULL NULL 2 +1 SIMPLE t1 ALL a NULL NULL NULL 4 Using where explain select * from t1,t2 force index(a) where t1.a=t2.a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ALL a NULL NULL NULL 2 @@ -377,8 +350,8 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref b b 5 test.t2.b 1 Using where explain select * from t1,t2 force index(c) where t1.a=t2.a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where -1 SIMPLE t1 ALL a NULL NULL NULL 4 +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 +1 SIMPLE t1 ALL a NULL NULL NULL 4 Using where explain select * from t1 where a=0 or a=2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL a NULL NULL NULL 5 Using where diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result index 0dd9754d0c5..479a7f049d9 100644 --- a/mysql-test/r/null.result +++ b/mysql-test/r/null.result @@ -77,42 +77,42 @@ CREATE TABLE t1 (a varchar(16) NOT NULL, b smallint(6) NOT NULL, c datetime NOT INSERT INTO t1 SET a = "", d= "2003-01-14 03:54:55"; UPDATE t1 SET d=1/NULL; Warnings: -Warning 1263 Data truncated for column 'd' at row 1 +Warning 1264 Data truncated for column 'd' at row 1 UPDATE t1 SET d=NULL; Warnings: -Warning 1261 Data truncated, NULL supplied to NOT NULL column 'd' at row 1 +Warning 1262 Data truncated, NULL supplied to NOT NULL column 'd' at row 1 INSERT INTO t1 (a) values (null); ERROR 23000: Column 'a' cannot be null INSERT INTO t1 (a) values (1/null); ERROR 23000: Column 'a' cannot be null INSERT INTO t1 (a) values (null),(null); Warnings: -Warning 1261 Data truncated, NULL supplied to NOT NULL column 'a' at row 1 -Warning 1261 Data truncated, NULL supplied to NOT NULL column 'a' at row 2 +Warning 1262 Data truncated, NULL supplied to NOT NULL column 'a' at row 1 +Warning 1262 Data truncated, NULL supplied to NOT NULL column 'a' at row 2 INSERT INTO t1 (b) values (null); ERROR 23000: Column 'b' cannot be null INSERT INTO t1 (b) values (1/null); ERROR 23000: Column 'b' cannot be null INSERT INTO t1 (b) values (null),(null); Warnings: -Warning 1261 Data truncated, NULL supplied to NOT NULL column 'b' at row 1 -Warning 1261 Data truncated, NULL supplied to NOT NULL column 'b' at row 2 +Warning 1262 Data truncated, NULL supplied to NOT NULL column 'b' at row 1 +Warning 1262 Data truncated, NULL supplied to NOT NULL column 'b' at row 2 INSERT INTO t1 (c) values (null); ERROR 23000: Column 'c' cannot be null INSERT INTO t1 (c) values (1/null); ERROR 23000: Column 'c' cannot be null INSERT INTO t1 (c) values (null),(null); Warnings: -Warning 1261 Data truncated, NULL supplied to NOT NULL column 'c' at row 1 -Warning 1261 Data truncated, NULL supplied to NOT NULL column 'c' at row 2 +Warning 1262 Data truncated, NULL supplied to NOT NULL column 'c' at row 1 +Warning 1262 Data truncated, NULL supplied to NOT NULL column 'c' at row 2 INSERT INTO t1 (d) values (null); ERROR 23000: Column 'd' cannot be null INSERT INTO t1 (d) values (1/null); ERROR 23000: Column 'd' cannot be null INSERT INTO t1 (d) values (null),(null); Warnings: -Warning 1261 Data truncated, NULL supplied to NOT NULL column 'd' at row 1 -Warning 1261 Data truncated, NULL supplied to NOT NULL column 'd' at row 2 +Warning 1262 Data truncated, NULL supplied to NOT NULL column 'd' at row 1 +Warning 1262 Data truncated, NULL supplied to NOT NULL column 'd' at row 2 select * from t1; a b c d 0 0000-00-00 00:00:00 0 diff --git a/mysql-test/r/null_key.result b/mysql-test/r/null_key.result index 7dc0b4bfdd3..9aaea0d800b 100644 --- a/mysql-test/r/null_key.result +++ b/mysql-test/r/null_key.result @@ -153,7 +153,7 @@ a b 7 NULL explain select * from t1 where (a = 7 or a is null) and (b=7 or b is null); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a,b a 10 NULL 4 Using where; Using index +1 SIMPLE t1 range a,b a 10 NULL 3 Using where; Using index select * from t1 where (a = 7 or a is null) and (b=7 or b is null); a b NULL 7 @@ -337,7 +337,7 @@ index (id2) ); insert into t1 values(null,null),(1,1); Warnings: -Warning 1261 Data truncated, NULL supplied to NOT NULL column 'id2' at row 1 +Warning 1262 Data truncated, NULL supplied to NOT NULL column 'id2' at row 1 select * from t1; id id2 NULL 0 diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index 5470b9387e3..79ccf833f40 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -306,17 +306,17 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range a a 9 NULL 8 Using where; Using index explain select * from t1 where a = 2 and b >0 order by a desc,b desc; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 9 NULL 4 Using where; Using index +1 SIMPLE t1 range a a 9 NULL 5 Using where; Using index explain select * from t1 where a = 2 and b is null order by a desc,b desc; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref a a 9 const,const 1 Using where; Using index; Using filesort explain select * from t1 where a = 2 and (b is null or b > 0) order by a desc,b desc; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 9 NULL 5 Using where; Using index +1 SIMPLE t1 range a a 9 NULL 6 Using where; Using index explain select * from t1 where a = 2 and b > 0 order by a desc,b desc; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a a 9 NULL 4 Using where; Using index +1 SIMPLE t1 range a a 9 NULL 5 Using where; Using index explain select * from t1 where a = 2 and b < 2 order by a desc,b desc; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range a a 9 NULL 2 Using where; Using index @@ -333,10 +333,10 @@ a b c 1 NULL NULL alter table t1 modify b int not null, modify c varchar(10) not null; Warnings: -Warning 1263 Data truncated for column 'b' at row 1 -Warning 1263 Data truncated for column 'c' at row 1 -Warning 1263 Data truncated for column 'b' at row 2 -Warning 1263 Data truncated for column 'c' at row 3 +Warning 1264 Data truncated for column 'b' at row 1 +Warning 1264 Data truncated for column 'c' at row 1 +Warning 1264 Data truncated for column 'b' at row 2 +Warning 1264 Data truncated for column 'c' at row 3 explain select * from t1 order by a, b, c; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL a 18 NULL 11 Using index diff --git a/mysql-test/r/rpl_do_grant.result b/mysql-test/r/rpl_do_grant.result index fec935ae7ac..983cdf46620 100644 --- a/mysql-test/r/rpl_do_grant.result +++ b/mysql-test/r/rpl_do_grant.result @@ -1,9 +1,9 @@ -slave stop; +stop slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -slave start; +start slave; delete from mysql.user where user='rpl_do_grant'; delete from mysql.db where user='rpl_do_grant'; flush privileges; diff --git a/mysql-test/r/rpl_error_ignored_table.result b/mysql-test/r/rpl_error_ignored_table.result index e1486220542..f22b62838bb 100644 --- a/mysql-test/r/rpl_error_ignored_table.result +++ b/mysql-test/r/rpl_error_ignored_table.result @@ -1,15 +1,15 @@ -slave stop; +stop slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -slave start; +start slave; create table t1 (a int primary key); insert into t1 values (1),(1); -Duplicate entry '1' for key 1 +ERROR 23000: Duplicate entry '1' for key 1 show slave status; -Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root MASTER_PORT 1 master-bin.001 213 slave-relay-bin.002 254 master-bin.001 Yes Yes 0 0 213 254 +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 master-bin.000001 213 slave-relay-bin.000002 257 master-bin.000001 Yes Yes test.t1 0 0 213 257 show tables like 't1'; Tables_in_test (t1) drop table t1; diff --git a/mysql-test/r/rpl_ignore_grant.result b/mysql-test/r/rpl_ignore_grant.result index 6cd7d5b4c00..5e970e71d0b 100644 --- a/mysql-test/r/rpl_ignore_grant.result +++ b/mysql-test/r/rpl_ignore_grant.result @@ -1,9 +1,9 @@ -slave stop; +stop slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -slave start; +start slave; delete from mysql.user where user='rpl_ignore_grant'; delete from mysql.db where user='rpl_ignore_grant'; flush privileges; @@ -17,7 +17,7 @@ Grants for rpl_ignore_grant@localhost GRANT SELECT ON *.* TO 'rpl_ignore_grant'@'localhost' GRANT DROP ON `test`.* TO 'rpl_ignore_grant'@'localhost' show grants for rpl_ignore_grant@localhost; -There is no such grant defined for user 'rpl_ignore_grant' on host 'localhost' +ERROR 42000: There is no such grant defined for user 'rpl_ignore_grant' on host 'localhost' select count(*) from mysql.user where user='rpl_ignore_grant'; count(*) 0 diff --git a/mysql-test/r/rpl_loaddata.result b/mysql-test/r/rpl_loaddata.result index fb3921eb677..55dcf2f4f0f 100644 --- a/mysql-test/r/rpl_loaddata.result +++ b/mysql-test/r/rpl_loaddata.result @@ -28,8 +28,8 @@ load data infile '../../std_data/rpl_loaddata.dat' into table t1; set global sql_slave_skip_counter=1; start slave; show slave status; -Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root MASTER_PORT 1 master-bin.001 1311 slave-relay-bin.002 1352 master-bin.001 Yes Yes 0 0 1311 1352 +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 master-bin.000001 1311 slave-relay-bin.000002 1355 master-bin.000001 Yes Yes 0 0 1311 1355 set sql_log_bin=0; delete from t1; set sql_log_bin=1; @@ -38,8 +38,8 @@ stop slave; change master to master_user='test'; change master to master_user='root'; show slave status; -Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root MASTER_PORT 1 master-bin.001 1442 slave-relay-bin.001 4 master-bin.001 No No 0 0 1442 4 +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 master-bin.000001 1442 slave-relay-bin.000001 4 master-bin.000001 No No 0 0 1442 4 set global sql_slave_skip_counter=1; start slave; set sql_log_bin=0; @@ -49,5 +49,5 @@ load data infile '../../std_data/rpl_loaddata.dat' into table t1; stop slave; reset slave; show slave status; -Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.001 4 No No 0 0 0 4 +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.000001 4 No No 0 0 0 4 diff --git a/mysql-test/r/rpl_log.result b/mysql-test/r/rpl_log.result index 050e9274a99..ab45826a3e7 100644 --- a/mysql-test/r/rpl_log.result +++ b/mysql-test/r/rpl_log.result @@ -93,6 +93,6 @@ slave-bin.000002 62 Query 1 168 use `test`; insert into t1 values (1) slave-bin.000002 122 Query 1 228 use `test`; drop table t1 show slave status; Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root MASTER_PORT 1 master-bin.000002 276 slave-relay-bin.000002 1531 master-bin.000002 Yes Yes 0 0 276 1535 +127.0.0.1 root MASTER_PORT 1 master-bin.000002 276 slave-relay-bin.000003 214 master-bin.000002 Yes Yes 0 0 276 214 show binlog events in 'slave-bin.000005' from 4; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log diff --git a/mysql-test/r/rpl_log_pos.result b/mysql-test/r/rpl_log_pos.result index b42e7ff5dc4..bc655b9b15a 100644 --- a/mysql-test/r/rpl_log_pos.result +++ b/mysql-test/r/rpl_log_pos.result @@ -9,7 +9,7 @@ File Position Binlog_do_db Binlog_ignore_db master-bin.000001 79 show slave status; Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000002 123 master-bin.000001 Yes Yes 0 0 79 127 +127.0.0.1 root MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000002 123 master-bin.000001 Yes Yes 0 0 79 123 stop slave; change master to master_log_pos=73; start slave; @@ -21,7 +21,7 @@ Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Lo start slave; show slave status; Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root MASTER_PORT 1 master-bin.000001 73 slave-relay-bin.000001 4 master-bin.000001 No Yes 0 0 73 4 +127.0.0.1 root MASTER_PORT 1 master-bin.000001 73 slave-relay-bin.000001 48 master-bin.000001 No Yes 0 0 73 48 stop slave; change master to master_log_pos=173; start slave; diff --git a/mysql-test/r/rpl_max_relay_size.result b/mysql-test/r/rpl_max_relay_size.result index 1fa3fcd1adb..741b3538799 100644 --- a/mysql-test/r/rpl_max_relay_size.result +++ b/mysql-test/r/rpl_max_relay_size.result @@ -1,9 +1,9 @@ -slave stop; +stop slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -slave start; +start slave; stop slave; create table t1 (a int); drop table t1; @@ -15,8 +15,8 @@ select @@global.max_relay_log_size; 4096 start slave; show slave status; -Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root MASTER_PORT 1 master-bin.001 50477 slave-relay-bin.014 1221 master-bin.001 Yes Yes 0 0 50477 1221 +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 master-bin.000001 50477 slave-relay-bin.000014 1221 master-bin.000001 Yes Yes 0 0 50477 1221 stop slave; reset slave; set global max_relay_log_size=(5*4096); @@ -25,8 +25,8 @@ select @@global.max_relay_log_size; 20480 start slave; show slave status; -Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root MASTER_PORT 1 master-bin.001 50477 slave-relay-bin.004 9457 master-bin.001 Yes Yes 0 0 50477 9457 +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 master-bin.000001 50477 slave-relay-bin.000004 9457 master-bin.000001 Yes Yes 0 0 50477 9457 stop slave; reset slave; set global max_relay_log_size=0; @@ -35,27 +35,27 @@ select @@global.max_relay_log_size; 0 start slave; show slave status; -Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root MASTER_PORT 1 master-bin.001 50477 slave-relay-bin.008 1283 master-bin.001 Yes Yes 0 0 50477 1283 +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 master-bin.000001 50477 slave-relay-bin.000008 1283 master-bin.000001 Yes Yes 0 0 50477 1283 stop slave; reset slave; flush logs; show slave status; -Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.001 4 No No 0 0 0 4 +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.000001 4 No No 0 0 0 4 reset slave; start slave; flush logs; create table t1 (a int); show slave status; -Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root MASTER_PORT 1 master-bin.001 50535 slave-relay-bin.009 62 master-bin.001 Yes Yes 0 0 50535 62 +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 master-bin.000001 50535 slave-relay-bin.000009 62 master-bin.000001 Yes Yes 0 0 50535 62 flush logs; drop table t1; show slave status; -Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root MASTER_PORT 1 master-bin.001 50583 slave-relay-bin.010 52 master-bin.001 Yes Yes 0 0 50583 52 +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 master-bin.000001 50583 slave-relay-bin.000010 52 master-bin.000001 Yes Yes 0 0 50583 52 flush logs; show master status; File Position Binlog_do_db Binlog_ignore_db -master-bin.002 4 +master-bin.000002 4 diff --git a/mysql-test/r/rpl_replicate_do.result b/mysql-test/r/rpl_replicate_do.result index 4d740cafbd0..ad92ee5b491 100644 --- a/mysql-test/r/rpl_replicate_do.result +++ b/mysql-test/r/rpl_replicate_do.result @@ -28,4 +28,4 @@ ERROR 42S02: Table 'test.t11' doesn't exist drop table if exists t1,t2,t11; show slave status; Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root MASTER_PORT 1 master-bin.000001 1281 slave-relay-bin.000002 1325 master-bin.000001 Yes Yes test.t1 0 0 1281 1329 +127.0.0.1 root MASTER_PORT 1 master-bin.000001 1281 slave-relay-bin.000002 1325 master-bin.000001 Yes Yes test.t1 0 0 1281 1325 diff --git a/mysql-test/r/rpl_reset_slave.result b/mysql-test/r/rpl_reset_slave.result index c1bc1e8e483..239c4158410 100644 --- a/mysql-test/r/rpl_reset_slave.result +++ b/mysql-test/r/rpl_reset_slave.result @@ -1,22 +1,22 @@ -slave stop; +stop slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -slave start; +start slave; show slave status; -Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root MASTER_PORT 1 master-bin.001 79 slave-relay-bin.002 120 master-bin.001 Yes Yes 0 0 79 120 +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000002 123 master-bin.000001 Yes Yes 0 0 79 123 stop slave; change master to master_user='test'; show slave status; -Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 test MASTER_PORT 1 master-bin.001 79 slave-relay-bin.001 4 master-bin.001 No No 0 0 79 4 +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 test MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000001 4 master-bin.000001 No No 0 0 79 4 reset slave; show slave status; -Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.001 4 No No 0 0 0 4 +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 4 slave-relay-bin.000001 4 No No 0 0 0 4 start slave; show slave status; -Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root MASTER_PORT 1 master-bin.001 79 slave-relay-bin.002 120 master-bin.001 Yes Yes 0 0 79 120 +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 master-bin.000001 79 slave-relay-bin.000002 123 master-bin.000001 Yes Yes 0 0 79 123 diff --git a/mysql-test/r/rpl_rotate_logs.result b/mysql-test/r/rpl_rotate_logs.result index 57b48827e33..7c5057c7fb2 100644 --- a/mysql-test/r/rpl_rotate_logs.result +++ b/mysql-test/r/rpl_rotate_logs.result @@ -5,7 +5,7 @@ ERROR HY000: Could not initialize master info structure, check permisions on mas start slave; ERROR HY000: Could not initialize master info structure, check permisions on master.info change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root'; -Could not initialize master info structure, check permisions on master.info +ERROR HY000: Could not initialize master info structure, check permisions on master.info reset slave; change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root'; reset master; @@ -81,7 +81,7 @@ a testing temporary tables part 2 show slave status; Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Replicate_do_table Replicate_ignore_table Replicate_wild_do_table Replicate_wild_ignore_table Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root MASTER_PORT 60 master-bin.000006 838 slave-relay-bin.000001 8067 master-bin.000004 Yes Yes 0 0 2886 8067 +127.0.0.1 root MASTER_PORT 60 master-bin.000004 2886 slave-relay-bin.000001 7891 master-bin.000004 Yes Yes 0 0 2886 7891 lock tables t3 read; select count(*) from t3 where n >= 4; count(*) diff --git a/mysql-test/r/rpl_user_variables.result b/mysql-test/r/rpl_user_variables.result index 2feef3dd4e3..b715b750b68 100644 --- a/mysql-test/r/rpl_user_variables.result +++ b/mysql-test/r/rpl_user_variables.result @@ -65,11 +65,11 @@ slave-bin.000001 851 User var 2 851 @n1=NULL slave-bin.000001 877 Query 1 877 use `test`; insert into t1 values (@n1) slave-bin.000001 939 Query 1 939 use `test`; insert into t1 values (@n2) slave-bin.000001 1001 Query 1 1001 use `test`; insert into t1 values (@a:=0), (@a:=@a+1), (@a:=@a+1) -slave-bin.000001 1089 User var 2 1089 @a='2' -slave-bin.000001 1124 Query 1 1124 use `test`; insert into t1 values (@a+(@b:=@a+1)) -slave-bin.000001 1196 User var 2 1196 @q='abc' -slave-bin.000001 1233 Query 1 1233 use `test`; insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2')) -slave-bin.000001 1337 User var 2 1337 @a=5 -slave-bin.000001 1379 Query 1 1379 use `test`; insert into t1 values (@a),(@a) +slave-bin.000001 1089 User var 2 1089 @a=2 +slave-bin.000001 1131 Query 1 1131 use `test`; insert into t1 values (@a+(@b:=@a+1)) +slave-bin.000001 1203 User var 2 1203 @q='abc' +slave-bin.000001 1240 Query 1 1240 use `test`; insert t1 values (@q), (@q:=concat(@q, 'n1')), (@q:=concat(@q, 'n2')) +slave-bin.000001 1344 User var 2 1344 @a=5 +slave-bin.000001 1386 Query 1 1386 use `test`; insert into t1 values (@a),(@a) drop table t1; stop slave; diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index e83bbc2fc8c..46888acb73c 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -2583,36 +2583,36 @@ explain select t2.companynr,companyname from t4 left join t2 using (companynr) w id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL NULL NULL NULL NULL 12 1 SIMPLE t2 ALL NULL NULL NULL NULL 1200 Using where; Not exists -select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1; -companynr companynr -37 36 -41 40 delete from t2 where fld1=999999; explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0; -table type possible_keys key key_len ref rows Extra -t2 ALL NULL NULL NULL NULL 1199 Using where -t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0; -table type possible_keys key key_len ref rows Extra -t2 ALL NULL NULL NULL NULL 1199 Using where -t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 and t4.companynr > 0; -table type possible_keys key key_len ref rows Extra -t2 ALL NULL NULL NULL NULL 1199 Using where -t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +1 SIMPLE t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr is null; -table type possible_keys key key_len ref rows Extra -t4 ALL NULL NULL NULL NULL 12 -t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t4 ALL NULL NULL NULL NULL 12 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr < 0 or t4.companynr > 0; -table type possible_keys key key_len ref rows Extra -t4 ALL PRIMARY NULL NULL NULL 12 -t2 ALL NULL NULL NULL NULL 1199 Using where +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where ifnull(t2.companynr,1)>0; -table type possible_keys key key_len ref rows Extra -t4 ALL NULL NULL NULL NULL 12 -t2 ALL NULL NULL NULL NULL 1199 Using where -plain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t4 ALL NULL NULL NULL NULL 12 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where +select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1; +companynr companynr +37 36 +41 40 +explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using temporary 1 SIMPLE t4 index NULL PRIMARY 1 NULL 12 Using where; Using index @@ -3527,11 +3527,11 @@ insert into t2 values (1); insert into t4 values (1,1); explain select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3 left join t4 on id3 = id4 where id2 = 1 or id4 = 1; -table type possible_keys key key_len ref rows Extra -t3 system NULL NULL NULL NULL 0 const row not found -t1 ALL NULL NULL NULL NULL 2 -t2 ALL NULL NULL NULL NULL 1 -t4 ALL id4 NULL NULL NULL 1 Using where +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 system NULL NULL NULL NULL 0 const row not found +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1 +1 SIMPLE t4 ALL id4 NULL NULL NULL 1 Using where select * from t1 left join t2 on id1 = id2 left join t3 on id1 = id3 left join t4 on id3 = id4 where id2 = 1 or id4 = 1; id1 id2 id3 id4 id44 diff --git a/mysql-test/r/select_safe.result b/mysql-test/r/select_safe.result index dfb12eacd9c..446dd41e216 100644 --- a/mysql-test/r/select_safe.result +++ b/mysql-test/r/select_safe.result @@ -61,21 +61,21 @@ a b 4 a 5 a SELECT @@MAX_SEEKS_FOR_KEY; -@@max_seeks_for_key +@@MAX_SEEKS_FOR_KEY 4294967295 analyze table t1; Table Op Msg_type Msg_text test.t1 analyze status OK insert into t1 values (null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"); explain select * from t1,t1 as t2 where t1.b=t2.b; -table type possible_keys key key_len ref rows Extra -t1 ALL b NULL NULL NULL 21 -t2 ALL b NULL NULL NULL 16 Using where +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL b NULL NULL NULL 21 +1 SIMPLE t2 ALL b NULL NULL NULL 16 Using where set MAX_SEEKS_FOR_KEY=1; explain select * from t1,t1 as t2 where t1.b=t2.b; -table type possible_keys key key_len ref rows Extra -t1 ALL b NULL NULL NULL 21 -t2 ref b b 21 t1.b 6 Using where +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL b NULL NULL NULL 21 +1 SIMPLE t2 ref b b 21 test.t1.b 6 Using where SET MAX_SEEKS_FOR_KEY=DEFAULT; drop table t1; SET SQL_SAFE_UPDATES=0,SQL_SELECT_LIMIT=DEFAULT, SQL_MAX_JOIN_SIZE=DEFAULT; diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 41fba93db5b..9ee50c3a519 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -6,7 +6,7 @@ explain select (select 2); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1247 Select 2 was reduced during optimisation +Note 1248 Select 2 was reduced during optimisation SELECT (SELECT 1) UNION SELECT (SELECT 2); (SELECT 1) 1 @@ -16,8 +16,8 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used 3 UNION NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1247 Select 2 was reduced during optimisation -Note 1247 Select 4 was reduced during optimisation +Note 1248 Select 2 was reduced during optimisation +Note 1248 Select 4 was reduced during optimisation SELECT (SELECT (SELECT 0 UNION SELECT 0)); (SELECT (SELECT 0 UNION SELECT 0)) 0 @@ -27,7 +27,7 @@ id select_type table type possible_keys key key_len ref rows Extra 3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used 4 UNION NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1247 Select 2 was reduced during optimisation +Note 1248 Select 2 was reduced during optimisation SELECT (SELECT 1 FROM (SELECT 1) as b HAVING a=1) as a; ERROR 42S22: Reference 'a' not supported (forward reference in item list) SELECT (SELECT 1 FROM (SELECT 1) as b HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) as c HAVING a=1) as b; @@ -608,7 +608,6 @@ x 3 3 INSERT INTO t1 (x) select (SELECT SUM(x)+2 FROM t1) FROM t2; -ERROR HY000: You can't specify target table 't1' for update in FROM clause INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(x) FROM t2)); ERROR 42S22: Unknown column 'x' in 'field list' INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2)); @@ -618,6 +617,8 @@ x 2 3 3 +11 +11 2 drop table t1, t2, t3; CREATE TABLE t1 (x int not null, y int, primary key (x)); @@ -667,7 +668,7 @@ EXPLAIN SELECT * FROM t2 WHERE id IN (SELECT 1); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 ref id id 5 const 1 Using where; Using index Warnings: -Note 1247 Select 2 was reduced during optimisation +Note 1248 Select 2 was reduced during optimisation SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3); id 1 @@ -679,8 +680,8 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 ref id id 5 const 1 Using where; Using index 3 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1247 Select 3 was reduced during optimisation -Note 1247 Select 2 was reduced during optimisation +Note 1248 Select 3 was reduced during optimisation +Note 1248 Select 2 was reduced during optimisation EXPLAIN SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 index NULL id 5 NULL 2 Using where; Using index @@ -809,7 +810,7 @@ explain select (select a+1) from t1; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Warnings: -Note 1247 Select 2 was reduced during optimisation +Note 1248 Select 2 was reduced during optimisation select (select a+1) from t1; (select a+1) 2.5 @@ -973,12 +974,12 @@ UNIQUE KEY `maxnumrep` (`maxnumrep`) ) TYPE=MyISAM CHARSET=latin1; INSERT INTO t1 VALUES ('joce','1','','joce'),('test','2','','test'); Warnings: -Warning 1263 Data truncated for column 'date' at row 1 -Warning 1263 Data truncated for column 'date' at row 2 +Warning 1264 Data truncated for column 'date' at row 1 +Warning 1264 Data truncated for column 'date' at row 2 INSERT INTO t2 VALUES ('joce','1','','joce'),('test','2','','test'); Warnings: -Warning 1263 Data truncated for column 'date' at row 1 -Warning 1263 Data truncated for column 'date' at row 2 +Warning 1264 Data truncated for column 'date' at row 1 +Warning 1264 Data truncated for column 'date' at row 2 INSERT INTO t3 VALUES (1,1); SELECT DISTINCT topic FROM t2 WHERE NOT EXISTS(SELECT * FROM t3 WHERE numeropost=topic); @@ -1159,7 +1160,7 @@ insert into t1 values (1,0), (2,0), (3,0); insert into t2 values (1,1), (2,1), (3,1), (2,2); update ignore t1 set b=(select b from t2 where t1.a=t2.a); Warnings: -Error 1240 Subselect returns more than 1 record +Error 1241 Subselect returns more than 1 record select * from t1; a b 1 1 diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result index 592c787031f..f12be1d363c 100644 --- a/mysql-test/r/type_blob.result +++ b/mysql-test/r/type_blob.result @@ -9,9 +9,9 @@ d mediumtext YES NULL e longtext YES NULL CREATE TABLE t2 (a char(257), b varchar(70000) binary, c varchar(70000000)); Warnings: -Warning 1244 Converting column 'a' from CHAR to TEXT -Warning 1244 Converting column 'b' from CHAR to BLOB -Warning 1244 Converting column 'c' from CHAR to TEXT +Warning 1245 Converting column 'a' from CHAR to TEXT +Warning 1245 Converting column 'b' from CHAR to BLOB +Warning 1245 Converting column 'c' from CHAR to TEXT show columns from t2; Field Type Null Key Default Extra a text YES NULL diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result index b31ef73742d..da25394eb08 100644 --- a/mysql-test/r/type_decimal.result +++ b/mysql-test/r/type_decimal.result @@ -1,4 +1,5 @@ DROP TABLE IF EXISTS t1; +SET SQL_WARNINGS=1; CREATE TABLE t1 ( id int(11) NOT NULL auto_increment, datatype_id int(11) DEFAULT '0' NOT NULL, @@ -157,17 +158,17 @@ insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001"); insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11"); insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11"); Warnings: -Warning 1262 Data truncated, out of range for column 'a' at row 1 -Warning 1262 Data truncated, out of range for column 'a' at row 2 -Warning 1262 Data truncated, out of range for column 'a' at row 3 +Warning 1263 Data truncated, out of range for column 'a' at row 1 +Warning 1263 Data truncated, out of range for column 'a' at row 2 +Warning 1263 Data truncated, out of range for column 'a' at row 3 insert into t1 values ("1e+1000"),("1e-1000"),("-1e+1000"); Warnings: -Warning 1262 Data truncated, out of range for column 'a' at row 1 -Warning 1263 Data truncated for column 'a' at row 2 -Warning 1262 Data truncated, out of range for column 'a' at row 3 +Warning 1263 Data truncated, out of range for column 'a' at row 1 +Warning 1264 Data truncated for column 'a' at row 2 +Warning 1263 Data truncated, out of range for column 'a' at row 3 insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0"); Warnings: -Warning 1263 Data truncated for column 'a' at row 3 +Warning 1264 Data truncated for column 'a' at row 3 select * from t1; a 0.00 @@ -200,32 +201,32 @@ drop table t1; create table t1 (a decimal(10,2) unsigned); insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0"); Warnings: -Warning 1262 Data truncated, out of range for column 'a' at row 2 -Warning 1262 Data truncated, out of range for column 'a' at row 6 +Warning 1263 Data truncated, out of range for column 'a' at row 2 +Warning 1263 Data truncated, out of range for column 'a' at row 6 insert into t1 values ("-.1"),("+.1"),(".1"); Warnings: -Warning 1262 Data truncated, out of range for column 'a' at row 1 +Warning 1263 Data truncated, out of range for column 'a' at row 1 insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001"); Warnings: -Warning 1262 Data truncated, out of range for column 'a' at row 3 +Warning 1263 Data truncated, out of range for column 'a' at row 3 insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11"); Warnings: -Warning 1262 Data truncated, out of range for column 'a' at row 1 -Warning 1262 Data truncated, out of range for column 'a' at row 2 -Warning 1262 Data truncated, out of range for column 'a' at row 3 +Warning 1263 Data truncated, out of range for column 'a' at row 1 +Warning 1263 Data truncated, out of range for column 'a' at row 2 +Warning 1263 Data truncated, out of range for column 'a' at row 3 insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11"); Warnings: -Warning 1262 Data truncated, out of range for column 'a' at row 1 -Warning 1262 Data truncated, out of range for column 'a' at row 2 -Warning 1262 Data truncated, out of range for column 'a' at row 3 +Warning 1263 Data truncated, out of range for column 'a' at row 1 +Warning 1263 Data truncated, out of range for column 'a' at row 2 +Warning 1263 Data truncated, out of range for column 'a' at row 3 insert into t1 values ("1e+1000"),("1e-1000"),("-1e+1000"); Warnings: -Warning 1262 Data truncated, out of range for column 'a' at row 1 -Warning 1263 Data truncated for column 'a' at row 2 -Warning 1262 Data truncated, out of range for column 'a' at row 3 +Warning 1263 Data truncated, out of range for column 'a' at row 1 +Warning 1264 Data truncated for column 'a' at row 2 +Warning 1263 Data truncated, out of range for column 'a' at row 3 insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0"); Warnings: -Warning 1263 Data truncated for column 'a' at row 3 +Warning 1264 Data truncated for column 'a' at row 3 select * from t1; a 0.00 @@ -258,32 +259,32 @@ drop table t1; create table t1 (a decimal(10,2) zerofill); insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0"); Warnings: -Warning 1262 Data truncated, out of range for column 'a' at row 2 -Warning 1262 Data truncated, out of range for column 'a' at row 6 +Warning 1263 Data truncated, out of range for column 'a' at row 2 +Warning 1263 Data truncated, out of range for column 'a' at row 6 insert into t1 values ("-.1"),("+.1"),(".1"); Warnings: -Warning 1262 Data truncated, out of range for column 'a' at row 1 +Warning 1263 Data truncated, out of range for column 'a' at row 1 insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001"); Warnings: -Warning 1262 Data truncated, out of range for column 'a' at row 3 +Warning 1263 Data truncated, out of range for column 'a' at row 3 insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11"); Warnings: -Warning 1262 Data truncated, out of range for column 'a' at row 1 -Warning 1262 Data truncated, out of range for column 'a' at row 2 -Warning 1262 Data truncated, out of range for column 'a' at row 3 +Warning 1263 Data truncated, out of range for column 'a' at row 1 +Warning 1263 Data truncated, out of range for column 'a' at row 2 +Warning 1263 Data truncated, out of range for column 'a' at row 3 insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11"); Warnings: -Warning 1262 Data truncated, out of range for column 'a' at row 1 -Warning 1262 Data truncated, out of range for column 'a' at row 2 -Warning 1262 Data truncated, out of range for column 'a' at row 3 +Warning 1263 Data truncated, out of range for column 'a' at row 1 +Warning 1263 Data truncated, out of range for column 'a' at row 2 +Warning 1263 Data truncated, out of range for column 'a' at row 3 insert into t1 values ("1e+1000"),("1e-1000"),("-1e+1000"); Warnings: -Warning 1262 Data truncated, out of range for column 'a' at row 1 -Warning 1263 Data truncated for column 'a' at row 2 -Warning 1262 Data truncated, out of range for column 'a' at row 3 +Warning 1263 Data truncated, out of range for column 'a' at row 1 +Warning 1264 Data truncated for column 'a' at row 2 +Warning 1263 Data truncated, out of range for column 'a' at row 3 insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0"); Warnings: -Warning 1263 Data truncated for column 'a' at row 3 +Warning 1264 Data truncated for column 'a' at row 3 select * from t1; a 00000000.00 @@ -320,13 +321,13 @@ insert into t1 values (00000000000001),(+0000000000001),(-0000000000001); insert into t1 values (+111111111.11),(111111111.11),(-11111111.11); insert into t1 values (-111111111.11),(+1111111111.11),(1111111111.11); Warnings: -Warning 1262 Data truncated, out of range for column 'a' at row 1 -Warning 1262 Data truncated, out of range for column 'a' at row 2 -Warning 1262 Data truncated, out of range for column 'a' at row 3 +Warning 1263 Data truncated, out of range for column 'a' at row 1 +Warning 1263 Data truncated, out of range for column 'a' at row 2 +Warning 1263 Data truncated, out of range for column 'a' at row 3 insert into t1 values (1e+100),(1e-100),(-1e+100); Warnings: -Warning 1262 Data truncated, out of range for column 'a' at row 1 -Warning 1262 Data truncated, out of range for column 'a' at row 3 +Warning 1263 Data truncated, out of range for column 'a' at row 1 +Warning 1263 Data truncated, out of range for column 'a' at row 3 insert into t1 values (123.4e0),(123.4e+2),(123.4e-2),(123e1),(123e+0); select * from t1; a @@ -360,8 +361,8 @@ drop table t1; create table t1 (a decimal); insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+12345678901'),(99999999999999); Warnings: -Warning 1262 Data truncated, out of range for column 'a' at row 1 -Warning 1262 Data truncated, out of range for column 'a' at row 7 +Warning 1263 Data truncated, out of range for column 'a' at row 1 +Warning 1263 Data truncated, out of range for column 'a' at row 7 select * from t1; a -9999999999 @@ -375,9 +376,9 @@ drop table t1; create table t1 (a decimal unsigned); insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999); Warnings: -Warning 1262 Data truncated, out of range for column 'a' at row 1 -Warning 1262 Data truncated, out of range for column 'a' at row 2 -Warning 1262 Data truncated, out of range for column 'a' at row 7 +Warning 1263 Data truncated, out of range for column 'a' at row 1 +Warning 1263 Data truncated, out of range for column 'a' at row 2 +Warning 1263 Data truncated, out of range for column 'a' at row 7 select * from t1; a 0 @@ -391,9 +392,9 @@ drop table t1; create table t1 (a decimal zerofill); insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999); Warnings: -Warning 1262 Data truncated, out of range for column 'a' at row 1 -Warning 1262 Data truncated, out of range for column 'a' at row 2 -Warning 1262 Data truncated, out of range for column 'a' at row 7 +Warning 1263 Data truncated, out of range for column 'a' at row 1 +Warning 1263 Data truncated, out of range for column 'a' at row 2 +Warning 1263 Data truncated, out of range for column 'a' at row 7 select * from t1; a 0000000000 @@ -407,9 +408,9 @@ drop table t1; create table t1 (a decimal unsigned zerofill); insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999); Warnings: -Warning 1262 Data truncated, out of range for column 'a' at row 1 -Warning 1262 Data truncated, out of range for column 'a' at row 2 -Warning 1262 Data truncated, out of range for column 'a' at row 7 +Warning 1263 Data truncated, out of range for column 'a' at row 1 +Warning 1263 Data truncated, out of range for column 'a' at row 2 +Warning 1263 Data truncated, out of range for column 'a' at row 7 select * from t1; a 0000000000 @@ -423,14 +424,16 @@ drop table t1; create table t1(a decimal(10,0)); insert into t1 values ("1e4294967295"); Warnings: -Warning 1262 Data truncated, out of range for column 'a' at row 1 +Warning 1264 Data truncated for column 'a' at row 1 +Warning 1263 Data truncated, out of range for column 'a' at row 1 select * from t1; a 99999999999 delete from t1; insert into t1 values("1e4294967297"); Warnings: -Warning 1262 Data truncated, out of range for column 'a' at row 1 +Warning 1264 Data truncated for column 'a' at row 1 +Warning 1263 Data truncated, out of range for column 'a' at row 1 select * from t1; a 99999999999 diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result index 76f82feb50e..987fa9d5685 100644 --- a/mysql-test/r/type_float.result +++ b/mysql-test/r/type_float.result @@ -15,8 +15,8 @@ f1 float NULL YES NULL select,insert,update,references f2 double NULL YES NULL select,insert,update,references insert into t1 values(10,10),(1e+5,1e+5),(1234567890,1234567890),(1e+10,1e+10),(1e+15,1e+15),(1e+20,1e+20),(1e+50,1e+50),(1e+150,1e+150); Warnings: -Warning 1262 Data truncated, out of range for column 'f1' at row 7 -Warning 1262 Data truncated, out of range for column 'f1' at row 8 +Warning 1263 Data truncated, out of range for column 'f1' at row 7 +Warning 1263 Data truncated, out of range for column 'f1' at row 8 insert into t1 values(-10,-10),(1e-5,1e-5),(1e-10,1e-10),(1e-15,1e-15),(1e-20,1e-20),(1e-50,1e-50),(1e-150,1e-150); select * from t1; f1 f2 diff --git a/mysql-test/r/type_ranges.result b/mysql-test/r/type_ranges.result index 34ae1086e2c..b665f78bbce 100644 --- a/mysql-test/r/type_ranges.result +++ b/mysql-test/r/type_ranges.result @@ -1,4 +1,5 @@ drop table if exists t1,t2,t3; +SET SQL_WARNINGS=1; CREATE TABLE t1 ( auto int(5) unsigned NOT NULL auto_increment, string char(10) default "hello", @@ -88,33 +89,34 @@ insert into t1 values (NULL,2,2,2,2,2,2,2,2,2,2,2,2,2,NULL,NULL,NULL,NULL,NULL,N insert into t1 values (0,1/3,3,3,3,3,3,3,3,3,3,3,3,3,NULL,'19970303','10:10:10','19970303101010','','','','3',3,3); insert into t1 values (0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,NULL,19970807,080706,19970403090807,-1,-1,-1,'-1',-1,-1); Warnings: -Warning 1262 Data truncated, out of range for column 'utiny' at row 1 -Warning 1262 Data truncated, out of range for column 'ushort' at row 1 -Warning 1262 Data truncated, out of range for column 'umedium' at row 1 -Warning 1262 Data truncated, out of range for column 'ulong' at row 1 -Warning 1263 Data truncated for column 'options' at row 1 -Warning 1263 Data truncated for column 'flags' at row 1 +Warning 1263 Data truncated, out of range for column 'utiny' at row 1 +Warning 1263 Data truncated, out of range for column 'ushort' at row 1 +Warning 1263 Data truncated, out of range for column 'umedium' at row 1 +Warning 1263 Data truncated, out of range for column 'ulong' at row 1 +Warning 1264 Data truncated for column 'options' at row 1 +Warning 1264 Data truncated for column 'flags' at row 1 insert into t1 values (0,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,-4294967295,NULL,0,0,0,-4294967295,-4294967295,-4294967295,'-4294967295',0,"one,two,tree"); Warnings: -Warning 1262 Data truncated, out of range for column 'tiny' at row 1 -Warning 1262 Data truncated, out of range for column 'short' at row 1 -Warning 1262 Data truncated, out of range for column 'medium' at row 1 -Warning 1262 Data truncated, out of range for column 'long_int' at row 1 -Warning 1262 Data truncated, out of range for column 'utiny' at row 1 -Warning 1262 Data truncated, out of range for column 'ushort' at row 1 -Warning 1262 Data truncated, out of range for column 'umedium' at row 1 -Warning 1262 Data truncated, out of range for column 'ulong' at row 1 -Warning 1263 Data truncated for column 'options' at row 1 +Warning 1264 Data truncated for column 'string' at row 1 +Warning 1263 Data truncated, out of range for column 'tiny' at row 1 +Warning 1263 Data truncated, out of range for column 'short' at row 1 +Warning 1263 Data truncated, out of range for column 'medium' at row 1 +Warning 1263 Data truncated, out of range for column 'long_int' at row 1 +Warning 1263 Data truncated, out of range for column 'utiny' at row 1 +Warning 1263 Data truncated, out of range for column 'ushort' at row 1 +Warning 1263 Data truncated, out of range for column 'umedium' at row 1 +Warning 1263 Data truncated, out of range for column 'ulong' at row 1 +Warning 1264 Data truncated for column 'options' at row 1 insert into t1 values (0,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,4294967295,NULL,0,0,0,4294967295,4294967295,4294967295,'4294967295',0,0); Warnings: -Warning 1262 Data truncated, out of range for column 'tiny' at row 1 -Warning 1262 Data truncated, out of range for column 'short' at row 1 -Warning 1262 Data truncated, out of range for column 'medium' at row 1 -Warning 1262 Data truncated, out of range for column 'long_int' at row 1 -Warning 1262 Data truncated, out of range for column 'utiny' at row 1 -Warning 1262 Data truncated, out of range for column 'ushort' at row 1 -Warning 1262 Data truncated, out of range for column 'umedium' at row 1 -Warning 1263 Data truncated for column 'options' at row 1 +Warning 1263 Data truncated, out of range for column 'tiny' at row 1 +Warning 1263 Data truncated, out of range for column 'short' at row 1 +Warning 1263 Data truncated, out of range for column 'medium' at row 1 +Warning 1263 Data truncated, out of range for column 'long_int' at row 1 +Warning 1263 Data truncated, out of range for column 'utiny' at row 1 +Warning 1263 Data truncated, out of range for column 'ushort' at row 1 +Warning 1263 Data truncated, out of range for column 'umedium' at row 1 +Warning 1264 Data truncated for column 'options' at row 1 insert into t1 (tiny) values (1); select auto,string,tiny,short,medium,long_int,longlong,real_float,real_double,utiny,ushort,umedium,ulong,ulonglong,mod(floor(time_stamp/1000000),1000000)-mod(curdate(),1000000),date_field,time_field,date_time,blob_col,tinyblob_col,mediumblob_col,longblob_col from t1; auto string tiny short medium long_int longlong real_float real_double utiny ushort umedium ulong ulonglong mod(floor(time_stamp/1000000),1000000)-mod(curdate(),1000000) date_field time_field date_time blob_col tinyblob_col mediumblob_col longblob_col @@ -163,12 +165,12 @@ PRIMARY KEY (auto) ); INSERT INTO t2 (string,mediumblob_col,new_field) SELECT string,mediumblob_col,new_field from t1 where auto > 10; Warnings: -Warning 1263 Data truncated for column 'new_field' at row 2 -Warning 1263 Data truncated for column 'new_field' at row 3 -Warning 1263 Data truncated for column 'new_field' at row 4 -Warning 1263 Data truncated for column 'new_field' at row 5 -Warning 1263 Data truncated for column 'new_field' at row 6 -Warning 1263 Data truncated for column 'new_field' at row 7 +Warning 1264 Data truncated for column 'new_field' at row 2 +Warning 1264 Data truncated for column 'new_field' at row 3 +Warning 1264 Data truncated for column 'new_field' at row 4 +Warning 1264 Data truncated for column 'new_field' at row 5 +Warning 1264 Data truncated for column 'new_field' at row 6 +Warning 1264 Data truncated for column 'new_field' at row 7 select * from t2; auto string mediumblob_col new_field 1 2 2 ne @@ -200,9 +202,9 @@ one one drop table t2; create table t2 select * from t1; Warnings: -Warning 1263 Data truncated for column 'options' at row 4 -Warning 1263 Data truncated for column 'options' at row 5 -Warning 1263 Data truncated for column 'options' at row 6 +Warning 1264 Data truncated for column 'options' at row 4 +Warning 1264 Data truncated for column 'options' at row 5 +Warning 1264 Data truncated for column 'options' at row 6 update t2 set string="changed" where auto=16; show full columns from t1; Field Type Collation Null Key Default Extra Privileges Comment diff --git a/mysql-test/r/type_time.result b/mysql-test/r/type_time.result index 27f2de823c6..5666e865518 100644 --- a/mysql-test/r/type_time.result +++ b/mysql-test/r/type_time.result @@ -25,9 +25,9 @@ t 36:30:31 insert into t1 values("10.22.22"),(1234567),(123456789),(123456789.10),("10 22:22"),("12.45a"); Warnings: -Warning 1262 Data truncated, out of range for column 't' at row 2 -Warning 1262 Data truncated, out of range for column 't' at row 3 -Warning 1262 Data truncated, out of range for column 't' at row 4 +Warning 1263 Data truncated, out of range for column 't' at row 2 +Warning 1263 Data truncated, out of range for column 't' at row 3 +Warning 1263 Data truncated, out of range for column 't' at row 4 select * from t1; t 10:22:33 diff --git a/mysql-test/r/type_uint.result b/mysql-test/r/type_uint.result index ee81295e696..d948ca47972 100644 --- a/mysql-test/r/type_uint.result +++ b/mysql-test/r/type_uint.result @@ -1,9 +1,10 @@ drop table if exists t1; +SET SQL_WARNINGS=1; create table t1 (this int unsigned); insert into t1 values (1); insert into t1 values (-1); Warnings: -Warning 1262 Data truncated, out of range for column 'this' at row 1 +Warning 1263 Data truncated, out of range for column 'this' at row 1 select * from t1; this 1 diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index c29859bd4d4..396eba7197b 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -90,6 +90,13 @@ explain (select a,b from t1 limit 2) union all (select a,b from t2 order by a l id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 4 2 UNION t2 ALL NULL NULL NULL NULL 4 Using filesort +(select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2; +a b +1 a +2 b +select found_rows(); +found_rows() +6 select sql_calc_found_rows a,b from t1 union all select a,b from t2 limit 2; a b 1 a @@ -358,7 +365,7 @@ explain (select * from t1 where a=1 and b=10) union (select t1.a,t2.a from t1,t2 id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables 2 UNION t1 index PRIMARY PRIMARY 4 NULL 4 Using index -2 UNION t2 index PRIMARY PRIMARY 4 NULL 4 Using where; Using index +2 UNION t2 index PRIMARY PRIMARY 4 NULL 3 Using where; Using index explain (select * from t1 where a=1) union (select * from t1 where b=1); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 const PRIMARY PRIMARY 4 const 1 diff --git a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result index 0ad165a861a..9d4710ff729 100644 --- a/mysql-test/r/warnings.result +++ b/mysql-test/r/warnings.result @@ -2,23 +2,24 @@ drop table if exists t1, t2; Warnings: Note 1051 Unknown table 't1' Note 1051 Unknown table 't2' +SET SQL_WARNINGS=1; create table t1 (a int); insert into t1 values (1); insert into t1 values ("hej"); Warnings: -Warning 1263 Data truncated for column 'a' at row 1 +Warning 1264 Data truncated for column 'a' at row 1 insert into t1 values ("hej"),("då"); Warnings: -Warning 1263 Data truncated for column 'a' at row 1 -Warning 1263 Data truncated for column 'a' at row 2 +Warning 1264 Data truncated for column 'a' at row 1 +Warning 1264 Data truncated for column 'a' at row 2 set SQL_WARNINGS=1; insert into t1 values ("hej"); Warnings: -Warning 1263 Data truncated for column 'a' at row 1 +Warning 1264 Data truncated for column 'a' at row 1 insert into t1 values ("hej"),("då"); Warnings: -Warning 1263 Data truncated for column 'a' at row 1 -Warning 1263 Data truncated for column 'a' at row 2 +Warning 1264 Data truncated for column 'a' at row 1 +Warning 1264 Data truncated for column 'a' at row 2 drop table t1; set SQL_WARNINGS=0; drop temporary table if exists not_exists; @@ -45,13 +46,13 @@ drop table t1; create table t1(a tinyint, b int not null, c date, d char(5)); load data infile '../../std_data/warnings_loaddata.dat' into table t1 fields terminated by ','; Warnings: -Warning 1261 Data truncated, NULL supplied to NOT NULL column 'b' at row 2 -Warning 1263 Data truncated for column 'd' at row 3 -Warning 1263 Data truncated for column 'c' at row 4 -Warning 1259 Record count is fewer than the column count at row 5 -Warning 1263 Data truncated for column 'b' at row 6 -Warning 1260 Record count is more than the column count at row 7 -Warning 1262 Data truncated, out of range for column 'a' at row 8 +Warning 1262 Data truncated, NULL supplied to NOT NULL column 'b' at row 2 +Warning 1264 Data truncated for column 'd' at row 3 +Warning 1264 Data truncated for column 'c' at row 4 +Warning 1260 Record count is fewer than the column count at row 5 +Warning 1264 Data truncated for column 'b' at row 6 +Warning 1261 Record count is more than the column count at row 7 +Warning 1263 Data truncated, out of range for column 'a' at row 8 select @@warning_count; @@warning_count 7 @@ -59,42 +60,42 @@ drop table t1; create table t1(a tinyint NOT NULL, b tinyint unsigned, c char(5)); insert into t1 values(NULL,100,'mysql'),(10,-1,'mysql ab'),(500,256,'open source'),(20,NULL,'test'); Warnings: -Warning 1261 Data truncated, NULL supplied to NOT NULL column 'a' at row 1 -Warning 1262 Data truncated, out of range for column 'b' at row 2 -Warning 1263 Data truncated for column 'c' at row 2 -Warning 1262 Data truncated, out of range for column 'a' at row 3 -Warning 1262 Data truncated, out of range for column 'b' at row 3 -Warning 1263 Data truncated for column 'c' at row 3 +Warning 1262 Data truncated, NULL supplied to NOT NULL column 'a' at row 1 +Warning 1263 Data truncated, out of range for column 'b' at row 2 +Warning 1264 Data truncated for column 'c' at row 2 +Warning 1263 Data truncated, out of range for column 'a' at row 3 +Warning 1263 Data truncated, out of range for column 'b' at row 3 +Warning 1264 Data truncated for column 'c' at row 3 alter table t1 modify c char(4); Warnings: -Warning 1263 Data truncated for column 'c' at row 1 -Warning 1263 Data truncated for column 'c' at row 2 +Warning 1264 Data truncated for column 'c' at row 1 +Warning 1264 Data truncated for column 'c' at row 2 alter table t1 add d char(2); update t1 set a=NULL where a=10; Warnings: -Warning 1261 Data truncated, NULL supplied to NOT NULL column 'a' at row 2 +Warning 1262 Data truncated, NULL supplied to NOT NULL column 'a' at row 2 update t1 set c='mysql ab' where c='test'; Warnings: -Warning 1263 Data truncated for column 'c' at row 4 +Warning 1264 Data truncated for column 'c' at row 4 update t1 set d=c; Warnings: -Warning 1263 Data truncated for column 'd' at row 1 -Warning 1263 Data truncated for column 'd' at row 2 -Warning 1263 Data truncated for column 'd' at row 3 -Warning 1263 Data truncated for column 'd' at row 4 +Warning 1264 Data truncated for column 'd' at row 1 +Warning 1264 Data truncated for column 'd' at row 2 +Warning 1264 Data truncated for column 'd' at row 3 +Warning 1264 Data truncated for column 'd' at row 4 create table t2(a tinyint NOT NULL, b char(3)); insert into t2 select b,c from t1; Warnings: -Warning 1263 Data truncated for column 'b' at row 1 -Warning 1263 Data truncated for column 'b' at row 2 -Warning 1263 Data truncated for column 'b' at row 3 -Warning 1261 Data truncated, NULL supplied to NOT NULL column 'a' at row 4 -Warning 1263 Data truncated for column 'b' at row 4 +Warning 1264 Data truncated for column 'b' at row 1 +Warning 1264 Data truncated for column 'b' at row 2 +Warning 1264 Data truncated for column 'b' at row 3 +Warning 1262 Data truncated, NULL supplied to NOT NULL column 'a' at row 4 +Warning 1264 Data truncated for column 'b' at row 4 insert into t2(b) values('mysqlab'); set sql_warnings=1; insert into t2(b) values('mysqlab'); Warnings: -Warning 1263 Data truncated for column 'b' at row 1 +Warning 1264 Data truncated for column 'b' at row 1 set sql_warnings=0; drop table t1, t2; create table t1(a char(10)); @@ -102,24 +103,24 @@ alter table t1 add b char; set max_error_count=10; update t1 set b=a; Warnings: -Warning 1263 Data truncated for column 'b' at row 1 -Warning 1263 Data truncated for column 'b' at row 2 -Warning 1263 Data truncated for column 'b' at row 3 -Warning 1263 Data truncated for column 'b' at row 4 -Warning 1263 Data truncated for column 'b' at row 5 -Warning 1263 Data truncated for column 'b' at row 6 -Warning 1263 Data truncated for column 'b' at row 7 -Warning 1263 Data truncated for column 'b' at row 8 -Warning 1263 Data truncated for column 'b' at row 9 -Warning 1263 Data truncated for column 'b' at row 10 +Warning 1264 Data truncated for column 'b' at row 1 +Warning 1264 Data truncated for column 'b' at row 2 +Warning 1264 Data truncated for column 'b' at row 3 +Warning 1264 Data truncated for column 'b' at row 4 +Warning 1264 Data truncated for column 'b' at row 5 +Warning 1264 Data truncated for column 'b' at row 6 +Warning 1264 Data truncated for column 'b' at row 7 +Warning 1264 Data truncated for column 'b' at row 8 +Warning 1264 Data truncated for column 'b' at row 9 +Warning 1264 Data truncated for column 'b' at row 10 select @@warning_count; @@warning_count 50 drop table t1; create table t1 (id int) type=isam; Warnings: -Warning 1264 Using storage engine MYISAM for table 't1' +Warning 1265 Using storage engine MYISAM for table 't1' alter table t1 type=isam; Warnings: -Warning 1264 Using storage engine MYISAM for table 't1' +Warning 1265 Using storage engine MYISAM for table 't1' drop table t1; diff --git a/mysql-test/t/auto_increment.test b/mysql-test/t/auto_increment.test index b46993ec6dd..a036121f297 100644 --- a/mysql-test/t/auto_increment.test +++ b/mysql-test/t/auto_increment.test @@ -4,6 +4,7 @@ --disable_warnings drop table if exists t1; --enable_warnings +SET SQL_WARNINGS=1; create table t1 (a int not null auto_increment,b int, primary key (a)) type=myisam auto_increment=3; insert into t1 values (1,1),(NULL,3),(NULL,4); diff --git a/mysql-test/t/case.test b/mysql-test/t/case.test index 8aa17061174..4d4ceb062e4 100644 --- a/mysql-test/t/case.test +++ b/mysql-test/t/case.test @@ -60,14 +60,14 @@ CREATE TABLE t1 SELECT SHOW CREATE TABLE t1; DROP TABLE t1; ---error 1265 +--error 1266 SELECT CASE WHEN 1 THEN _latin1'a' COLLATE latin1_danish_ci ELSE _latin1'a' COLLATE latin1_swedish_ci END; ---error 1268 +--error 1269 SELECT CASE _latin1'a' COLLATE latin1_general_ci WHEN _latin1'a' COLLATE latin1_danish_ci THEN 1 WHEN _latin1'a' COLLATE latin1_swedish_ci THEN 2 @@ -90,9 +90,9 @@ CASE _latin1'a' WHEN _latin1'A' COLLATE latin1_bin THEN '1' ELSE 2 END # # Check COALESCE argument types aggregation ---error 1265 +--error 1266 CREATE TABLE t1 SELECT COALESCE(_latin1'a',_latin2'a'); ---error 1265 +--error 1266 CREATE TABLE t1 SELECT COALESCE('a' COLLATE latin1_swedish_ci,'b' COLLATE latin1_bin); CREATE TABLE t1 SELECT COALESCE(1), COALESCE(1.0),COALESCE('a'), diff --git a/mysql-test/t/convert.test b/mysql-test/t/convert.test deleted file mode 100644 index f26ef3a8c72..00000000000 --- a/mysql-test/t/convert.test +++ /dev/null @@ -1,11 +0,0 @@ -# Test of character set conversions - -# Test that SET DEFAULT works - -select @@convert_character_set; -select @@global.convert_character_set; -show variables like "%convert_character_set%"; -SET CHARACTER SET cp1251_koi8; -select @@convert_character_set; -SET CHARACTER SET DEFAULT; -select @@convert_character_set; diff --git a/mysql-test/t/ctype_collate.test b/mysql-test/t/ctype_collate.test index 23039a4b116..d42696e693b 100644 --- a/mysql-test/t/ctype_collate.test +++ b/mysql-test/t/ctype_collate.test @@ -7,12 +7,12 @@ CREATE TABLE t1 ( latin1_f CHAR(32) CHARACTER SET latin1 NOT NULL ); ---error 1251 +--error 1252 CREATE TABLE t2 ( latin1_f CHAR(32) CHARACTER SET latin1 COLLATE koi8r_general_ci NOT NULL ); ---error 1271 +--error 1272 CREATE TABLE t2 ( latin1_f CHAR(32) CHARACTER SET latin1 COLLATE some_non_existing_col NOT NULL ); @@ -66,7 +66,7 @@ SELECT latin1_f FROM t1 ORDER BY latin1_f COLLATE latin1_swedish_ci; SELECT latin1_f FROM t1 ORDER BY latin1_f COLLATE latin1_german2_ci; SELECT latin1_f FROM t1 ORDER BY latin1_f COLLATE latin1_general_ci; SELECT latin1_f FROM t1 ORDER BY latin1_f COLLATE latin1_bin; ---error 1251 +--error 1252 SELECT latin1_f FROM t1 ORDER BY latin1_f COLLATE koi8r_general_ci; --SELECT latin1_f COLLATE koi8r FROM t1 ; @@ -76,7 +76,7 @@ SELECT latin1_f COLLATE latin1_swedish_ci AS latin1_f_as FROM t1 ORDER BY latin1 SELECT latin1_f COLLATE latin1_german2_ci AS latin1_f_as FROM t1 ORDER BY latin1_f_as; SELECT latin1_f COLLATE latin1_general_ci AS latin1_f_as FROM t1 ORDER BY latin1_f_as; SELECT latin1_f COLLATE latin1_bin AS latin1_f_as FROM t1 ORDER BY latin1_f_as; ---error 1251 +--error 1252 SELECT latin1_f COLLATE koi8r_general_ci AS latin1_f_as FROM t1 ORDER BY latin1_f_as; @@ -87,7 +87,7 @@ SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f COLLATE latin1_swedish_ci; SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f COLLATE latin1_german2_ci; SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f COLLATE latin1_general_ci; SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f COLLATE latin1_bin; ---error 1251 +--error 1252 SELECT latin1_f,count(*) FROM t1 GROUP BY latin1_f COLLATE koi8r_general_ci; @@ -98,7 +98,7 @@ SELECT DISTINCT latin1_f COLLATE latin1_swedish_ci FROM t1; SELECT DISTINCT latin1_f COLLATE latin1_german2_ci FROM t1; SELECT DISTINCT latin1_f COLLATE latin1_general_ci FROM t1; SELECT DISTINCT latin1_f COLLATE latin1_bin FROM t1; ---error 1271 +--error 1272 SELECT DISTINCT latin1_f COLLATE koi8r FROM t1; @@ -152,7 +152,6 @@ DROP TABLE t1; CREATE TABLE t1 (s1 CHAR(5) COLLATE latin1_german1_ci, s2 CHAR(5) COLLATE latin1_swedish_ci); ---error 1265 +--error 1266 SELECT * FROM t1 WHERE s1 = s2; DROP TABLE t1; -
\ No newline at end of file diff --git a/mysql-test/t/ctype_latin1_de.test b/mysql-test/t/ctype_latin1_de.test index afad89729b4..52ee227b011 100644 --- a/mysql-test/t/ctype_latin1_de.test +++ b/mysql-test/t/ctype_latin1_de.test @@ -1,9 +1,13 @@ # # Test latin_de character set # + +select @@collation_connection; + --disable_warnings drop table if exists t1; --enable_warnings + create table t1 (a char (20) not null, b int not null auto_increment, index (a,b)); insert into t1 (a) values ('ä'),('ac'),('ae'),('ad'),('Äc'),('aeb'); insert into t1 (a) values ('üc'),('uc'),('ue'),('ud'),('Ü'),('ueb'),('uf'); diff --git a/mysql-test/t/drop.test b/mysql-test/t/drop.test index e624ded0102..a55cbb45fd9 100644 --- a/mysql-test/t/drop.test +++ b/mysql-test/t/drop.test @@ -1,6 +1,7 @@ # Initialise --disable_warnings drop table if exists t1; +drop database if exists mysqltest; --enable_warnings --error 1051; @@ -17,7 +18,6 @@ select * from t1; # now test for a bug in drop database - it is important that the name # of the table is the same as the name of the database - in the original # code this triggered a bug -drop database if exists mysqltest; create database mysqltest; drop database if exists mysqltest; create database mysqltest; diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test index 105612bf238..689b061f88d 100644 --- a/mysql-test/t/func_in.test +++ b/mysql-test/t/func_in.test @@ -61,11 +61,11 @@ c char(1) character set latin1 collate latin1_danish_ci ); insert into t1 values ('A','B','C'); insert into t1 values ('a','c','c'); ---error 1265 +--error 1266 select * from t1 where a in (b); ---error 1268 -select * from t1 where a in (b,c); --error 1269 +select * from t1 where a in (b,c); +--error 1270 select * from t1 where 'a' in (a,b,c); select * from t1 where 'a' in (a); select * from t1 where a in ('a'); diff --git a/mysql-test/t/func_set.test b/mysql-test/t/func_set.test index e462e0a96c3..b152c94096c 100644 --- a/mysql-test/t/func_set.test +++ b/mysql-test/t/func_set.test @@ -15,6 +15,7 @@ select export_set(9,"Y","N","-",5),export_set(9,"Y","N"),export_set(9,"Y","N","" select elt(2,1),field(NULL,"a","b","c"); select find_in_set("","a,b,c"),find_in_set("","a,b,c,"),find_in_set("",",a,b,c"); select find_in_set("abc","abc"),find_in_set("ab","abc"),find_in_set("abcd","abc"); +select interval(null, 1, 10, 100); # # test for a bug with elt() @@ -33,4 +34,3 @@ insert into t2 values (1,1),(2,1),(3,1),(4,2); select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id; select one.id, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id order by one.id; drop table t1,t2; -select interval(null, 1, 10, 100); diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index 14267976104..b421f47e5b8 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -143,20 +143,20 @@ select 1=_latin1'1'; select _latin1'1'=1; select _latin2'1'=1; select 1=_latin2'1'; ---error 1265 +--error 1266 select _latin1'1'=_latin2'1'; select row('a','b','c') = row('a','b','c'); select row('A','b','c') = row('a','b','c'); select row('A' COLLATE latin1_bin,'b','c') = row('a','b','c'); select row('A','b','c') = row('a' COLLATE latin1_bin,'b','c'); ---error 1265 +--error 1266 select row('A' COLLATE latin1_general_ci,'b','c') = row('a' COLLATE latin1_bin,'b','c'); ---error 1265 +--error 1266 select concat(_latin1'a',_latin2'a'); ---error 1268 -select concat(_latin1'a',_latin2'a',_latin5'a'); --error 1269 +select concat(_latin1'a',_latin2'a',_latin5'a'); +--error 1270 select concat(_latin1'a',_latin2'a',_latin5'a',_latin7'a'); @@ -167,9 +167,9 @@ select FIELD('b','A','B'); select FIELD('B','A','B'); select FIELD('b' COLLATE latin1_bin,'A','B'); select FIELD('b','A' COLLATE latin1_bin,'B'); ---error 1268 +--error 1269 select FIELD(_latin2'b','A','B'); ---error 1268 +--error 1269 select FIELD('b',_latin2'A','B'); select FIELD('b',_latin2'A','B',1); @@ -177,55 +177,55 @@ select FIELD('b',_latin2'A','B',1); select POSITION(_latin1'B' IN _latin1'abcd'); select POSITION(_latin1'B' IN _latin1'abcd' COLLATE latin1_bin); select POSITION(_latin1'B' COLLATE latin1_bin IN _latin1'abcd'); ---error 1265 +--error 1266 select POSITION(_latin1'B' COLLATE latin1_general_ci IN _latin1'abcd' COLLATE latin1_bin); ---error 1265 +--error 1266 select POSITION(_latin1'B' IN _latin2'abcd'); select FIND_IN_SET(_latin1'B',_latin1'a,b,c,d'); --fix this: --select FIND_IN_SET(_latin1'B',_latin1'a,b,c,d' COLLATE latin1_bin); --select FIND_IN_SET(_latin1'B' COLLATE latin1_bin,_latin1'a,b,c,d'); ---error 1265 +--error 1266 select FIND_IN_SET(_latin1'B' COLLATE latin1_general_ci,_latin1'a,b,c,d' COLLATE latin1_bin); ---error 1265 +--error 1266 select FIND_IN_SET(_latin1'B',_latin2'a,b,c,d'); select SUBSTRING_INDEX(_latin1'abcdabcdabcd',_latin1'd',2); --fix this: --select SUBSTRING_INDEX(_latin1'abcdabcdabcd' COLLATE latin1_bin,_latin1'd',2); --select SUBSTRING_INDEX(_latin1'abcdabcdabcd',_latin1'd' COLLATE latin1_bin,2); ---error 1265 +--error 1266 select SUBSTRING_INDEX(_latin1'abcdabcdabcd',_latin2'd',2); ---error 1265 +--error 1266 select SUBSTRING_INDEX(_latin1'abcdabcdabcd' COLLATE latin1_general_ci,_latin1'd' COLLATE latin1_bin,2); select _latin1'B' between _latin1'a' and _latin1'c'; select _latin1'B' collate latin1_bin between _latin1'a' and _latin1'c'; select _latin1'B' between _latin1'a' collate latin1_bin and _latin1'c'; select _latin1'B' between _latin1'a' and _latin1'c' collate latin1_bin; ---error 1268 +--error 1269 select _latin2'B' between _latin1'a' and _latin1'b'; ---error 1268 +--error 1269 select _latin1'B' between _latin2'a' and _latin1'b'; ---error 1268 +--error 1269 select _latin1'B' between _latin1'a' and _latin2'b'; ---error 1268 +--error 1269 select _latin1'B' collate latin1_general_ci between _latin1'a' collate latin1_bin and _latin1'b'; select _latin1'B' in (_latin1'a',_latin1'b'); select _latin1'B' collate latin1_bin in (_latin1'a',_latin1'b'); select _latin1'B' in (_latin1'a' collate latin1_bin,_latin1'b'); select _latin1'B' in (_latin1'a',_latin1'b' collate latin1_bin); ---error 1268 +--error 1269 select _latin2'B' in (_latin1'a',_latin1'b'); ---error 1268 +--error 1269 select _latin1'B' in (_latin2'a',_latin1'b'); ---error 1268 +--error 1269 select _latin1'B' in (_latin1'a',_latin2'b'); ---error 1268 +--error 1269 select _latin1'B' COLLATE latin1_general_ci in (_latin1'a' COLLATE latin1_bin,_latin1'b'); ---error 1268 +--error 1269 select _latin1'B' COLLATE latin1_general_ci in (_latin1'a',_latin1'b' COLLATE latin1_bin); select collation(bin(130)), coercibility(bin(130)); @@ -311,7 +311,7 @@ select SUBSTR('abcdefg',1,-1) FROM DUAL; # when an error on a lower level (in concat) has accured: # create table t7 (s1 char); ---error 1265 +--error 1266 select * from t7 where concat(s1 collate latin1_general_ci,s1 collate latin1_swedish_ci) = 'AA'; drop table t7; diff --git a/mysql-test/t/func_test.test b/mysql-test/t/func_test.test index 4f44ec8fef1..ae1963dd3f5 100644 --- a/mysql-test/t/func_test.test +++ b/mysql-test/t/func_test.test @@ -26,6 +26,14 @@ select * from t1 where 1 xor 1; drop table t1; # +# Wrong usage of functions +# + +select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1; +select 1 and 2 between 2 and 10, 2 between 2 and 10 and 1; +select 1 and 0 or 2, 2 or 1 and 0; + +# # Coercibility # select _koi8r'a' = _koi8r'A'; @@ -33,9 +41,9 @@ select _koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci; select _koi8r'a' = _koi8r'A' COLLATE koi8r_bin; select _koi8r'a' COLLATE koi8r_general_ci = _koi8r'A'; select _koi8r'a' COLLATE koi8r_bin = _koi8r'A'; ---error 1265 +--error 1266 select _koi8r'a' COLLATE koi8r_bin = _koi8r'A' COLLATE koi8r_general_ci; ---error 1265 +--error 1266 select _koi8r'a' = _latin1'A'; select strcmp(_koi8r'a', _koi8r'A'); @@ -43,9 +51,9 @@ select strcmp(_koi8r'a', _koi8r'A' COLLATE koi8r_general_ci); select strcmp(_koi8r'a', _koi8r'A' COLLATE koi8r_bin); select strcmp(_koi8r'a' COLLATE koi8r_general_ci, _koi8r'A'); select strcmp(_koi8r'a' COLLATE koi8r_bin, _koi8r'A'); ---error 1265 +--error 1266 select strcmp(_koi8r'a' COLLATE koi8r_general_ci, _koi8r'A' COLLATE koi8r_bin); ---error 1265 +--error 1266 select strcmp(_koi8r'a', _latin1'A'); select _koi8r'a' LIKE _koi8r'A'; @@ -53,17 +61,7 @@ select _koi8r'a' LIKE _koi8r'A' COLLATE koi8r_general_ci; select _koi8r'a' LIKE _koi8r'A' COLLATE koi8r_bin; select _koi8r'a' COLLATE koi8r_general_ci LIKE _koi8r'A'; select _koi8r'a' COLLATE koi8r_bin LIKE _koi8r'A'; ---error 1265 +--error 1266 select _koi8r'a' COLLATE koi8r_general_ci LIKE _koi8r'A' COLLATE koi8r_bin; ---error 1265 +--error 1266 select _koi8r'a' LIKE _latin1'A'; - - - -# -# Wrong usage of functions -# - -select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1; -select 1 and 2 between 2 and 10, 2 between 2 and 10 and 1; -select 1 and 0 or 2, 2 or 1 and 0; diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test index b1338b790fd..f48ada33866 100644 --- a/mysql-test/t/grant.test +++ b/mysql-test/t/grant.test @@ -1,9 +1,10 @@ +# Test of GRANT commands + +# Cleanup --disable_warnings drop table if exists t1; --enable_warnings -create table t1 (a int); - # # Test that SSL options works properly # @@ -74,13 +75,19 @@ delete from mysql.tables_priv where user='mysqltest_1'; delete from mysql.columns_priv where user='mysqltest_1'; flush privileges; drop table t1; + +# +# Test some error conditions +# --error 1221 GRANT FILE on mysqltest.* to mysqltest_1@localhost; +select 1; -- To test that the previous command didn't cause problems # # Test for 'drop user', 'revoke privileges, grant' # +create table t1 (a int); grant ALL PRIVILEGES on *.* to drop_user2@localhost with GRANT OPTION; show grants for drop_user2@localhost; revoke all privileges, grant from drop_user2@localhost; @@ -93,19 +100,18 @@ show grants for drop_user@localhost; revoke all privileges, grant from drop_user@localhost; show grants for drop_user@localhost; drop user drop_user@localhost; ---error 1267 +--error 1268 revoke all privileges, grant from drop_user@localhost; grant select(a) on test.t1 to drop_user1@localhost; grant select on test.t1 to drop_user2@localhost; grant select on test.* to drop_user3@localhost; grant select on *.* to drop_user4@localhost; ---error 1266 +--error 1267 drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost, drop_user4@localhost; revoke all privileges, grant from drop_user1@localhost, drop_user2@localhost, drop_user3@localhost, drop_user4@localhost; drop user drop_user1@localhost, drop_user2@localhost, drop_user3@localhost, drop_user4@localhost; - drop table t1; diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index d99c7a87f88..1153622a40f 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -132,7 +132,7 @@ CREATE TABLE t1 ( assigned_to mediumint(9) DEFAULT '0' NOT NULL, bug_file_loc text, bug_severity enum('blocker','critical','major','normal','minor','trivial','enhancement') DEFAULT 'blocker' NOT NULL, - bug_status enum('NEW','ASSIGNED','REOPENED','RESOLVED','VERIFIED','CLOSED') DEFAULT 'NEW' NOT NULL, + bug_status enum('','NEW','ASSIGNED','REOPENED','RESOLVED','VERIFIED','CLOSED') DEFAULT 'NEW' NOT NULL, creation_ts datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, delta_ts timestamp(14), short_desc mediumtext, diff --git a/mysql-test/t/handler.test b/mysql-test/t/handler.test index 09dd06c817c..99ca858990c 100644 --- a/mysql-test/t/handler.test +++ b/mysql-test/t/handler.test @@ -86,9 +86,8 @@ handler t2 read first; drop table t1; # -# test case for the bug #787 +# Test case for the bug #787 # - create table t1 (a int); insert into t1 values (1),(2),(3),(4),(5),(6); delete from t1 limit 2; @@ -101,7 +100,7 @@ handler t1 read first; drop table t1; # -#test for #751 +# Test for #751 # create table t1(a int, index(a)); insert into t1 values (1), (2), (3); @@ -111,4 +110,3 @@ handler t1 read a=(W); --error 1210 handler t1 read a=(a); drop table t1; - diff --git a/mysql-test/t/heap.test b/mysql-test/t/heap.test index c708ea2baf6..797472e7769 100644 --- a/mysql-test/t/heap.test +++ b/mysql-test/t/heap.test @@ -105,7 +105,7 @@ insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),(" explain select * from t1 where btn like "q%"; select * from t1 where btn like "q%"; alter table t1 add column new_col char(1) not null, add key (btn,new_col), drop key btn; -update t1 set new_col=btn; +update t1 set new_col=left(btn,1); explain select * from t1 where btn="a"; explain select * from t1 where btn="a" and new_col="a"; drop table t1; diff --git a/mysql-test/t/heap_btree.test b/mysql-test/t/heap_btree.test index 80a7753d4b1..34aeeec0a11 100644 --- a/mysql-test/t/heap_btree.test +++ b/mysql-test/t/heap_btree.test @@ -113,7 +113,7 @@ insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),(" explain select * from t1 where btn like "q%"; select * from t1 where btn like "q%"; alter table t1 add column new_col char(1) not null, add key using BTREE (btn,new_col), drop key btn; -update t1 set new_col=btn; +update t1 set new_col=left(btn,1); explain select * from t1 where btn="a"; explain select * from t1 where btn="a" and new_col="a"; drop table t1; diff --git a/mysql-test/t/heap_hash.test b/mysql-test/t/heap_hash.test index 7b375fdfa3c..f339a10efc6 100644 --- a/mysql-test/t/heap_hash.test +++ b/mysql-test/t/heap_hash.test @@ -105,7 +105,7 @@ insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),(" explain select * from t1 where btn like "q%"; select * from t1 where btn like "q%"; alter table t1 add column new_col char(1) not null, add key using HASH (btn,new_col), drop key btn; -update t1 set new_col=btn; +update t1 set new_col=left(btn,1); explain select * from t1 where btn="a"; explain select * from t1 where btn="a" and new_col="a"; drop table t1; diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index 5ca357efe90..6e7eb0ea06f 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -489,8 +489,8 @@ DROP TABLE t1; # # Test prefix key # ---error 1089 create table t1 (a char(20), unique (a(5))) type=innodb; +drop table t1; create table t1 (a char(20), index (a(5))) type=innodb; show create table t1; drop table t1; diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test index 4ac5a69a508..556b1ac9c8f 100644 --- a/mysql-test/t/insert_select.test +++ b/mysql-test/t/insert_select.test @@ -87,7 +87,6 @@ let $VERSION=`select version()`; --replace_result $VERSION VERSION show binlog events; drop table t1, t2; -drop table if exists t1, t2; # # Test of insert ... select from same table diff --git a/mysql-test/t/key.test b/mysql-test/t/key.test index de97c639812..3b4cd7358cc 100644 --- a/mysql-test/t/key.test +++ b/mysql-test/t/key.test @@ -1,10 +1,11 @@ -# -# This failed for Elizabeth Mattijsen -# - --disable_warnings drop table if exists t1,t2,t3; --enable_warnings +SET SQL_WARNINGS=1; + +# +# This failed for Elizabeth Mattijsen +# CREATE TABLE t1 ( ID CHAR(32) NOT NULL, diff --git a/mysql-test/t/key_cache.test b/mysql-test/t/key_cache.test index 2da18b68624..fb6b6b0027f 100644 --- a/mysql-test/t/key_cache.test +++ b/mysql-test/t/key_cache.test @@ -38,5 +38,5 @@ SET @@global.key_buffer_size=@save_key_buffer; --error 1064 SELECT @@default.key_buffer_size; ---error 1270 +--error 1271 SELECT @@skr.table_type="test"; diff --git a/mysql-test/t/lock_tables_lost_commit-master.opt b/mysql-test/t/lock_tables_lost_commit-master.opt index d357a51cb27..51ccb915ef0 100644 --- a/mysql-test/t/lock_tables_lost_commit-master.opt +++ b/mysql-test/t/lock_tables_lost_commit-master.opt @@ -1 +1 @@ ---binlog-ignore-db=test innodb
\ No newline at end of file +--binlog-ignore-db=test diff --git a/mysql-test/t/lock_tables_lost_commit.test b/mysql-test/t/lock_tables_lost_commit.test index a12ee7369cb..a8a7a65bd76 100644 --- a/mysql-test/t/lock_tables_lost_commit.test +++ b/mysql-test/t/lock_tables_lost_commit.test @@ -4,7 +4,9 @@ connect (con1,localhost,root,,); connect (con2,localhost,root,,); connection con1; +--disable_warnings drop table if exists t1; +--enable_warnings create table t1(a int) type=innodb; lock tables t1 write; insert into t1 values(10); diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 80d46d1ef0c..5267b57259b 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -6,6 +6,7 @@ --disable_warnings drop table if exists t1,t2; --enable_warnings +SET SQL_WARNINGS=1; # # Test problem with CHECK TABLE; @@ -33,11 +34,13 @@ create table t1 (a tinyint not null auto_increment, b blob not null, primary key let $1=100; disable_query_log; +SET SQL_WARNINGS=0; while ($1) { eval insert into t1 (b) values(repeat(char(65+$1),65550-$1)); dec $1; } +SET SQL_WARNINGS=1; enable_query_log; check table t1; repair table t1; diff --git a/mysql-test/t/row.test b/mysql-test/t/row.test index fb5fff86b11..252830cfc98 100644 --- a/mysql-test/t/row.test +++ b/mysql-test/t/row.test @@ -15,7 +15,7 @@ select row('b',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3)); select row('b',1.5,3) IN (row('b',NULL,3), row('a',1.5,3), row(1,3,3)); select row('b',1.5,3) IN (row('b',NULL,4), row('a',1.5,3), row(1,3,3)); select (1,2,(3,4)) IN ((3,2,(3,4)), (1,2,(3,4))); --- error 1239 +-- error 1240 select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,4)); select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL))); @@ -36,12 +36,12 @@ SELECT ROW(NULL,2,3)=ROW(NULL,2,3); SELECT ROW(NULL,2,3)<=>ROW(NULL,2,3); SELECT ROW(1,2,ROW(3,4,5))=ROW(1,2,ROW(3,4,5)); SELECT ROW('test',2,3.33)=ROW('test',2,3.33); --- error 1239 +-- error 1240 SELECT ROW('test',2,3.33)=ROW('test',2,3.33,4); SELECT ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,33)); SELECT ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,3)); SELECT ROW('test',2,ROW(3,33))=ROW('test',2,ROW(3,NULL)); --- error 1239 +-- error 1240 SELECT ROW('test',2,ROW(3,33))=ROW('test',2,4); create table t1 ( a int, b int, c int); @@ -55,15 +55,15 @@ select ROW(a,b,c) IN(row(1,2,3), row(3,2,1)) from t1; select ROW(1,2,3) IN(row(a,b,c), row(1,2,3)) from t1; drop table t1; --- error 1239 +-- error 1240 select ROW(1,1); create table t1 (i int); --- error 1239 +-- error 1240 select 1 from t1 where ROW(1,1); --- error 1239 +-- error 1240 select count(*) from t1 order by ROW(1,1); --- error 1239 +-- error 1240 select count(*) from t1 having (1,1) order by i; drop table t1; diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 1d7da94d455..a23db3584de 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -9,12 +9,12 @@ SELECT (SELECT 1) UNION SELECT (SELECT 2); explain SELECT (SELECT 1) UNION SELECT (SELECT 2); SELECT (SELECT (SELECT 0 UNION SELECT 0)); explain SELECT (SELECT (SELECT 0 UNION SELECT 0)); --- error 1245 +-- error 1246 SELECT (SELECT 1 FROM (SELECT 1) as b HAVING a=1) as a; --- error 1245 +-- error 1246 SELECT (SELECT 1 FROM (SELECT 1) as b HAVING b=1) as a,(SELECT 1 FROM (SELECT 1) as c HAVING a=1) as b; SELECT (SELECT 1),MAX(1) FROM (SELECT 1) as a; --- error 1245 +-- error 1246 SELECT (SELECT a) as a; EXPLAIN SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1; SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1; @@ -24,7 +24,7 @@ SELECT 1 as a FROM (SELECT 1) as b HAVING (SELECT a)=1; -- error 1054 SELECT 1 FROM (SELECT (SELECT a) b) c; SELECT * FROM (SELECT 1 as id) b WHERE id IN (SELECT * FROM (SELECT 1 as id) c ORDER BY id); --- error 1239 +-- error 1240 SELECT * FROM (SELECT 1) a WHERE 1 IN (SELECT 1,1); SELECT 1 IN (SELECT 1); SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a)); @@ -51,7 +51,7 @@ SELECT (SELECT 'b',2,'a') = ROW(1.5,2,'a'); SELECT (SELECT 1.5,2,'a') = ROW(1.5,'c','a'); SELECT (SELECT 1.5,'c','a') = ROW(1.5,2,'a'); --- error 1239 +-- error 1240 SELECT (SELECT * FROM (SELECT 'test' a,'test' b) a); SELECT 1 as a,(SELECT a+a) b,(SELECT b); @@ -63,7 +63,7 @@ create table t4 (a int not null, b int not null); insert into t1 values (2); insert into t2 values (1,7),(2,7); insert into t4 values (4,8),(3,8),(5,9); --- error 1245 +-- error 1246 select (select a from t1 where t1.a = a1) as a2, (select b from t2 where t2.b=a2) as a1; select (select a from t1 where t1.a=t2.a), a from t2; select (select a from t1 where t1.a=t2.b), a from t2; @@ -102,9 +102,9 @@ select * from t3 where a < all (select b from t2); select * from t3 where a >= any (select b from t2); select * from t3 where a >= all (select b from t2); delete from t2 where a=100; --- error 1239 +-- error 1240 select * from t3 where a in (select a,b from t2); --- error 1239 +-- error 1240 select * from t3 where a in (select * from t2); insert into t4 values (12,7),(1,7),(10,9),(9,6),(7,6),(3,9),(1,10); -- empty set @@ -120,7 +120,7 @@ select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a) insert into t5 values (2); select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; explain select (select a from t1 where t1.a=t2.a union select a from t5 where t5.a=t2.a), a from t2; --- error 1240 +-- error 1241 select (select a from t1 where t1.a=t2.a union all select a from t5 where t5.a=t2.a), a from t2; create table t6 (patient_uq int, clinic_uq int, index i1 (clinic_uq)); create table t7( uq int primary key, name char(25)); @@ -157,14 +157,14 @@ INSERT INTO t8 (pseudo,email) VALUES ('joce','test'); INSERT INTO t8 (pseudo,email) VALUES ('joce1','test1'); INSERT INTO t8 (pseudo,email) VALUES ('2joce1','2test1'); EXPLAIN SELECT pseudo,(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce')) FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'); --- error 1239 +-- error 1240 SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM t8 WHERE pseudo='joce'); --- error 1239 +-- error 1240 SELECT pseudo FROM t8 WHERE pseudo=(SELECT * FROM t8 WHERE pseudo='joce'); SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'); --- error 1240 +-- error 1241 SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo LIKE '%joce%'); drop table if exists t1,t2,t3,t4,t5,t6,t7,t8; @@ -184,7 +184,7 @@ EXPLAIN SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'); SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'; SELECT (SELECT DISTINCT date FROM t1 WHERE date='2002-08-03'); SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1) UNION ALL SELECT 1; --- error 1240 +-- error 1241 SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1) UNION SELECT 1; EXPLAIN SELECT 1 FROM t1 WHERE 1=(SELECT 1 UNION SELECT 1); drop table t1; @@ -241,9 +241,9 @@ CREATE TABLE `t1` ( ) TYPE=MyISAM ROW_FORMAT=FIXED; INSERT INTO t1 (numeropost,maxnumrep) VALUES (1,0),(2,1); --- error 1240 +-- error 1241 select numeropost as a FROM t1 GROUP BY (SELECT 1 FROM t1 HAVING a=1); --- error 1240 +-- error 1241 select numeropost as a FROM t1 ORDER BY (SELECT 1 FROM t1 HAVING a=1); drop table t1; @@ -255,7 +255,7 @@ drop table t1; #iftest CREATE TABLE t1 (field char(1) NOT NULL DEFAULT 'b'); INSERT INTO t1 VALUES (); --- error 1240 +-- error 1241 SELECT field FROM t1 WHERE 1=(SELECT 1 UNION ALL SELECT 1 FROM (SELECT 1) a HAVING field='b'); drop table t1; @@ -268,13 +268,13 @@ CREATE TABLE `t1` ( UNIQUE KEY `numreponse` (`numreponse`), KEY `pseudo` (`pseudo`,`numeropost`) ) TYPE=MyISAM; --- error 1245 +-- error 1246 SELECT (SELECT numeropost FROM t1 HAVING numreponse=a),numreponse FROM (SELECT * FROM t1) as a; -- error 1054 SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=a) FROM (SELECT * FROM t1) as a; SELECT numreponse, (SELECT numeropost FROM t1 HAVING numreponse=1) FROM (SELECT * FROM t1) as a; INSERT INTO t1 (numeropost,numreponse,pseudo) VALUES (1,1,'joce'),(1,2,'joce'),(1,3,'test'); --- error 1240 +-- error 1241 EXPLAIN SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT 1 FROM t1 WHERE numeropost='1'); EXPLAIN SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'; EXPLAIN SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1'); @@ -293,7 +293,7 @@ insert into t2 values (1, 21),(2, 22),(3, 23); select * from t1; -- error 1093 update t1 set b= (select b from t1); --- error 1240 +-- error 1241 update t1 set b= (select b from t2); update t1 set b= (select b from t2 where t1.a = t2.a); select * from t1; @@ -308,7 +308,7 @@ select * from t1; select * from t1 where b = (select b from t2 where t1.a = t2.a); -- error 1093 delete from t1 where b = (select b from t1); --- error 1240 +-- error 1241 delete from t1 where b = (select b from t2); delete from t1 where b = (select b from t2 where t1.a = t2.a); select * from t1; @@ -326,7 +326,7 @@ select * from t11; select * from t12; -- error 1093 delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a); --- error 1240 +-- error 1241 delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2); delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a); select * from t11; @@ -341,7 +341,7 @@ insert into t2 values (1); insert into t3 values (1),(2); -- error 1093 INSERT INTO t1 (x) VALUES ((SELECT x FROM t1)); --- error 1240 +-- error 1241 INSERT INTO t1 (x) VALUES ((SELECT b FROM t3)); INSERT INTO t1 (x) VALUES ((SELECT a FROM t2)); select * from t1; @@ -351,7 +351,6 @@ INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2)); select * from t1; INSERT INTO t1 (x) select (SELECT SUM(a)+1 FROM t2) FROM t2; select * from t1; --- error 1093 INSERT INTO t1 (x) select (SELECT SUM(x)+2 FROM t1) FROM t2; -- error 1054 INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(x) FROM t2)); @@ -373,7 +372,7 @@ insert into t3 values (1),(2); select * from t1; -- error 1093 replace into t1 (x, y) VALUES ((SELECT x FROM t1), (SELECT a+1 FROM t2)); --- error 1240 +-- error 1241 replace into t1 (x, y) VALUES ((SELECT a FROM t3), (SELECT a+1 FROM t2)); replace into t1 (x, y) VALUES ((SELECT a FROM t2), (SELECT a+1 FROM t2)); select * from t1; @@ -409,7 +408,7 @@ INSERT INTO t2 VALUES ((SELECT id FROM t2)); SELECT * FROM t2; CREATE TABLE t1 (id int(11) default NULL, KEY id (id)) TYPE=MyISAM CHARSET=latin1; INSERT INTO t1 values (1),(1); --- error 1240 +-- error 1241 UPDATE t2 SET id=(SELECT * FROM t1); drop table t2, t1; @@ -688,7 +687,7 @@ INSERT INTO t1 VALUES (1); UPDATE t1 SET i=i+(SELECT MAX(i) FROM (SELECT 1) t) WHERE i=(SELECT MAX(i)); -- error 1111 UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i)); ---error 1109 +-- error 1109 UPDATE t1 SET t.i=i+(SELECT MAX(i) FROM (SELECT 1) t); drop table t1; diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test index acbc738995f..36bd8eb48e4 100644 --- a/mysql-test/t/type_decimal.test +++ b/mysql-test/t/type_decimal.test @@ -3,6 +3,7 @@ --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings +SET SQL_WARNINGS=1; CREATE TABLE t1 ( id int(11) NOT NULL auto_increment, diff --git a/mysql-test/t/type_ranges.test b/mysql-test/t/type_ranges.test index ea7fa7be8c1..09b5867e7a8 100644 --- a/mysql-test/t/type_ranges.test +++ b/mysql-test/t/type_ranges.test @@ -5,6 +5,7 @@ --disable_warnings drop table if exists t1,t2,t3; --enable_warnings +SET SQL_WARNINGS=1; CREATE TABLE t1 ( auto int(5) unsigned NOT NULL auto_increment, diff --git a/mysql-test/t/type_uint.test b/mysql-test/t/type_uint.test index b4c88eae95d..ee5f5e8123b 100644 --- a/mysql-test/t/type_uint.test +++ b/mysql-test/t/type_uint.test @@ -5,6 +5,7 @@ --disable_warnings drop table if exists t1; --enable_warnings +SET SQL_WARNINGS=1; create table t1 (this int unsigned); insert into t1 values (1); diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index 16a192f1276..22f8406cba5 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -120,7 +120,7 @@ set SESSION query_cache_size=10000; set GLOBAL table_type=DEFAULT; --error 1115 set character_set_client=UNKNOWN_CHARACTER_SET; ---error 1271 +--error 1272 set collation_connection=UNKNOWN_COLLATION; --error 1228 set global autocommit=1; diff --git a/mysql-test/t/warnings.test b/mysql-test/t/warnings.test index 41aa02e925f..050449f0f5b 100644 --- a/mysql-test/t/warnings.test +++ b/mysql-test/t/warnings.test @@ -4,6 +4,7 @@ --disable-warnings drop table if exists t1, t2; --enable-warnings +SET SQL_WARNINGS=1; create table t1 (a int); insert into t1 values (1); diff --git a/scripts/make_win_src_distribution.old b/scripts/make_win_src_distribution.old deleted file mode 100755 index df7ac29ee0d..00000000000 --- a/scripts/make_win_src_distribution.old +++ /dev/null @@ -1,402 +0,0 @@ -#!/bin/sh - -# -# Script to create a Windows src package -# - -version=@VERSION@ -export version -SOURCE=`pwd` -CP="cp -p" - -DEBUG=0 -SILENT=0 -SUFFIX="" -DIRNAME="" -OUTTAR=0 - -# -# This script must run from MySQL top directory -# - -if [ ! -f scripts/make_win_src_distribution ]; then - echo "ERROR : You must run this script from the MySQL top-level directory" - exit 1 -fi - -# -# Check for source compilation/configuration -# - -if [ ! -f sql/sql_yacc.cc ]; then - echo "ERROR : Sorry, you must run this script after the complete build," - echo " hope you know what you are trying to do !!" - exit 1 -fi - -# -# Debug print of the status -# - -print_debug() -{ - for statement - do - if [ "$DEBUG" = "1" ] ; then - echo $statement - fi - done -} - -# -# Usage of the script -# - -show_usage() -{ - echo "MySQL utility script to create a Windows src package, and it takes" - echo "the following arguments:" - echo "" - echo " --debug Debug, without creating the package" - echo " --tmp Specify the temporary location" - echo " --suffix Suffix name for the package" - echo " --dirname Directory name to copy files (intermediate)" - echo " --silent Do not list verbosely files processed" - echo " --tar Create tar.gz package instead of .zip" - echo " --help Show this help message" - - exit 0 -} - -# -# Parse the input arguments -# - -parse_arguments() { - for arg do - case "$arg" in - --debug) DEBUG=1;; - --tmp=*) TMP=`echo "$arg" | sed -e "s;--tmp=;;"` ;; - --suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;; - --dirname=*) DIRNAME=`echo "$arg" | sed -e "s;--dirname=;;"` ;; - --silent) SILENT=1 ;; - --tar) OUTTAR=1 ;; - --help) show_usage ;; - *) - echo "Unknown argument '$arg'" - exit 1 - ;; - esac - done -} - -parse_arguments "$@" - -# -# Assign the tmp directory if it was set from the environment variables -# - -for i in $TMP $TMPDIR $TEMPDIR $TEMP /tmp -do - if [ "$i" ]; then - print_debug "Setting TMP to '$i'" - TMP=$i - break - fi -done - - -# - -# -# Create a tmp dest directory to copy files -# - -BASE=$TMP/my_win_dist$SUFFIX - -if [ -d $BASE ] ; then - print_debug "Destination directory '$BASE' already exists, deleting it" - rm -r -f $BASE -fi - -$CP -r $SOURCE/VC++Files $BASE -( -find $BASE \( -name "*.dsp" -o -name "*.dsw" \) -and -not -path \*SCCS\* -print -)|( - while read v - do - print_debug "Replacing LF -> CRLF from '$v'" - - # ^M -> type CTRL V + CTRL M - cat $v | sed 's/
//' | sed 's/$/
/' > $v.tmp - rm $v - mv $v.tmp $v - done -) - -# -# Move all error message files to root directory -# - -$CP -r $SOURCE/sql/share $BASE/ -rm -r -f "$BASE/share/Makefile" -rm -r -f "$BASE/share/Makefile.in" -rm -r -f "$BASE/share/Makefile.am" - -# -# Clean up if we did this from a bk tree -# - -if [ -d $BASE/SCCS ] -then - find $BASE/ -type d -name SCCS -printf " \"%p\"" | xargs rm -r -f -fi - -mkdir $BASE/Docs $BASE/extra $BASE/include - - -# -# Copy directory files -# - -copy_dir_files() -{ - for arg do - print_debug "Copying files from directory '$arg'" - cd $SOURCE/$arg - if [ ! -d $BASE/$arg ]; then - print_debug "Creating directory '$arg'" - mkdir $BASE/$arg - fi - for i in *.c *.cpp *.h *.ih *.i *.ic *.asm *.def \ - README INSTALL* LICENSE - do - if [ -f $i ] - then - $CP $SOURCE/$arg/$i $BASE/$arg/$i - fi - done - for i in *.cc - do - if [ -f $i ] - then - i=`echo $i | sed 's/.cc$//g'` - $CP $SOURCE/$arg/$i.cc $BASE/$arg/$i.cpp - fi - done - done -} - -# -# Copy directory contents recursively -# - -copy_dir_dirs() { - - for arg do - - basedir=$arg - - if [ ! -d $BASE/$arg ]; then - mkdir $BASE/$arg - fi - - copy_dir_files $arg - - cd $SOURCE/$arg/ - for i in * - do - if [ -d $SOURCE/$basedir/$i ] && [ "$i" != "SCCS" ]; then - copy_dir_files $basedir/$i - fi - done - done -} - -# -# Input directories to be copied -# - -for i in client dbug extra heap include isam \ - libmysql libmysqld merge myisam \ - myisammrg mysys regex sql strings sql-common \ - vio zlib -do - copy_dir_files $i -done - -# -# Input directories to be copied recursively -# - -for i in bdb innobase -do - copy_dir_dirs $i -done - -# -# Create dummy innobase configure header -# - -if [ -f $BASE/innobase/ib_config.h ]; then - rm -f $BASE/innobase/ib_config.h -fi -touch $BASE/innobase/ib_config.h - - -# -# Copy miscellaneous files -# - -cd $SOURCE -for i in COPYING ChangeLog README \ - INSTALL-SOURCE INSTALL-WIN \ - INSTALL-WIN-SOURCE \ - Docs/manual_toc.html Docs/manual.html \ - Docs/mysqld_error.txt Docs/INSTALL-BINARY - -do - print_debug "Copying file '$i'" - if [ -f $i ] - then - $CP $i $BASE/$i - fi -done - -# -# Fix some windows files -# - -./extra/replace std:: "" -- $BASE/sql/sql_yacc.cpp - -# -# Initialize the initial data directory -# - -if [ -f scripts/mysql_install_db ]; then - print_debug "Initializing the 'data' directory" - scripts/mysql_install_db --no-defaults --windows --datadir=$BASE/data -fi - -# -# Specify the distribution package name and copy it -# - -if test -z $DIRNAME -then - NEW_DIR_NAME=mysql@MYSQL_SERVER_SUFFIX@-$version$SUFFIX -else - NEW_DIR_NAME=$DIRNAME -fi -NEW_NAME=$NEW_DIR_NAME-win-src - -BASE2=$TMP/$NEW_DIR_NAME -rm -r -f $BASE2 -mv $BASE $BASE2 -BASE=$BASE2 - -# -# If debugging, don't create a zip/tar/gz -# - -if [ "$DEBUG" = "1" ] ; then - echo "Please check the distribution files from $BASE" - echo "Exiting (without creating the package).." - exit -fi - -# -# This is needed to prefere gnu tar instead of tar because tar can't -# always handle long filenames -# - -PATH_DIRS=`echo $PATH | sed -e 's/^:/. /' -e 's/:$/ ./' -e 's/::/ . /g' -e 's/:/ /g' ` -which_1 () -{ - for cmd - do - for d in $PATH_DIRS - do - for file in $d/$cmd - do - if test -x $file -a ! -d $file - then - echo $file - exit 0 - fi - done - done - done - exit 1 -} - -# -# Create the result zip/tar file -# - -set_tarzip_options() -{ - for arg - do - if [ "$arg" = "tar" ]; then - ZIPFILE1=gnutar - ZIPFILE2=gtar - OPT=cvf - EXT=".tar" - NEED_COMPRESS=1 - if [ "$SILENT" = "1" ] ; then - OPT=cf - fi - else - ZIPFILE1=zip - ZIPFILE2="" - OPT="-r" - EXT=".zip" - NEED_COMPRESS=0 - if [ "$SILENT" = "1" ] ; then - OPT="$OPT -q" - fi - fi - done -} - -if [ "$OUTTAR" = "1" ]; then - set_tarzip_options 'tar' -else - set_tarzip_options 'zip' -fi - -tar=`which_1 $ZIPFILE1 $ZIPFILE2` -if test "$?" = "1" -o "$tar" = "" -then - print_debug "Search failed for '$ZIPFILE1', '$ZIPFILE2', using default 'tar'" - tar=tar - set_tarzip_options 'tar' -fi - -# -# Create the archive -# - -print_debug "Using $tar to create archive" - -cd $TMP - -rm -f $SOURCE/$NEW_NAME$EXT -$tar $OPT $SOURCE/$NEW_NAME$EXT $NEW_DIR_NAME -cd $SOURCE - -if [ "$NEED_COMPRESS" = "1" ] -then - print_debug "Compressing archive" - gzip -9 $NEW_NAME$EXT - EXT="$EXT.gz" -fi - -print_debug "Removing temporary directory" -rm -r -f $BASE - -if [ "$SILENT" = "0" ] ; then - echo "$NEW_NAME$EXT created successfully !!" -fi -# End of script diff --git a/scripts/make_win_src_distribution.sh b/scripts/make_win_src_distribution.sh index 8f8ee344e93..df7ac29ee0d 100755 --- a/scripts/make_win_src_distribution.sh +++ b/scripts/make_win_src_distribution.sh @@ -219,7 +219,7 @@ copy_dir_dirs() { for i in client dbug extra heap include isam \ libmysql libmysqld merge myisam \ - myisammrg mysys regex sql strings \ + myisammrg mysys regex sql strings sql-common \ vio zlib do copy_dir_files $i diff --git a/sql-common/client.c b/sql-common/client.c index f9219e5418d..222f0bf0288 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -134,6 +134,10 @@ const char *def_shared_memory_base_name= default_shared_memory_base_name; static void mysql_close_free_options(MYSQL *mysql); static void mysql_close_free(MYSQL *mysql); +#if !(defined(__WIN__) || defined(OS2) || defined(__NETWARE__)) +static int wait_for_data(my_socket fd, uint timeout); +#endif + /**************************************************************************** A modified version of connect(). my_connect() allows you to specify a timeout value, in seconds, that we should wait until we @@ -143,17 +147,13 @@ static void mysql_close_free(MYSQL *mysql); Base version coded by Steve Bernacki, Jr. <steve@navinet.net> *****************************************************************************/ -my_bool my_connect(my_socket s, const struct sockaddr *name, - uint namelen, uint timeout) +int my_connect(my_socket fd, const struct sockaddr *name, uint namelen, + uint timeout) { #if defined(__WIN__) || defined(OS2) || defined(__NETWARE__) - return connect(s, (struct sockaddr*) name, namelen) != 0; + return connect(fd, (struct sockaddr*) name, namelen); #else int flags, res, s_err; - SOCKOPT_OPTLEN_TYPE s_err_size = sizeof(uint); - fd_set sfds; - struct timeval tv; - time_t start_time, now_time; /* If they passed us a timeout of zero, we should behave @@ -161,60 +161,98 @@ my_bool my_connect(my_socket s, const struct sockaddr *name, */ if (timeout == 0) - return connect(s, (struct sockaddr*) name, namelen) != 0; + return connect(fd, (struct sockaddr*) name, namelen); - flags = fcntl(s, F_GETFL, 0); /* Set socket to not block */ + flags = fcntl(fd, F_GETFL, 0); /* Set socket to not block */ #ifdef O_NONBLOCK - fcntl(s, F_SETFL, flags | O_NONBLOCK); /* and save the flags.. */ + fcntl(fd, F_SETFL, flags | O_NONBLOCK); /* and save the flags.. */ #endif - res = connect(s, (struct sockaddr*) name, namelen); - s_err = errno; /* Save the error... */ - fcntl(s, F_SETFL, flags); + res= connect(fd, (struct sockaddr*) name, namelen); + s_err= errno; /* Save the error... */ + fcntl(fd, F_SETFL, flags); if ((res != 0) && (s_err != EINPROGRESS)) { - errno = s_err; /* Restore it */ - return(1); + errno= s_err; /* Restore it */ + return(-1); } if (res == 0) /* Connected quickly! */ return(0); + return wait_for_data(fd, timeout); +#endif +} + + +/* + Wait up to timeout seconds for a connection to be established. + + We prefer to do this with poll() as there is no limitations with this. + If not, we will use select() +*/ + +#if !(defined(__WIN__) || defined(OS2) || defined(__NETWARE__)) + +static int wait_for_data(my_socket fd, uint timeout) +{ +#ifdef HAVE_POLL + struct pollfd ufds; + int res; + + ufds.fd= fd; + ufds.events= POLLIN | POLLPRI; + if (!(res= poll(&ufds, 1, (int) timeout*1000))) + { + errno= EINTR; + return -1; + } + if (res < 0 || !(ufds.revents & (POLLIN | POLLPRI))) + return -1; + return 0; +#else + SOCKOPT_OPTLEN_TYPE s_err_size = sizeof(uint); + fd_set sfds; + struct timeval tv; + time_t start_time, now_time; + int res, s_err; + + if (fd >= FD_SETSIZE) /* Check if wrong error */ + return 0; /* Can't use timeout */ /* - Otherwise, our connection is "in progress." We can use - the select() call to wait up to a specified period of time - for the connection to succeed. If select() returns 0 - (after waiting howevermany seconds), our socket never became - writable (host is probably unreachable.) Otherwise, if + Our connection is "in progress." We can use the select() call to wait + up to a specified period of time for the connection to suceed. + If select() returns 0 (after waiting howevermany seconds), our socket + never became writable (host is probably unreachable.) Otherwise, if select() returns 1, then one of two conditions exist: - + 1. An error occured. We use getsockopt() to check for this. 2. The connection was set up sucessfully: getsockopt() will return 0 as an error. - + Thanks goes to Andrew Gierth <andrew@erlenstar.demon.co.uk> who posted this method of timing out a connect() in comp.unix.programmer on August 15th, 1997. */ FD_ZERO(&sfds); - FD_SET(s, &sfds); + FD_SET(fd, &sfds); /* - select could be interrupted by a signal, and if it is, + select could be interrupted by a signal, and if it is, the timeout should be adjusted and the select restarted - to work around OSes that don't restart select and + to work around OSes that don't restart select and implementations of select that don't adjust tv upon failure to reflect the time remaining - */ + */ start_time = time(NULL); for (;;) { tv.tv_sec = (long) timeout; tv.tv_usec = 0; #if defined(HPUX10) && defined(THREAD) - if ((res = select(s+1, NULL, (int*) &sfds, NULL, &tv)) > 0) + if ((res = select(fd+1, NULL, (int*) &sfds, NULL, &tv)) > 0) break; #else - if ((res = select(s+1, NULL, &sfds, NULL, &tv)) > 0) + if ((res = select(fd+1, NULL, &sfds, NULL, &tv)) > 0) break; #endif if (res == 0) /* timeout */ @@ -222,7 +260,7 @@ my_bool my_connect(my_socket s, const struct sockaddr *name, now_time=time(NULL); timeout-= (uint) (now_time - start_time); if (errno != EINTR || (int) timeout <= 0) - return 1; + return -1; } /* @@ -232,18 +270,19 @@ my_bool my_connect(my_socket s, const struct sockaddr *name, */ s_err=0; - if (getsockopt(s, SOL_SOCKET, SO_ERROR, (char*) &s_err, &s_err_size) != 0) - return(1); + if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (char*) &s_err, &s_err_size) != 0) + return(-1); if (s_err) { /* getsockopt could succeed */ errno = s_err; - return(1); /* but return an error... */ + return(-1); /* but return an error... */ } return (0); /* ok */ - -#endif +#endif /* HAVE_POLL */ } +#endif /* defined(__WIN__) || defined(OS2) || defined(__NETWARE__) */ + /* Create a named pipe connection @@ -1452,6 +1491,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, struct sockaddr_in sock_addr; ulong pkt_length; NET *net= &mysql->net; + uint charset_number; #ifdef MYSQL_SERVER thr_alarm_t alarmed; ALARM alarm_buff; @@ -1744,17 +1784,19 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, mysql->server_language=end[2]; mysql->server_status=uint2korr(end+3); } + charset_number= mysql->server_language; /* Set character set */ if ((charset_name=mysql->options.charset_name)) { - const char *save=charsets_dir; + const char *save= charsets_dir; if (mysql->options.charset_dir) charsets_dir=mysql->options.charset_dir; mysql->charset=get_charset_by_csname(mysql->options.charset_name, MY_CS_PRIMARY, MYF(MY_WME)); - charsets_dir=save; + charset_number= mysql->charset ? mysql->charset->number : 0; + charsets_dir= save; } else if (mysql->server_language) { @@ -1766,7 +1808,10 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, mysql->charset = default_charset_info; /* shouldn't be fatal */ } else - mysql->charset=default_charset_info; + { + mysql->charset= default_charset_info; + charset_number= mysql->charset->number; + } if (!mysql->charset) { @@ -1846,7 +1891,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, /* 4.1 server and 4.1 client has a 32 byte option flag */ int4store(buff,client_flag); int4store(buff+4, net->max_packet_size); - buff[8]= mysql->charset->number; + buff[8]= (char) charset_number; bzero(buff+9, 32-9); end= buff+32; } diff --git a/sql/field.cc b/sql/field.cc index 2f89dd43c3f..c972c116b1c 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -3905,7 +3905,8 @@ int Field_string::store(const char *from,uint length,CHARSET_INFO *cs) { memcpy(ptr,from,length); if (length < field_length) - field_charset->cset->fill(field_charset,ptr+length,field_length-length,' '); + field_charset->cset->fill(field_charset,ptr+length,field_length-length, + ' '); } else { @@ -3914,7 +3915,8 @@ int Field_string::store(const char *from,uint length,CHARSET_INFO *cs) { // Check if we loosed some info const char *end=from+length; from+= field_length; - from+= field_charset->cset->scan(field_charset, from, end, MY_SEQ_SPACES); + from+= field_charset->cset->scan(field_charset, from, end, + MY_SEQ_SPACES); if (from != end) { set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED); @@ -5147,7 +5149,8 @@ int Field_set::store(const char *from,uint length,CHARSET_INFO *cs) from= tmpstr.ptr(); length= tmpstr.length(); } - ulonglong tmp= find_set(typelib, from, length, ¬_used, ¬_used2, &set_warning); + ulonglong tmp= find_set(typelib, from, length, ¬_used, ¬_used2, + &set_warning); if (!tmp && length && length < 22) { /* This is for reading numbers with LOAD DATA INFILE */ @@ -5157,10 +5160,14 @@ int Field_set::store(const char *from,uint length,CHARSET_INFO *cs) tmp > (ulonglong) (((longlong) 1 << typelib->count) - (longlong) 1)) { tmp=0; - current_thd->cuted_fields++; - push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_WARN_DATA_TRUNCATED, ER(ER_WARN_DATA_TRUNCATED), - field_name, 0); + THD *thd= current_thd; + if (thd->count_cuted_fields) + { + thd->cuted_fields++; + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_WARN_DATA_TRUNCATED, ER(ER_WARN_DATA_TRUNCATED), + field_name, 0); + } } } store_type(tmp); @@ -5496,7 +5503,10 @@ create_field::create_field(Field *old_field,Field *orig_field) void Field::set_warning(const uint level, const uint code) { THD *thd= current_thd; - thd->cuted_fields++; - push_warning_printf(thd, (MYSQL_ERROR::enum_warning_level) level, - code, ER(code), field_name, thd->row_count); + if (thd->count_cuted_fields) + { + thd->cuted_fields++; + push_warning_printf(thd, (MYSQL_ERROR::enum_warning_level) level, + code, ER(code), field_name, thd->row_count); + } } diff --git a/sql/ha_myisammrg.h b/sql/ha_myisammrg.h index cfe4b47ef10..008f5339caf 100644 --- a/sql/ha_myisammrg.h +++ b/sql/ha_myisammrg.h @@ -40,8 +40,7 @@ class ha_myisammrg: public handler } ulong index_flags(uint inx) const { - ulong flags=(HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER | - HA_NOT_READ_PREFIX_LAST); // This - last - flag is ONLY for 4.0 !!! + ulong flags=(HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER); return (flags | ((table->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ? 0 : HA_KEY_READ_ONLY)); } diff --git a/sql/log.cc b/sql/log.cc index b3f7e753010..d3ba5b63e19 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -763,9 +763,6 @@ int MYSQL_LOG::purge_logs(const char *to_log, DBUG_ENTER("purge_logs"); DBUG_PRINT("info",("to_log= %s",to_log)); - if (no_rotate) - DBUG_RETURN(LOG_INFO_PURGE_NO_ROTATE); - if (need_mutex) pthread_mutex_lock(&LOCK_index); if ((error=find_log_pos(&log_info, to_log, 0 /*no mutex*/))) diff --git a/sql/log_event.cc b/sql/log_event.cc index 9f7d09785ac..3b04baf7ae7 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -102,13 +102,13 @@ static char *pretty_print_str(char *packet, char *str, int len) { char c; switch ((c=*str++)) { - case '\n': *pos++= '\'; *pos++= 'n'; break; - case '\r': *pos++= '\'; *pos++= 'r'; break; - case '\\': *pos++= '\'; *pos++= '\'; break; - case '\b': *pos++= '\'; *pos++= 'b'; break; - case '\t': *pos++= '\'; *pos++= 't'; break; - case '\'': *pos++= '\'; *pos++= '\''; break; - case 0 : *pos++= '\'; *pos++= '0'; break; + case '\n': *pos++= '\\'; *pos++= 'n'; break; + case '\r': *pos++= '\\'; *pos++= 'r'; break; + case '\\': *pos++= '\\'; *pos++= '\\'; break; + case '\b': *pos++= '\\'; *pos++= 'b'; break; + case '\t': *pos++= '\\'; *pos++= 't'; break; + case '\'': *pos++= '\\'; *pos++= '\''; break; + case 0 : *pos++= '\\'; *pos++= '0'; break; default: *pos++= c; break; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index b5afbb422d5..4305706f3dc 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2176,7 +2176,7 @@ static int init_server_components() if (opt_update_log) { open_log(&mysql_update_log, glob_hostname, opt_update_logname, "", -! NullS, LOG_NEW, 0, 0, 0); + NullS, LOG_NEW, 0, 0, 0); using_update_log=1; } if (opt_slow_log) @@ -5470,7 +5470,11 @@ static void get_options(int argc,char **argv) files_charset_info : &my_charset_bin); /* QQ To be deleted when we have key cache variables in a struct */ - keybuff_size= (((KEY_CACHE *) find_named(&key_caches, "default", 7))->size); + { + NAMED_LIST *not_used; + keybuff_size= (((KEY_CACHE *) find_named(&key_caches, "default", 7, + ¬_used))->size); + } } diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 839804b20d5..23fb36c0c91 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2392,7 +2392,7 @@ QUICK_SELECT *get_quick_select_for_ref(TABLE *table, TABLE_REF *ref) return 0; if (cp_buffer_from_ref(ref)) { - if (current_thd->fatal_error) + if (current_thd->is_fatal_error) return 0; // End of memory return quick; // empty range } diff --git a/sql/set_var.cc b/sql/set_var.cc index eebefc8b79c..499eed132a7 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -823,8 +823,10 @@ void fix_max_binlog_size(THD *thd, enum_var_type type) DBUG_PRINT("info",("max_binlog_size=%lu max_relay_log_size=%lu", max_binlog_size, max_relay_log_size)); mysql_bin_log.set_max_size(max_binlog_size); +#ifdef REPLICATION if (!max_relay_log_size) active_mi->rli.relay_log.set_max_size(max_binlog_size); +#endif DBUG_VOID_RETURN; } @@ -1090,12 +1092,6 @@ err: } -void sys_var_thd_conv_charset::set_default(THD *thd, enum_var_type type) -{ - thd->variables.convert_set= global_system_variables.convert_set; -} - - bool sys_var::check_set(THD *thd, set_var *var, TYPELIB *enum_names) { bool not_used; @@ -1107,8 +1103,10 @@ bool sys_var::check_set(THD *thd, set_var *var, TYPELIB *enum_names) { if (!(res= var->value->val_str(&str))) goto err; - var->save_result.ulong_value= (ulong) - find_set(enum_names, res->c_ptr(), res->length(), &error, &error_len, ¬_used); + var->save_result.ulong_value= ((ulong) + find_set(enum_names, res->c_ptr(), + res->length(), &error, &error_len, + ¬_used)); if (error_len) { strmake(buff, error, min(sizeof(buff), error_len)); @@ -1254,16 +1252,17 @@ static my_old_conv old_conv[]= CHARSET_INFO *get_old_charset_by_name(const char *name) { - my_old_conv *c; + my_old_conv *conv; - for (c= old_conv; c->old_name; c++) + for (conv= old_conv; conv->old_name; conv++) { - if (!my_strcasecmp(&my_charset_latin1,name,c->old_name)) - return get_charset_by_csname(c->new_name,MY_CS_PRIMARY,MYF(0)); + if (!my_strcasecmp(&my_charset_latin1, name, conv->old_name)) + return get_charset_by_csname(conv->new_name, MY_CS_PRIMARY, MYF(0)); } return NULL; } + bool sys_var_collation::check(THD *thd, set_var *var) { CHARSET_INFO *tmp; @@ -1299,7 +1298,7 @@ bool sys_var_character_set::check(THD *thd, set_var *var) tmp= NULL; } else if (!(tmp=get_charset_by_csname(res->c_ptr(),MY_CS_PRIMARY,MYF(0))) && - !(tmp=get_old_charset_by_name(res->c_ptr()))) + !(tmp=get_old_charset_by_name(res->c_ptr()))) { my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), res->c_ptr()); return 1; @@ -1340,7 +1339,10 @@ void sys_var_character_set_connection::set_default(THD *thd, if (type == OPT_GLOBAL) global_system_variables.collation_connection= default_charset_info; else + { thd->variables.collation_connection= global_system_variables.collation_connection; + thd->update_charset(); + } } @@ -1359,11 +1361,16 @@ void sys_var_character_set_client::set_default(THD *thd, enum_var_type type) if (type == OPT_GLOBAL) global_system_variables.character_set_client= default_charset_info; else - thd->variables.character_set_client= global_system_variables.character_set_client; + { + thd->variables.character_set_client= (global_system_variables. + character_set_client); + thd->update_charset(); + } } -CHARSET_INFO ** sys_var_character_set_results::ci_ptr(THD *thd, enum_var_type type) +CHARSET_INFO ** +sys_var_character_set_results::ci_ptr(THD *thd, enum_var_type type) { if (type == OPT_GLOBAL) return &global_system_variables.character_set_results; @@ -1377,11 +1384,16 @@ void sys_var_character_set_results::set_default(THD *thd, enum_var_type type) if (type == OPT_GLOBAL) global_system_variables.character_set_results= default_charset_info; else - thd->variables.character_set_results= global_system_variables.character_set_results; + { + thd->variables.character_set_results= (global_system_variables. + character_set_results); + thd->update_charset(); + } } -CHARSET_INFO ** sys_var_character_set_server::ci_ptr(THD *thd, enum_var_type type) +CHARSET_INFO ** +sys_var_character_set_server::ci_ptr(THD *thd, enum_var_type type) { if (type == OPT_GLOBAL) return &global_system_variables.character_set_server; @@ -1395,7 +1407,11 @@ void sys_var_character_set_server::set_default(THD *thd, enum_var_type type) if (type == OPT_GLOBAL) global_system_variables.character_set_server= default_charset_info; else - thd->variables.character_set_server= global_system_variables.character_set_server; + { + thd->variables.character_set_server= (global_system_variables. + character_set_server); + thd->update_charset(); + } } @@ -1414,7 +1430,10 @@ void sys_var_character_set_database::set_default(THD *thd, enum_var_type type) if (type == OPT_GLOBAL) global_system_variables.character_set_database= default_charset_info; else + { thd->variables.character_set_database= thd->db_charset; + thd->update_charset(); + } } @@ -1423,7 +1442,10 @@ bool sys_var_collation_connection::update(THD *thd, set_var *var) if (var->type == OPT_GLOBAL) global_system_variables.collation_connection= var->save_result.charset; else + { thd->variables.collation_connection= var->save_result.charset; + thd->update_charset(); + } return 0; } @@ -1443,38 +1465,47 @@ void sys_var_collation_connection::set_default(THD *thd, enum_var_type type) if (type == OPT_GLOBAL) global_system_variables.collation_connection= default_charset_info; else - thd->variables.collation_connection= global_system_variables.collation_connection; + { + thd->variables.collation_connection= (global_system_variables. + collation_connection); + thd->update_charset(); + } } bool sys_var_key_buffer_size::update(THD *thd, set_var *var) { ulonglong tmp= var->value->val_int(); - if (!base_name.length) + NAMED_LIST *list; + LEX_STRING *base_name= &var->base; + + if (!base_name->length) { - base_name.str= (char*) "default"; - base_name.length= 7; + /* We are using SET KEY_BUFFER_SIZE=# */ + base_name->str= (char*) "default"; + base_name->length= 7; } - KEY_CACHE *key_cache= (KEY_CACHE*) find_named(&key_caches, base_name.str, - base_name.length); + KEY_CACHE *key_cache= (KEY_CACHE*) find_named(&key_caches, base_name->str, + base_name->length, &list); if (!key_cache) { if (!tmp) // Tried to delete cache return 0; // Ok, nothing to do - if (!(key_cache= create_key_cache(base_name.str, - base_name.length))) + if (!(key_cache= create_key_cache(base_name->str, + base_name->length))) return 1; } - if (!tmp) + if (!tmp) // Zero size means delete { - /* Delete not default key caches */ - if (base_name.length != 7 || memcpy(base_name.str, "default", 7)) + /* Don't delete the default key cache */ + if (base_name->length != 7 || memcmp(base_name->str, "default", 7)) { /* - QQ: Here we should move tables using this key cache to default - key cache + QQ: Here we should move tables that is using the found key cache + to the default key cache */ - delete key_cache; + delete list; + my_free((char*) key_cache, MYF(0)); return 0; } } @@ -1487,6 +1518,7 @@ bool sys_var_key_buffer_size::update(THD *thd, set_var *var) return 0; } + static ulonglong zero=0; byte *sys_var_key_buffer_size::value_ptr(THD *thd, enum_var_type type, @@ -1494,6 +1526,8 @@ byte *sys_var_key_buffer_size::value_ptr(THD *thd, enum_var_type type, { const char *name; uint length; + KEY_CACHE *key_cache; + NAMED_LIST *not_used; if (!base->str) { @@ -1505,7 +1539,7 @@ byte *sys_var_key_buffer_size::value_ptr(THD *thd, enum_var_type type, name= base->str; length= base->length; } - KEY_CACHE *key_cache= (KEY_CACHE*) find_named(&key_caches, name, length); + key_cache= (KEY_CACHE*) find_named(&key_caches, name, length, ¬_used); if (!key_cache) return (byte*) &zero; return (byte*) &key_cache->size; @@ -1527,6 +1561,7 @@ int set_var_collation_client::update(THD *thd) thd->variables.character_set_client= character_set_client; thd->variables.character_set_results= character_set_results; thd->variables.collation_connection= collation_connection; + thd->update_charset(); thd->protocol_simple.init(thd); thd->protocol_prep.init(thd); return 0; @@ -1860,17 +1895,18 @@ int sql_set_variables(THD *thd, List<set_var_base> *var_list) { int error= 0; List_iterator_fast<set_var_base> it(*var_list); + DBUG_ENTER("sql_set_variables"); set_var_base *var; while ((var=it++)) { if ((error=var->check(thd))) - return error; + DBUG_RETURN(error); } it.rewind(); while ((var=it++)) error|= var->update(thd); // Returns 0, -1 or 1 - return error; + DBUG_RETURN(error); } @@ -2071,14 +2107,18 @@ ulong fix_sql_mode(ulong sql_mode) Named list handling ****************************************************************************/ -gptr find_named(I_List<NAMED_LIST> *list, const char *name, uint length) +gptr find_named(I_List<NAMED_LIST> *list, const char *name, uint length, + NAMED_LIST **found) { I_List_iterator<NAMED_LIST> it(*list); NAMED_LIST *element; while ((element= it++)) { if (element->cmp(name, length)) + { + *found= element; return element->data; + } } return 0; } @@ -2087,11 +2127,13 @@ gptr find_named(I_List<NAMED_LIST> *list, const char *name, uint length) void delete_elements(I_List<NAMED_LIST> *list, void (*free_element)(gptr)) { NAMED_LIST *element; + DBUG_ENTER("delete_elements"); while ((element= list->get())) { (*free_element)(element->data); delete element; } + DBUG_VOID_RETURN; } @@ -2100,7 +2142,8 @@ void delete_elements(I_List<NAMED_LIST> *list, void (*free_element)(gptr)) static KEY_CACHE *create_key_cache(const char *name, uint length) { KEY_CACHE *key_cache; - DBUG_PRINT("info",("Creating key cache: %s", name)); + DBUG_PRINT("info",("Creating key cache: %.*s length: %d", length, name, + length)); if ((key_cache= (KEY_CACHE*) my_malloc(sizeof(KEY_CACHE), MYF(MY_ZEROFILL | MY_WME)))) { @@ -2116,8 +2159,9 @@ static KEY_CACHE *create_key_cache(const char *name, uint length) KEY_CACHE *get_or_create_key_cache(const char *name, uint length) { + NAMED_LIST *not_used; KEY_CACHE *key_cache= (KEY_CACHE*) find_named(&key_caches, name, - length); + length, ¬_used); if (!key_cache) key_cache= create_key_cache(name, length); return key_cache; diff --git a/sql/set_var.h b/sql/set_var.h index f9c5d8f7822..f06b5ed22d3 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -47,18 +47,13 @@ public: struct my_option *option_limits; /* Updated by by set_var_init() */ uint name_length; /* Updated by by set_var_init() */ const char *name; - LEX_STRING base_name; /* for structs */ sys_after_update_func after_update; sys_var(const char *name_arg) :name(name_arg),after_update(0) - { - base_name.length=0; - } + {} sys_var(const char *name_arg,sys_after_update_func func) :name(name_arg),after_update(func) - { - base_name.length=0; - } + {} virtual ~sys_var() {} virtual bool check(THD *thd, set_var *var) { return 0; } bool check_enum(THD *thd, set_var *var, TYPELIB *enum_names); @@ -167,7 +162,6 @@ public: return type != STRING_RESULT; /* Only accept strings */ } bool check_default(enum_var_type type) { return 0; } - void set_default(THD *thd, enum_var_type type); }; @@ -596,9 +590,11 @@ public: CHARSET_INFO *charset; ulong ulong_value; } save_result; + LEX_STRING base; /* for structs */ - set_var(enum_var_type type_arg, sys_var *var_arg, Item *value_arg) - :var(var_arg), type(type_arg) + set_var(enum_var_type type_arg, sys_var *var_arg, LEX_STRING *base_name_arg, + Item *value_arg) + :var(var_arg), type(type_arg), base(*base_name_arg) { /* If the set value is a field, change it to a string to allow things like @@ -677,12 +673,12 @@ public: gptr data; NAMED_LIST(I_List<NAMED_LIST> *links, const char *name_arg, - uint name_length_arg, gptr data_arg): - name_length(name_length_arg), data(data_arg) - { - name=my_strdup(name_arg,MYF(MY_WME)); - links->push_back(this); - } + uint name_length_arg, gptr data_arg) + :name_length(name_length_arg), data(data_arg) + { + name= my_memdup(name_arg, name_length, MYF(MY_WME)); + links->push_back(this); + } inline bool cmp(const char *name_cmp, uint length) { return length == name_length && !memcmp(name, name_cmp, length); @@ -694,6 +690,13 @@ public: }; +/* For sql_yacc */ +struct sys_var_with_base +{ + sys_var *var; + LEX_STRING base_name; +}; + /* Prototypes for helper functions */ @@ -706,7 +709,8 @@ void fix_delay_key_write(THD *thd, enum_var_type type); ulong fix_sql_mode(ulong sql_mode); extern sys_var_str sys_charset_system; CHARSET_INFO *get_old_charset_by_name(const char *old_name); -gptr find_named(I_List<NAMED_LIST> *list, const char *name, uint length); +gptr find_named(I_List<NAMED_LIST> *list, const char *name, uint length, + NAMED_LIST **found); void delete_elements(I_List<NAMED_LIST> *list, void (*free_element)(gptr)); /* key_cache functions */ diff --git a/sql/slave.cc b/sql/slave.cc index a6c86b08010..16d493f1667 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1442,7 +1442,8 @@ Failed to open the existing relay log info file '%s' (errno %d)", { char llbuf[22]; sql_print_error("Failed to open the relay log '%s' (relay_log_pos %s)", - rli->relay_log_name, llstr(rli->relay_log_pos, llbuf)); + rli->group_relay_log_name, + llstr(rli->group_relay_log_pos, llbuf)); goto err; } } @@ -3491,10 +3492,9 @@ Log_event* next_event(RELAY_LOG_INFO* rli) it */ DBUG_PRINT("info", ("\ -Before assert, my_b_tell(cur_log)=%s rli->relay_log_pos=%s rli->pending=%lu", +Before assert, my_b_tell(cur_log)=%s rli->event_relay_log_pos=%s", llstr(my_b_tell(cur_log),llbuf1), - llstr(rli->relay_log_pos,llbuf2), - rli->pending)); + llstr(rli->group_relay_log_pos,llbuf2))); DBUG_ASSERT(my_b_tell(cur_log) == rli->event_relay_log_pos); } #endif diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 08212bbf65b..9738c0c5d9e 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -2353,8 +2353,8 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list, } -int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list, - ulong rights, bool revoke_grant) +int mysql_grant(THD *thd, const char *db, List <LEX_USER> &list, + ulong rights, bool revoke_grant) { List_iterator <LEX_USER> str_list (list); LEX_USER *Str; @@ -2364,8 +2364,8 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list, DBUG_ENTER("mysql_grant"); if (!initialized) { - send_error(thd, ER_UNKNOWN_COM_ERROR); /* purecov: tested */ - return 1; /* purecov: tested */ + my_error(ER_UNKNOWN_COM_ERROR, MYF(0)); /* purecov: tested */ + return -1; /* purecov: tested */ } if (lower_case_table_names && db) @@ -2443,7 +2443,8 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list, } else { - net_printf(&thd->net,ER_WRONG_USAGE,"DB GRANT","GLOBAL PRIVILEGES"); + my_printf_error(ER_WRONG_USAGE, ER(ER_WRONG_USAGE), MYF(0), + "DB GRANT","GLOBAL PRIVILEGES"); result= -1; } } @@ -2941,7 +2942,8 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) ulong want_access; uint counter,index; int error = 0; - ACL_USER *acl_user; ACL_DB *acl_db; + ACL_USER *acl_user; + ACL_DB *acl_db; char buff[1024]; Protocol *protocol= thd->protocol; DBUG_ENTER("mysql_show_grants"); @@ -2993,11 +2995,11 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) /* Add first global access grants */ { - want_access=acl_user->access; String global(buff,sizeof(buff),&my_charset_latin1); global.length(0); global.append("GRANT ",6); + want_access= acl_user->access; if (test_all_bits(want_access, (GLOBAL_ACLS & ~ GRANT_ACL))) global.append("ALL PRIVILEGES",14); else if (!(want_access & ~GRANT_ACL)) diff --git a/sql/sql_class.cc b/sql/sql_class.cc index c233ffd422a..c29e7ca2213 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -385,6 +385,59 @@ bool THD::store_globals() } +/* + Convert a string to another character set + + SYNOPSIS + convert_string() + to Store new allocated string here + to_cs New character set for allocated string + from String to convert + from_length Length of string to convert + from_cs Original character set + + NOTES + to will be 0-terminated to make it easy to pass to system funcs + + RETURN + 0 ok + 1 End of memory. + In this case to->str will point to 0 and to->length will be 0. +*/ + +bool THD::convert_string(LEX_STRING *to, CHARSET_INFO *to_cs, + const char *from, uint from_length, + CHARSET_INFO *from_cs) +{ + DBUG_ENTER("convert_string"); + size_s new_length= to_cs->mbmaxlen * from_length; + if (!(to->str= alloc(new_length+1))) + { + to->length= 0; // Safety fix + DBUG_RETURN(1); // EOM + } + to->length= copy_and_convert((char*) to->str, new_length, to_cs, + from, from_length, from_cs); + to->str[to->length]=0; // Safety + DBUG_RETURN(0); +} + + +/* + Update some cache variables when character set changes +*/ + +void THD::update_charset() +{ + charset_is_system_charset= my_charset_same(charset(),system_charset_info); + charset_is_collation_connection= my_charset_same(charset(), + variables. + collation_connection); +} + + + + /* routings to adding tables to list of changed in transaction tables */ inline static void list_include(CHANGED_TABLE_LIST** prev, diff --git a/sql/sql_class.h b/sql/sql_class.h index 414b4eac6a6..fe896a50c4f 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -571,6 +571,7 @@ public: bool volatile killed; bool prepare_command; bool tmp_table_used; + bool charset_is_system_charset, charset_is_collation_connection; /* If we do a purge of binary logs, log index info of the threads @@ -678,6 +679,9 @@ public: memcpy(ptr,str,size); return ptr; } + bool convert_string(LEX_STRING *to, CHARSET_INFO *to_cs, + const char *from, uint from_length, + CHARSET_INFO *from_cs); inline gptr trans_alloc(unsigned int size) { return alloc_root(&transaction.mem_root,size); @@ -703,6 +707,7 @@ public: DBUG_PRINT("error",("Fatal error set")); } inline CHARSET_INFO *charset() { return variables.character_set_client; } + void update_charset(); }; /* diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index 0387f02e83f..93ab332bcd5 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -203,7 +203,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, Item *item; for (key_len=0 ; (item=it_ke++) ; key_part++) { - if (item->fix_fields(thd, tables)) + if (item->fix_fields(thd, tables, &item)) goto err; if (item->used_tables() & ~RAND_TABLE_BIT) { diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 03a0f7beda9..506818cdcf9 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -225,6 +225,8 @@ public: { return (void*) sql_alloc((uint) size); } + static void *operator new(size_t size, MEM_ROOT *mem_root) + { return (void*) alloc_root(mem_root, (uint) size); } static void operator delete(void *ptr,size_t size) {} st_select_lex_node(): linkage(UNSPECIFIED_TYPE) {} virtual ~st_select_lex_node() {} diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index d9f6b93d2bb..e8df7c39c70 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -549,8 +549,8 @@ check_connections(THD *thd) NET *net= &thd->net; char *end, *user, *passwd, *db; char prepared_scramble[SCRAMBLE41_LENGTH+4]; /* Buffer for scramble&hash */ + char db_buff[NAME_LEN+1]; ACL_USER* cached_user=NULL; /* Initialise to NULL for first stage */ - String convdb; DBUG_PRINT("info",("New connection received on %s", vio_description(net->vio))); @@ -667,8 +667,18 @@ check_connections(THD *thd) { thd->client_capabilities|= ((ulong) uint2korr(net->read_pos+2)) << 16; thd->max_client_packet_length= uint4korr(net->read_pos+4); + DBUG_PRINT("info", ("client_character_set: %d", (uint) net->read_pos[8])); + /* + Use server character set and collation if + - client has not specified a character set + - client character set is the same as the servers + - client character set doesn't exists in server + */ if (!(thd->variables.character_set_client= - get_charset((uint) net->read_pos[8], MYF(0)))) + get_charset((uint) net->read_pos[8], MYF(0))) || + !my_strcasecmp(&my_charset_latin1, + global_system_variables.character_set_client->name, + thd->variables.character_set_client->name)) { thd->variables.character_set_client= global_system_variables.character_set_client; @@ -683,6 +693,7 @@ check_connections(THD *thd) thd->variables.collation_connection= thd->variables.character_set_client; } + thd->update_charset(); end= (char*) net->read_pos+32; } else @@ -735,10 +746,13 @@ check_connections(THD *thd) using_password= test(passwd[0]); if (thd->client_capabilities & CLIENT_CONNECT_WITH_DB) { - db=strend(passwd)+1; - convdb.copy(db, strlen(db), - thd->variables.character_set_client, system_charset_info); - db= convdb.c_ptr(); + db= strend(passwd)+1; + uint32 length= copy_and_convert(db_buff, sizeof(db_buff)-1, + system_charset_info, + db, strlen(db), + thd->charset()); + db_buff[length]= 0; + db= db_buff; } /* We can get only old hash at this point */ @@ -1140,15 +1154,15 @@ bool dispatch_command(enum enum_server_command command, THD *thd, thd->lex.select_lex.options=0; // We store status here switch (command) { case COM_INIT_DB: - { - String convname; - statistic_increment(com_stat[SQLCOM_CHANGE_DB],&LOCK_status); - convname.copy(packet, strlen(packet), - thd->variables.character_set_client, system_charset_info); - if (!mysql_change_db(thd,convname.c_ptr())) - mysql_log.write(thd,command,"%s",thd->db); - break; - } + { + LEX_STRING tmp; + statistic_increment(com_stat[SQLCOM_CHANGE_DB],&LOCK_status); + thd->convert_string(&tmp, system_charset_info, + packet, strlen(packet), thd->charset()); + if (!mysql_change_db(thd, tmp.str)) + mysql_log.write(thd,command,"%s",thd->db); + break; + } #ifndef EMBEDDED_LIBRARY case COM_REGISTER_SLAVE: { @@ -1360,8 +1374,9 @@ restore_user: #else { char *fields, *pend; - String convname; TABLE_LIST table_list; + LEX_STRING conv_name; + statistic_increment(com_stat[SQLCOM_SHOW_FIELDS],&LOCK_status); bzero((char*) &table_list,sizeof(table_list)); if (!(table_list.db=thd->db)) @@ -1371,9 +1386,9 @@ restore_user: } thd->free_list=0; pend= strend(packet); - convname.copy(packet, pend-packet, - thd->variables.character_set_client, system_charset_info); - table_list.alias= table_list.real_name= convname.c_ptr(); + thd->convert_string(&conv_name, system_charset_info, + packet, (uint) (pend-packet), thd->charset()); + table_list.alias= table_list.real_name= conv_name.str; packet= pend+1; // command not cachable => no gap for data base name if (!(thd->query=fields=thd->memdup(packet,thd->query_length+1))) @@ -2697,7 +2712,7 @@ mysql_execute_command(THD *thd) goto error; /* purecov: inspected */ if (!thd->col_access && check_grant_db(thd,db)) { - net_printf(&thd->net,ER_DBACCESS_DENIED_ERROR, + net_printf(thd, ER_DBACCESS_DENIED_ERROR, thd->priv_user, thd->priv_host, db); @@ -3195,16 +3210,16 @@ mysql_execute_command(THD *thd) if (!ha_rollback_to_savepoint(thd, lex->savepoint_name)) { if (thd->options & OPTION_STATUS_NO_TRANS_UPDATE) - send_warning(&thd->net,ER_WARNING_NOT_COMPLETE_ROLLBACK,0); + send_warning(thd, ER_WARNING_NOT_COMPLETE_ROLLBACK, 0); else - send_ok(&thd->net); + send_ok(thd); } else res= -1; break; case SQLCOM_SAVEPOINT: if (!ha_savepoint(thd, lex->savepoint_name)) - send_ok(&thd->net); + send_ok(thd); else res= -1; break; @@ -3584,7 +3599,7 @@ mysql_init_select(LEX *lex) bool mysql_new_select(LEX *lex, bool move_down) { - SELECT_LEX *select_lex = new SELECT_LEX(); + SELECT_LEX *select_lex = new(&lex->thd->mem_root) SELECT_LEX(); if (!select_lex) return 1; select_lex->select_number= ++lex->thd->select_number; @@ -3658,7 +3673,7 @@ void mysql_init_multi_delete(LEX *lex) mysql_init_select(lex); lex->select_lex.select_limit= lex->unit.select_limit_cnt= HA_POS_ERROR; - lex->select->table_list.save_and_clear(&lex->auxilliary_table_list); + lex->select_lex.table_list.save_and_clear(&lex->auxilliary_table_list); } diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index faf128d5e02..3cdf033c477 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -295,14 +295,14 @@ int purge_master_logs(THD* thd, const char* to_log) char search_file_name[FN_REFLEN]; if (!mysql_bin_log.is_open()) { - send_ok(); + send_ok(current_thd); return 0; } mysql_bin_log.make_log_name(search_file_name, to_log); return purge_error_message(thd, mysql_bin_log.purge_logs(search_file_name, 0, 1, - 1, NULL); + 1, NULL)); } @@ -998,7 +998,7 @@ int change_master(THD* thd, MASTER_INFO* mi) mi->rli.group_master_log_pos = mi->master_log_pos; DBUG_PRINT("info", ("master_log_pos: %d", (ulong) mi->master_log_pos)); /* If changing RELAY_LOG_FILE or RELAY_LOG_POS, this will be nonsense: */ - mi->rli.master_log_pos = mi->master_log_pos; + mi->rli.group_master_log_pos= mi->master_log_pos; strmake(mi->rli.group_master_log_name,mi->master_log_name, sizeof(mi->rli.group_master_log_name)-1); if (!mi->rli.group_master_log_name[0]) // uninitialized case @@ -1210,7 +1210,7 @@ int show_binlogs(THD* thd) if (!mysql_bin_log.is_open()) { //TODO: Replace with ER() error message - send_error(net, 0, "You are not using binary logging"); + send_error(thd, 0, "You are not using binary logging"); return 1; } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index f3631263735..a40dcc42183 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -67,9 +67,9 @@ inline Item *or_or_concat(THD *thd, Item* A, Item* B) TABLE_LIST *table_list; udf_func *udf; LEX_USER *lex_user; - sys_var *variable; + struct sys_var_with_base variable; Key::Keytype key_type; - enum ha_key_alg key_alg; + enum ha_key_alg key_alg; enum db_type db_type; enum row_type row_type; enum ha_rkey_function ha_rkey_mode; @@ -879,7 +879,7 @@ create: lex->name=0; } create2 - { Lex->select= &Lex->select_lex; } + { Lex->current_select= &Lex->select_lex; } | CREATE opt_unique_or_fulltext INDEX ident key_alg ON table_ident { LEX *lex=Lex; @@ -942,15 +942,15 @@ create2: create2a: field_list ')' opt_create_table_options create3 {} - | create_select ')' { Select->braces= 1;} union_opt {} + | create_select ')' { Select->set_braces(1);} union_opt {} ; create3: /* empty */ {} | opt_duplicate opt_as create_select - { Select->braces= 0;} opt_union {} + { Select->set_braces(0);} union_clause {} | opt_duplicate opt_as '(' create_select ')' - { Select->braces= 1;} union_opt {} + { Select->set_braces(1);} union_opt {} ; create_select: @@ -962,7 +962,7 @@ create_select: lex->sql_command= SQLCOM_INSERT_SELECT; else if (lex->sql_command == SQLCOM_REPLACE) lex->sql_command= SQLCOM_REPLACE_SELECT; - lex->select->table_list.save_and_clear(&lex->save_list); + lex->current_select->select_lex()->table_list.save_and_clear(&lex->save_list); mysql_init_select(lex); lex->current_select->parsing_place= SELECT_LEX_NODE::SELECT_LIST; } @@ -971,7 +971,7 @@ create_select: Select->parsing_place= SELECT_LEX_NODE::NO_MATTER; } opt_select_from - { Lex->select->table_list.push_front(&Lex->save_list); } + { Lex->current_select->select_lex()->table_list.push_front(&Lex->save_list); } ; opt_as: @@ -3434,7 +3434,7 @@ insert: opt_ignore insert2 { Select->set_lock_for_tables($3); - Lex->select= &Lex->select_lex; + Lex->current_select= &Lex->select_lex; } insert_field_spec opt_insert_update {} @@ -3451,7 +3451,7 @@ replace: replace_lock_option insert2 { Select->set_lock_for_tables($3); - Lex->select= &Lex->select_lex; + Lex->current_select= &Lex->select_lex; } insert_field_spec {} @@ -3507,8 +3507,8 @@ fields: insert_values: VALUES values_list {} | VALUE_SYM values_list {} - | create_select { Select->braces= 0;} opt_union {} - | '(' create_select ')' { Select->braces= 1;} union_opt {} + | create_select { Select->set_braces(0);} union_clause {} + | '(' create_select ')' { Select->set_braces(1);} union_opt {} ; values_list: @@ -4266,17 +4266,11 @@ IDENT_sys: IDENT { THD *thd= YYTHD; - if (my_charset_same(thd->charset(),system_charset_info)) - { - $$=$1; - } + if (thd->charset_is_system_charset) + $$= $1; else - { - String ident; - ident.copy($1.str,$1.length,thd->charset(),system_charset_info); - $$.str= thd->strmake(ident.ptr(),ident.length()); - $$.length= ident.length(); - } + thd->convert_string(&$$, system_charset_info, + $1.str, $1.length, thd->charset()); } ; @@ -4284,17 +4278,11 @@ TEXT_STRING_sys: TEXT_STRING { THD *thd= YYTHD; - if (my_charset_same(thd->charset(),system_charset_info)) - { - $$=$1; - } + if (thd->charset_is_system_charset) + $$= $1; else - { - String ident; - ident.copy($1.str,$1.length,thd->charset(),system_charset_info); - $$.str= thd->strmake(ident.ptr(),ident.length()); - $$.length= ident.length(); - } + thd->convert_string(&$$, system_charset_info, + $1.str, $1.length, thd->charset()); } ; @@ -4302,17 +4290,11 @@ TEXT_STRING_literal: TEXT_STRING { THD *thd= YYTHD; - if (my_charset_same(thd->charset(),thd->variables.collation_connection)) - { - $$=$1; - } + if (thd->charset_is_collation_connection) + $$= $1; else - { - String ident; - ident.copy($1.str,$1.length,thd->charset(),thd->variables.collation_connection); - $$.str= thd->strmake(ident.ptr(),ident.length()); - $$.length= ident.length(); - } + thd->convert_string(&$$, thd->variables.collation_connection, + $1.str, $1.length, thd->charset()); } ; @@ -4321,9 +4303,9 @@ ident: IDENT_sys { $$=$1; } | keyword { - LEX *lex= Lex; - $$.str= lex->thd->strmake($1.str,$1.length); - $$.length=$1.length; + THD *thd= YYTHD; + $$.str= thd->strmake($1.str, $1.length); + $$.length= $1.length; } ; @@ -4590,18 +4572,24 @@ option_value: | internal_variable_name equal set_expr_or_default { LEX *lex=Lex; - lex->var_list.push_back(new set_var(lex->option_type, $1, $3)); + lex->var_list.push_back(new set_var(lex->option_type, $1.var, + &$1.base_name, $3)); } | '@' '@' opt_var_ident_type internal_variable_name equal set_expr_or_default { LEX *lex=Lex; - lex->var_list.push_back(new set_var((enum_var_type) $3, $4, $6)); + lex->var_list.push_back(new set_var((enum_var_type) $3, $4.var, + &$4.base_name, $6)); } | TRANSACTION_SYM ISOLATION LEVEL_SYM isolation_types { LEX *lex=Lex; + LEX_STRING tmp; + tmp.str=0; + tmp.length=0; lex->var_list.push_back(new set_var(lex->option_type, find_sys_var("tx_isolation"), + &tmp, new Item_int((int32) $4))); } | charset old_or_new_charset_name_or_default @@ -4646,7 +4634,9 @@ internal_variable_name: sys_var *tmp=find_sys_var($1.str, $1.length); if (!tmp) YYABORT; - $$=tmp; + $$.var= tmp; + $$.base_name.str=0; + $$.base_name.length=0; } | ident '.' ident { @@ -4655,8 +4645,8 @@ internal_variable_name: YYABORT; if (!tmp->is_struct()) net_printf(YYTHD, ER_VARIABLE_IS_NOT_STRUCT, $3.str); - tmp->base_name= $1; - $$=tmp; + $$.var= tmp; + $$.base_name= $1; } | DEFAULT '.' ident { @@ -4665,9 +4655,9 @@ internal_variable_name: YYABORT; if (!tmp->is_struct()) net_printf(YYTHD, ER_VARIABLE_IS_NOT_STRUCT, $3.str); - tmp->base_name.str= (char*) "default"; - tmp->base_name.length= 7; - $$=tmp; + $$.var= tmp; + $$.base_name.str= (char*) "default"; + $$.base_name.length= 7; } ; diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c index b0c60e2e3eb..cf21f129664 100644 --- a/strings/ctype-latin1.c +++ b/strings/ctype-latin1.c @@ -262,13 +262,42 @@ static uchar sort_order_latin1_de[] = { 68, 78, 79, 79, 79, 79,214,247,216, 85, 85, 85,220, 89,222, 89 }; -#define L1_AE 196 -#define L1_ae 228 -#define L1_OE 214 -#define L1_oe 246 -#define L1_UE 220 -#define L1_ue 252 -#define L1_ss 223 + +/* + same as sort_order_latin_de, but maps ALL accented chars to unaccented ones +*/ + +uchar combo1map[]={ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 96, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,123,124,125,126,127, + 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, + 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159, + 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175, + 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, + 65, 65, 65, 65, 65, 65, 92, 67, 69, 69, 69, 69, 73, 73, 73, 73, + 68, 78, 79, 79, 79, 79, 79,215,216, 85, 85, 85, 85, 89,222, 83, + 65, 65, 65, 65, 65, 65, 92, 67, 69, 69, 69, 69, 73, 73, 73, 73, + 68, 78, 79, 79, 79, 79, 79,247,216, 85, 85, 85, 85, 89,222, 89 +}; + +uchar combo2map[]={ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,69, 0, 0, 0, 0, 0,69, 0, 0,83, 0, 0, 0, 0,69, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,69, 0, 0, 0, 0, 0,69, 0, 0, 0, 0 +}; /* @@ -285,101 +314,48 @@ static uchar sort_order_latin1_de[] = { */ -#define CHECK_S1_COMBO(ch1, ch2, str1, str1_end, res_if_str1_smaller, str2, fst, snd, accent) \ - /* Invariant: ch1 == fst == sort_order_latin1_de[accent] && ch1 != ch2 */ \ - if (ch2 != accent) \ - { \ - ch1= fst; \ - goto normal; \ - } \ - if (str1 == str1_end) \ - return res_if_str1_smaller; \ - { \ - int diff = (int) sort_order_latin1_de[*str1] - snd; \ - if (diff) \ - return diff*(-(res_if_str1_smaller)); \ - /* They are equal (e.g., "Ae" == 'ä') */ \ - str1++; \ - } - - static int my_strnncoll_latin1_de(CHARSET_INFO *cs __attribute__((unused)), - const uchar * s1, uint len1, - const uchar * s2, uint len2) + const uchar *s1, uint len1, + const uchar *s2, uint len2) { const uchar *e1 = s1 + len1; const uchar *e2 = s2 + len2; + uchar c1, c12=0, c2, c22=0; - while (s1 < e1 && s2 < e2) + while ((s1 < e1 || c12) && (s2 < e2 || c22)) { - /* - Because sort_order_latin1_de doesn't convert 'Ä', Ü or ß we - can use it here. - */ - uchar c1 = sort_order_latin1_de[*s1++]; - uchar c2 = sort_order_latin1_de[*s2++]; - if (c1 != c2) + if (c12) + { + c1=c12; c12=0; + } + else { - switch (c1) { - case 'A': - CHECK_S1_COMBO(c1, c2, s1, e1, -1, s2, 'A', 'E', L1_AE); - break; - case 'O': - CHECK_S1_COMBO(c1, c2, s1, e1, -1, s2, 'O', 'E', L1_OE); - break; - case 'U': - CHECK_S1_COMBO(c1, c2, s1, e1, -1, s2, 'U', 'E', L1_UE); - break; - case 'S': - CHECK_S1_COMBO(c1, c2, s1, e1, -1, s2, 'S', 'S', L1_ss); - break; - case L1_AE: - CHECK_S1_COMBO(c1, c2, s2, e2, 1, s1, 'A', 'E', 'A'); - break; - case L1_OE: - CHECK_S1_COMBO(c1, c2, s2, e2, 1, s1, 'O', 'E', 'O'); - break; - case L1_UE: - CHECK_S1_COMBO(c1, c2, s2, e2, 1, s1, 'U', 'E', 'U'); - break; - case L1_ss: - CHECK_S1_COMBO(c1, c2, s2, e2, 1, s1, 'S', 'S', 'S'); - break; - default: - /* - Handle the case where 'c2' is a special character - If this is true, we know that c1 can't match this character. - */ - normal: - switch (c2) { - case L1_AE: - return (int) c1 - (int) 'A'; - case L1_OE: - return (int) c1 - (int) 'O'; - case L1_UE: - return (int) c1 - (int) 'U'; - case L1_ss: - return (int) c1 - (int) 'S'; - default: - { - int diff= (int) c1 - (int) c2; - if (diff) - return diff; - } - break; - } - } + c12=combo2map[*s1]; + c1=combo1map[*s1++]; } + if (c22) + { + c2=c22; c22=0; + } + else + { + c22=combo2map[*s2]; + c2=combo1map[*s2++]; + } + if (c1 != c2) return (int)c1 - (int)c2; } - /* A simple test of string lengths won't work -- we test to see - * which string ran out first */ - return s1 < e1 ? 1 : s2 < e2 ? -1 : 0; + + /* + A simple test of string lengths won't work -- we test to see + which string ran out first + */ + return (s1 < e1 || c12) ? 1 : (s2 < e2 || c22) ? -1 : 0; } -static -int my_strnncollsp_latin1_de(CHARSET_INFO * cs, - const uchar *s, uint slen, - const uchar *t, uint tlen) + +static int my_strnncollsp_latin1_de(CHARSET_INFO *cs, + const uchar *s, uint slen, + const uchar *t, uint tlen) { for ( ; slen && my_isspace(cs, s[slen-1]) ; slen--); for ( ; tlen && my_isspace(cs, t[tlen-1]) ; tlen--); @@ -388,99 +364,76 @@ int my_strnncollsp_latin1_de(CHARSET_INFO * cs, static int my_strnxfrm_latin1_de(CHARSET_INFO *cs __attribute__((unused)), - uchar * dest, uint len, - const uchar * src, uint srclen) + uchar * dest, uint len, + const uchar * src, uint srclen) { const uchar *dest_orig = dest; const uchar *de = dest + len; const uchar *se = src + srclen; - while (src < se && dest < de) + for ( ; src < se && dest < de ; src++) { - uchar chr=sort_order_latin1_de[*src]; - switch (chr) { - case L1_AE: - *dest++ = 'A'; - if (dest < de) - *dest++ = 'E'; - break; - case L1_OE: - *dest++ = 'O'; - if (dest < de) - *dest++ = 'E'; - break; - case L1_UE: - *dest++ = 'U'; - if (dest < de) - *dest++ = 'E'; - break; - case L1_ss: - *dest++ = 'S'; - if (dest < de) - *dest++ = 'S'; - break; - default: - *dest++= chr; - break; - } - ++src; + uchar chr=combo1map[*src]; + *dest++=chr; + if ((chr=combo2map[*src]) && dest < de) + *dest++=chr; } - return dest - dest_orig; + return (int) (dest - dest_orig); } static MY_COLLATION_HANDLER my_collation_german2_ci_handler= { - my_strnncoll_latin1_de, - my_strnncollsp_latin1_de, - my_strnxfrm_latin1_de, - my_like_range_simple, - my_wildcmp_8bit, - my_strcasecmp_8bit, - my_hash_sort_simple + my_strnncoll_latin1_de, + my_strnncollsp_latin1_de, + my_strnxfrm_latin1_de, + my_like_range_simple, + my_wildcmp_8bit, + my_strcasecmp_8bit, + my_hash_sort_simple }; CHARSET_INFO my_charset_latin1_german2_ci= { - 31,0,0, /* number */ - MY_CS_COMPILED|MY_CS_STRNXFRM, /* state */ - "latin1", /* cs name */ - "latin1_german2_ci", /* name */ - "", /* comment */ - ctype_latin1, - to_lower_latin1, - to_upper_latin1, - sort_order_latin1_de, - latin1_uni, /* tab_to_uni */ - NULL, /* tab_from_uni */ - "","", - 2, /* strxfrm_multiply */ - 1, /* mbmaxlen */ - 0, - &my_charset_handler, - &my_collation_german2_ci_handler + 31,0,0, /* number */ + MY_CS_COMPILED|MY_CS_STRNXFRM, /* state */ + "latin1", /* cs name */ + "latin1_german2_ci", /* name */ + "", /* comment */ + ctype_latin1, + to_lower_latin1, + to_upper_latin1, + sort_order_latin1_de, + latin1_uni, /* tab_to_uni */ + NULL, /* tab_from_uni */ + "","", + 2, /* strxfrm_multiply */ + 1, /* mbmaxlen */ + 0, + &my_charset_handler, + &my_collation_german2_ci_handler }; CHARSET_INFO my_charset_latin1_bin= { - 47,0,0, /* number */ - MY_CS_COMPILED|MY_CS_BINSORT, /* state */ - "latin1", /* cs name */ - "latin1_bin", /* name */ - "", /* comment */ - ctype_latin1, - to_lower_latin1, - to_upper_latin1, - sort_order_latin1_de, - latin1_uni, /* tab_to_uni */ - NULL, /* tab_from_uni */ - "", - "", - 0, /* strxfrm_multiply */ - 1, /* mbmaxlen */ - 0, - &my_charset_handler, - &my_collation_bin_handler + 47,0,0, /* number */ + MY_CS_COMPILED|MY_CS_BINSORT, /* state */ + "latin1", /* cs name */ + "latin1_bin", /* name */ + "", /* comment */ + ctype_latin1, + to_lower_latin1, + to_upper_latin1, + sort_order_latin1_de, + latin1_uni, /* tab_to_uni */ + NULL, /* tab_from_uni */ + "", + "", + 0, /* strxfrm_multiply */ + 1, /* mbmaxlen */ + 0, + &my_charset_handler, + &my_collation_bin_handler }; |