diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index e6292a20347..f5cb190ec8d 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -27,6 +27,7 @@ bar@deer.(none) bar@gw.udmsearch.izhnet.ru bar@mysql.com bar@noter.intranet.mysql.r18.ru +bell@51.0.168.192.in-addr.arpa bell@laptop.sanja.is.com.ua bell@sanja.is.com.ua bk@admin.bk diff --git a/client/mysql.cc b/client/mysql.cc index e387bb26063..edd6e59fb4e 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -2926,9 +2926,9 @@ com_status(String *buffer __attribute__((unused)), MYSQL_ROW cur=mysql_fetch_row(result); if (cur) { - tee_fprintf(stdout, "Server characterset:\t%s\n", cur[0] ? cur[0] : ""); + tee_fprintf(stdout, "Server characterset:\t%s\n", cur[2] ? cur[2] : ""); tee_fprintf(stdout, "Db characterset:\t%s\n", cur[3] ? cur[3] : ""); - tee_fprintf(stdout, "Client characterset:\t%s\n", cur[2] ? cur[2] : ""); + tee_fprintf(stdout, "Client characterset:\t%s\n", cur[0] ? cur[0] : ""); tee_fprintf(stdout, "Conn. characterset:\t%s\n", cur[1] ? cur[1] : ""); } mysql_free_result(result); diff --git a/client/mysqldump.c b/client/mysqldump.c index c2b07e2ec20..d82fc54a9ae 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -493,7 +493,8 @@ static void write_header(FILE *sql_file, char *db_name) "); } fprintf(sql_file, - "/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='%s%s%s' */;\n", + "/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='%s%s%s' */;\n" + "/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;\n", path?"":"NO_AUTO_VALUE_ON_ZERO",compatible_mode_normal_str[0]==0?"":",", compatible_mode_normal_str); check_io(sql_file); @@ -522,6 +523,8 @@ static void write_footer(FILE *sql_file) "/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;\n" "/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;\n" "/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;\n"); + fprintf(sql_file, + "/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;\n"); fputs("\n", sql_file); check_io(sql_file); } diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c index 2ec6f8b406f..d5836cb0dc8 100644 --- a/extra/my_print_defaults.c +++ b/extra/my_print_defaults.c @@ -120,25 +120,33 @@ int main(int argc, char **argv) int count, error; char **load_default_groups, *tmp_arguments[2], **argument, **arguments; + char *defaults, *extra_defaults; MY_INIT(argv[0]); + get_defaults_files(argc, argv, &defaults, &extra_defaults); + /* ** Check out the args */ - if (get_options(&argc,&argv)) - exit(1); if (!(load_default_groups=(char**) my_malloc((argc+2)*sizeof(char*), MYF(MY_WME)))) exit(1); + if (get_options(&argc,&argv)) + exit(1); for (count=0; *argv ; argv++,count++) load_default_groups[count]= *argv; load_default_groups[count]=0; - count=1; + count=0; arguments=tmp_arguments; - arguments[0]=my_progname; - arguments[1]=0; + arguments[count++]=my_progname; + if (extra_defaults) + arguments[count++]= extra_defaults; + if (defaults) + arguments[count++]= defaults; + arguments[count]= 0; + if ((error= load_defaults(config_file, (const char **) load_default_groups, &count, &arguments))) { diff --git a/extra/perror.c b/extra/perror.c index b377b360b5c..6e632b20d96 100644 --- a/extra/perror.c +++ b/extra/perror.c @@ -245,16 +245,17 @@ int main(int argc,char *argv[]) msg = strerror(code); /* - Don't print message for not existing error messages or for - unknown errors. We test for 'Uknown Errors' just as an - extra safety for Netware + We don't print the OS error message if it is the same as the + unknown_error message we retrieved above, or it starts with + 'Unknown Error' (without regard to case). */ - if (msg && strcmp(msg, "Unknown Error") && + if (msg && + my_strnncoll(&my_charset_latin1, msg, 13, "Unknown Error", 13) && (!unknown_error || strcmp(msg, unknown_error))) { found=1; if (verbose) - printf("Error code %3d: %s\n",code,msg); + printf("OS error code %3d: %s\n",code,msg); else puts(msg); } @@ -269,7 +270,7 @@ int main(int argc,char *argv[]) else { if (verbose) - printf("MySQL error: %3d = %s\n",code,msg); + printf("MySQL error code %3d: %s\n",code,msg); else puts(msg); } diff --git a/include/my_sys.h b/include/my_sys.h index 498a1bd30fe..4618c25dbfb 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -804,8 +804,13 @@ my_bool my_gethwaddr(uchar *to); #endif #define my_mmap(a,b,c,d,e,f) mmap(a,b,c,d,e,f) +#ifdef HAVE_GETPAGESIZE #define my_getpagesize() getpagesize() -#define my_munmap(a,b) munmap(a,b) +#else +/* qnx ? */ +#define my_getpagesize() 8192 +#endif +#define my_munmap(a,b) munmap((char*)(a),(b)) #else /* not a complete set of mmap() flags, but only those that nesessary */ diff --git a/innobase/trx/trx0trx.c b/innobase/trx/trx0trx.c index eee0d43ce56..40e12f206dc 100644 --- a/innobase/trx/trx0trx.c +++ b/innobase/trx/trx0trx.c @@ -434,9 +434,21 @@ trx_lists_init_at_db_start(void) commit or abort decision from MySQL */ if (undo->state == TRX_UNDO_PREPARED) { - trx->conc_state = TRX_PREPARED; + + fprintf(stderr, +"InnoDB: Transaction %lu %lu was in the XA prepared state. We change it to\n" +"InnoDB: the 'active' state, so that InnoDB's true-and-tested crash\n" +"InnoDB: recovery will roll it back. If mysqld refuses to start after\n" +"InnoDB: this, you may be able to resolve the problem by moving the binlog\n" +"InnoDB: files to a safe place, and deleting all binlog files and the binlog\n" +"InnoDB: .index file from the datadir.\n", ut_dulint_get_high(trx->id), + ut_dulint_get_low(trx->id)); + + /* trx->conc_state = TRX_PREPARED; */ + trx->conc_state = + TRX_ACTIVE; } else { - trx->conc_state = + trx->conc_state = TRX_COMMITTED_IN_MEMORY; } @@ -490,11 +502,23 @@ trx_lists_init_at_db_start(void) commit or abort decision from MySQL */ if (undo->state == TRX_UNDO_PREPARED) { - trx->conc_state = - TRX_PREPARED; + + fprintf(stderr, +"InnoDB: Transaction %lu %lu was in the XA prepared state. We change it to\n" +"InnoDB: the 'active' state, so that InnoDB's true-and-tested crash\n" +"InnoDB: recovery will roll it back. If mysqld refuses to start after\n" +"InnoDB: this, you may be able to resolve the problem by moving the binlog\n" +"InnoDB: files to a safe place, and deleting all binlog files and the binlog\n" +"InnoDB: .index file from the datadir.\n", ut_dulint_get_high(trx->id), + ut_dulint_get_low(trx->id)); + + /* trx->conc_state = TRX_PREPARED; */ + trx->conc_state = + TRX_ACTIVE; + } else { trx->conc_state = - TRX_COMMITTED_IN_MEMORY; + TRX_COMMITTED_IN_MEMORY; } /* We give a dummy value for the trx @@ -1848,13 +1872,14 @@ trx_recover_for_mysql( ulint len) /* in: number of slots in xid_list */ { trx_t* trx; - int num_of_transactions = 0; + int count = 0; ut_ad(xid_list); ut_ad(len); + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: Starting recovery for XA transactions...\n"); + " InnoDB: Starting recovery for XA transactions...\n"); /* We should set those transactions which are in @@ -1866,20 +1891,29 @@ trx_recover_for_mysql( while (trx) { if (trx->conc_state == TRX_PREPARED) { - xid_list[num_of_transactions] = trx->xid; + xid_list[count].formatID = trx->xid.formatID; + xid_list[count].gtrid_length = trx->xid.gtrid_length; + xid_list[count].bqual_length = trx->xid.bqual_length; + memcpy(xid_list[count].data, + trx->xid.data, + trx->xid.gtrid_length + + trx->xid.bqual_length); + + ut_print_timestamp(stderr); fprintf(stderr, -"InnoDB: Transaction %lu %lu in prepared state after recovery\n", +" InnoDB: Transaction %lu %lu in prepared state after recovery\n", (ulong) ut_dulint_get_high(trx->id), (ulong) ut_dulint_get_low(trx->id)); + ut_print_timestamp(stderr); fprintf(stderr, -"InnoDB: Transaction contains changes to %lu rows\n", +" InnoDB: Transaction contains changes to %lu rows\n", (ulong)ut_conv_dulint_to_longlong(trx->undo_no)); - num_of_transactions++; + count++; - if ((uint)num_of_transactions == len ) { + if ((uint)count == len ) { break; } } @@ -1889,11 +1923,12 @@ trx_recover_for_mysql( mutex_exit(&kernel_mutex); + ut_print_timestamp(stderr); fprintf(stderr, - "InnoDB: %d transactions in prepare state after recovery\n", - num_of_transactions); +" InnoDB: %d transactions in prepare state after recovery\n", + count); - return (num_of_transactions); + return (count); } /*********************************************************************** diff --git a/innobase/trx/trx0undo.c b/innobase/trx/trx0undo.c index 4bfa9c20a54..e9296d1d9c7 100644 --- a/innobase/trx/trx0undo.c +++ b/innobase/trx/trx0undo.c @@ -537,7 +537,7 @@ trx_undo_header_create( /* If X/Open XID exits in the log header we store a flag of it in upper byte of dict operation flag. */ - if (xid != NULL || xid->formatID != -1) { + if (xid != NULL && xid->formatID != -1) { mach_write_to_1(log_hdr + TRX_UNDO_XID_EXISTS, TRUE); } else { mach_write_to_1(log_hdr + TRX_UNDO_XID_EXISTS, FALSE); diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 326497b0fc9..da088a1891f 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -450,6 +450,7 @@ while test $# -gt 0; do --debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqldump.trace" EXTRA_MYSQLBINLOG_OPT="$EXTRA_MYSQLBINLOG_OPT \ --debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysqlbinlog.trace" + EXTRA_MYSQL_CLIENT_TEST_OPT="--debug=d:t:A,$MYSQL_TEST_DIR/var/log/mysql_client_test.trace" ;; --fast) FAST_START=1 @@ -689,7 +690,7 @@ then EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT --user=root" fi -MYSQL_CLIENT_TEST="$MYSQL_CLIENT_TEST --no-defaults --testcase --user=root --socket=$MASTER_MYSOCK --port=$MYSQL_TCP_PORT --silent" +MYSQL_CLIENT_TEST="$MYSQL_CLIENT_TEST --no-defaults --testcase --user=root --socket=$MASTER_MYSOCK --port=$MYSQL_TCP_PORT --silent $EXTRA_MYSQL_CLIENT_TEST_OPT" MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT" MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR --character-sets-dir=$CHARSETSDIR $EXTRA_MYSQLBINLOG_OPT" MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose" diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result index cd804939a75..21c40e24fe2 100644 --- a/mysql-test/r/ctype_latin1.result +++ b/mysql-test/r/ctype_latin1.result @@ -325,3 +325,8 @@ latin1_bin 6109 latin1_bin 61 latin1_bin 6120 drop table t1; +CREATE TABLE „a (a int); +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 '„a (a int)' at line 1 +SELECT '„a' as str; +str +„a diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index faab013559a..893c7cc7039 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -861,3 +861,6 @@ user c one two DROP TABLE t1; +select convert(_koi8r'É' using utf8) < convert(_koi8r'Ê' using utf8); +convert(_koi8r'É' using utf8) < convert(_koi8r'Ê' using utf8) +1 diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result index 071cb673501..fd6a834c694 100644 --- a/mysql-test/r/derived.result +++ b/mysql-test/r/derived.result @@ -344,3 +344,22 @@ INSERT INTO t1 VALUES ('root','localhost'), ('root','%'); SELECT * FROM (SELECT (SELECT a.a FROM t1 AS a WHERE a.a = b.a) FROM t1 AS b) AS c; ERROR 21000: Subquery returns more than 1 row DROP TABLE t1; +create table t1(a int); +create table t2(a int); +create table t3(a int); +insert into t1 values(1),(1); +insert into t2 values(2),(2); +insert into t3 values(3),(3); +select * from t1 union distinct select * from t2 union all select * from t3; +a +1 +2 +3 +3 +select * from (select * from t1 union distinct select * from t2 union all select * from t3) X; +a +1 +2 +3 +3 +drop table t1, t2, t3; diff --git a/mysql-test/r/index_merge_ror_cpk.result b/mysql-test/r/index_merge_ror_cpk.result index 6cfeb20b2de..79bb1297abf 100644 --- a/mysql-test/r/index_merge_ror_cpk.result +++ b/mysql-test/r/index_merge_ror_cpk.result @@ -59,7 +59,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref key1 key1 4 const 100 Using where explain select * from t1 where pk1 < 7500 and key1 = 10; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge PRIMARY,key1 key1,PRIMARY 4,4 NULL 38 Using intersect(key1,PRIMARY); Using where +1 SIMPLE t1 index_merge PRIMARY,key1 key1,PRIMARY 4,4 NULL ROWS Using intersect(key1,PRIMARY); Using where explain select * from t1 where pktail1ok=1 and key1=10; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index_merge key1,pktail1ok key1,pktail1ok 4,4 NULL 1 Using intersect(key1,pktail1ok); Using where diff --git a/mysql-test/r/multi_statement.result b/mysql-test/r/multi_statement.result index 4451b0a355e..3a8d86bf349 100644 --- a/mysql-test/r/multi_statement.result +++ b/mysql-test/r/multi_statement.result @@ -31,3 +31,20 @@ select 5'abcd' select 'finish'; finish finish +flush status; +create table t1 (i int); +insert into t1 values (1); +select * from t1 where i = 1; +insert into t1 values (2),(3),(4); +select * from t1 where i = 2; +select * from t1 where i = 3|||| +i +1 +i +2 +i +3 +show status like 'Slow_queries'|||| +Variable_name Value +Slow_queries 2 +drop table t1|||| diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 01aca27d4fc..256bc1e3745 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -1156,9 +1156,9 @@ Warnings: Error 2 Can't find file: 't1' (errno: 2) create table t1 (a int) engine=myisam; drop table t1; -ERROR 42S02: Unknown table 't1' +Got one of the listed errors create table t1 (a int) engine=myisam; drop table t1; -ERROR HY000: File './test/t1.MYD' not found (Errcode: 2) +Got one of the listed errors drop table t1; ERROR 42S02: Unknown table 't1' diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 9f08fae4964..d8d9e60acd1 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -64,6 +64,7 @@ INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456) /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; CREATE TABLE `t1` ( `a` decimal(10,5) default NULL, @@ -83,10 +84,12 @@ UNLOCK TABLES; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; CREATE TABLE `t1` ( `a` decimal(10,5) default NULL, `b` float default NULL @@ -97,6 +100,7 @@ INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456) /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; DROP TABLE t1; CREATE TABLE t1(a int, b text, c varchar(3)); @@ -153,6 +157,7 @@ INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'), (NULL); /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; CREATE TABLE `t1` ( `a` varchar(255) default NULL @@ -172,6 +177,7 @@ UNLOCK TABLES; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; DROP TABLE t1; CREATE TABLE t1 (a int) ENGINE=MYISAM; @@ -179,6 +185,7 @@ INSERT INTO t1 VALUES (1), (2); /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL40' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; CREATE TABLE `t1` ( `a` int(11) default NULL @@ -194,10 +201,12 @@ UNLOCK TABLES; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL323' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; CREATE TABLE `t1` ( `a` int(11) default NULL @@ -213,6 +222,7 @@ UNLOCK TABLES; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; DROP TABLE t1; create table ```a` (i int); @@ -229,6 +239,7 @@ create table t1(a int); /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; CREATE TABLE `t1` ( `a` int(11) default NULL @@ -246,10 +257,12 @@ UNLOCK TABLES; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS "t1"; CREATE TABLE "t1" ( "a" int(11) default NULL @@ -264,6 +277,7 @@ UNLOCK TABLES; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; set global sql_mode='ANSI_QUOTES'; @@ -274,6 +288,7 @@ set global sql_mode='ANSI_QUOTES'; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; CREATE TABLE `t1` ( `a` int(11) default NULL @@ -291,10 +306,12 @@ UNLOCK TABLES; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,ANSI' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS "t1"; CREATE TABLE "t1" ( "a" int(11) default NULL @@ -309,6 +326,7 @@ UNLOCK TABLES; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; set global sql_mode=''; drop table t1; @@ -320,6 +338,7 @@ insert into t1 values (1),(2),(3); /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; CREATE TABLE `t1` ( `a` int(11) default NULL @@ -330,6 +349,7 @@ CREATE TABLE `t1` ( /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 1 2 @@ -345,6 +365,7 @@ create view v1 as select * from t1; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; CREATE TABLE `t1` ( `a` int(11) default NULL @@ -365,6 +386,7 @@ CREATE ALGORITHM=UNDEFINED VIEW `test`.`v1` AS select `test`.`t1`.`a` AS `a` fro /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; drop view v1; drop table t1; @@ -376,6 +398,7 @@ drop table t1; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */; @@ -387,6 +410,7 @@ USE `test`; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; create database mysqldump_test_db character set latin2 collate latin2_bin; @@ -397,6 +421,7 @@ create database mysqldump_test_db character set latin2 collate latin2_bin; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqldump_test_db` /*!40100 DEFAULT CHARACTER SET latin2 COLLATE latin2_bin */; @@ -408,6 +433,7 @@ USE `mysqldump_test_db`; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; drop database mysqldump_test_db; CREATE TABLE t1 (a CHAR(10)); @@ -420,6 +446,7 @@ INSERT INTO t1 VALUES (_latin1 ' /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; CREATE TABLE `t1` ( `a` char(10) default NULL @@ -438,10 +465,12 @@ UNLOCK TABLES; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL323' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; CREATE TABLE `t1` ( `a` char(10) default NULL @@ -457,10 +486,12 @@ UNLOCK TABLES; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL323' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; CREATE TABLE `t1` ( `a` char(10) default NULL @@ -476,10 +507,12 @@ UNLOCK TABLES; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL323' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; CREATE TABLE `t1` ( `a` char(10) default NULL @@ -495,10 +528,12 @@ UNLOCK TABLES; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO,MYSQL323' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t1`; CREATE TABLE `t1` ( `a` char(10) default NULL @@ -514,6 +549,7 @@ UNLOCK TABLES; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; DROP TABLE t1; CREATE TABLE t1 (a int); @@ -528,6 +564,7 @@ INSERT INTO t2 VALUES (4),(5),(6); /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DROP TABLE IF EXISTS `t2`; CREATE TABLE `t2` ( `a` int(11) default NULL @@ -546,6 +583,7 @@ UNLOCK TABLES; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; DROP TABLE t1; DROP TABLE t2; diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result index 153121f0662..cd3c8e162f7 100644 --- a/mysql-test/r/ps_1general.result +++ b/mysql-test/r/ps_1general.result @@ -1,5 +1,6 @@ drop table if exists t5, t6, t7, t8; drop database if exists mysqltest ; +drop database if exists client_test_db; drop database if exists testtets; drop table if exists t1Aa,t2Aa,v1Aa,v2Aa; drop view if exists t1Aa,t2Aa,v1Aa,v2Aa; diff --git a/mysql-test/r/rpl_charset.result b/mysql-test/r/rpl_charset.result index d105e208777..98a8c53d5fd 100644 --- a/mysql-test/r/rpl_charset.result +++ b/mysql-test/r/rpl_charset.result @@ -246,3 +246,10 @@ SET TIMESTAMP=1000000000; SET @@session.character_set_client=7,@@session.collation_connection=51,@@session.collation_server=30; INSERT INTO t1 (c1, c2) VALUES ('îÕ, ÚÁ ÒÙÂÁÌËÕ','îÕ, ÚÁ ÒÙÂÁÌËÕ'); drop table t1; +create table `t1` ( +`pk` varchar(10) not null default '', +primary key (`pk`) +) engine=myisam default charset=latin1; +set @p=_latin1 'test'; +update t1 set pk='test' where pk=@p; +drop table t1; diff --git a/mysql-test/r/rpl_rotate_logs.result b/mysql-test/r/rpl_rotate_logs.result index 2a73eea7517..745d4d8138e 100644 --- a/mysql-test/r/rpl_rotate_logs.result +++ b/mysql-test/r/rpl_rotate_logs.result @@ -100,7 +100,7 @@ commit; drop table t1; show binlog events in 'master-bin.000001'; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 96 Server ver: 5.0.3-alpha-debug-log, Binlog ver: 4 +master-bin.000001 4 Format_desc 1 96 Server ver: VERSION, Binlog ver: 4 master-bin.000001 96 Query 1 197 use `test`; create table t1 (n int) engine=innodb master-bin.000001 197 Query 1 266 use `test`; BEGIN master-bin.000001 266 Query 1 94 use `test`; insert into t1 values(100 + 4) @@ -207,5 +207,5 @@ master-bin.000001 9558 Xid 1 9319 COMMIT /* xid=146 */ master-bin.000001 9585 Rotate 1 9629 master-bin.000002;pos=4 show binlog events in 'master-bin.000002'; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000002 4 Format_desc 1 96 Server ver: 5.0.3-alpha-debug-log, Binlog ver: 4 +master-bin.000002 4 Format_desc 1 96 Server ver: VERSION, Binlog ver: 4 master-bin.000002 96 Query 1 173 use `test`; drop table t1 diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result index 69e4b082422..c28ea0fce02 100644 --- a/mysql-test/r/strict.result +++ b/mysql-test/r/strict.result @@ -852,8 +852,8 @@ NULL NULL 3.40282e+38 0 DROP TABLE t1; CREATE TABLE t1 (col1 DOUBLE PRECISION, col2 DOUBLE PRECISION UNSIGNED); -INSERT INTO t1 VALUES (-2.2E-307,0),(+1.7E+308,+1.7E+308); -INSERT INTO t1 VALUES ('-2.2E-307',0),('+1.7E+308','+1.7E+308'); +INSERT INTO t1 VALUES (-2.2E-307,0),(2E-307,0),(+1.7E+308,+1.7E+308); +INSERT INTO t1 VALUES ('-2.2E-307',0),('-2E-307',0),('+1.7E+308','+1.7E+308'); INSERT INTO t1 (col1) VALUES (-2.2E-330); INSERT INTO t1 (col1) VALUES (+1.7E+309); Got one of the listed errors @@ -864,7 +864,7 @@ ERROR 22003: Out of range value adjusted for column 'col1' at row 1 INSERT INTO t1 (col2) VALUES ('-1.2E-3'); ERROR 22003: Out of range value adjusted for column 'col2' at row 1 UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0; -ERROR 22003: Out of range value adjusted for column 'col1' at row 2 +ERROR 22003: Out of range value adjusted for column 'col1' at row 3 UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0; ERROR 22012: Division by 0 UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0; @@ -890,9 +890,11 @@ Warning 1264 Out of range value adjusted for column 'col2' at row 1 Warning 1264 Out of range value adjusted for column 'col2' at row 1 SELECT * FROM t1; col1 col2 --2.2e-307 0 +0 0 +1e-303 0 1.7e+308 1.7e+308 --2.2e-307 0 +0 0 +-2e-307 0 1.7e+308 1.7e+308 0 NULL 2 NULL diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result index 6c4a1fab857..2d5c2d2ac97 100644 --- a/mysql-test/r/type_decimal.result +++ b/mysql-test/r/type_decimal.result @@ -1,4 +1,4 @@ -DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t1, t2; SET SQL_WARNINGS=1; CREATE TABLE t1 ( id int(11) NOT NULL auto_increment, @@ -677,3 +677,19 @@ a 9999.999 0000.000 drop table t1; +CREATE TABLE t1 +(EMPNUM CHAR(3) NOT NULL, +HOURS DECIMAL(5)); +CREATE TABLE t2 +(EMPNUM CHAR(3) NOT NULL, +HOURS BIGINT); +INSERT INTO t1 VALUES ('E1',40); +INSERT INTO t1 VALUES ('E8',NULL); +INSERT INTO t2 VALUES ('E1',40); +SELECT EMPNUM FROM t1 WHERE HOURS IN (SELECT HOURS FROM t2); +EMPNUM +E1 +SELECT EMPNUM FROM t1 WHERE HOURS IN (SELECT HOURS FROM t1); +EMPNUM +E1 +DROP TABLE t1,t2; diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result index 8140167870e..eec9701d054 100644 --- a/mysql-test/r/type_float.result +++ b/mysql-test/r/type_float.result @@ -11,6 +11,12 @@ SELECT 1e1,1.e1,1.0e1,1e+1,1.e+1,1.0e+1,1e-1,1.e-1,1.0e-1; SELECT 0.001e+1,0.001e-1, -0.001e+01,-0.001e-01; 0.001e+1 0.001e-1 -0.001e+01 -0.001e-01 0.01 0.0001 -0.01 -0.0001 +SELECT 123.23E+02,-123.23E-02,"123.23E+02"+0.0,"-123.23E-02"+0.0; +123.23E+02 -123.23E-02 "123.23E+02"+0.0 "-123.23E-02"+0.0 +12323 -1.2323 12323 -1.2323 +SELECT 2147483647E+02,21474836.47E+06; +2147483647E+02 21474836.47E+06 +214748364700 21474836470000 create table t1 (f1 float(24),f2 float(52)); show full columns from t1; Field Type Collation Null Key Default Extra Privileges Comment @@ -209,3 +215,23 @@ c 0.0002 2e-05 drop table t1; +CREATE TABLE t1 ( +reckey int unsigned NOT NULL, +recdesc varchar(50) NOT NULL, +PRIMARY KEY (reckey) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +INSERT INTO t1 VALUES (108, 'Has 108 as key'); +INSERT INTO t1 VALUES (109, 'Has 109 as key'); +select * from t1 where reckey=108; +reckey recdesc +108 Has 108 as key +select * from t1 where reckey=1.08E2; +reckey recdesc +108 Has 108 as key +select * from t1 where reckey=109; +reckey recdesc +109 Has 109 as key +select * from t1 where reckey=1.09E2; +reckey recdesc +109 Has 109 as key +drop table t1; diff --git a/mysql-test/r/user_var.result b/mysql-test/r/user_var.result index 511ef5e3188..8ae1d145227 100644 --- a/mysql-test/r/user_var.result +++ b/mysql-test/r/user_var.result @@ -127,7 +127,7 @@ drop table t1; set @a=_latin2'test'; select charset(@a),collation(@a),coercibility(@a); charset(@a) collation(@a) coercibility(@a) -latin2 latin2_general_ci 3 +latin2 latin2_general_ci 2 select @a=_latin2'TEST'; @a=_latin2'TEST' 1 @@ -137,12 +137,13 @@ select @a=_latin2'TEST' collate latin2_bin; set @a=_latin2'test' collate latin2_general_ci; select charset(@a),collation(@a),coercibility(@a); charset(@a) collation(@a) coercibility(@a) -latin2 latin2_general_ci 0 +latin2 latin2_general_ci 2 select @a=_latin2'TEST'; @a=_latin2'TEST' 1 select @a=_latin2'TEST' collate latin2_bin; -ERROR HY000: Illegal mix of collations (latin2_general_ci,EXPLICIT) and (latin2_bin,EXPLICIT) for operation '=' +@a=_latin2'TEST' collate latin2_bin +0 select charset(@a:=_latin2'test'); charset(@a:=_latin2'test') latin2 @@ -151,21 +152,22 @@ collation(@a:=_latin2'test') latin2_general_ci select coercibility(@a:=_latin2'test'); coercibility(@a:=_latin2'test') -3 +2 select collation(@a:=_latin2'test' collate latin2_bin); collation(@a:=_latin2'test' collate latin2_bin) latin2_bin select coercibility(@a:=_latin2'test' collate latin2_bin); coercibility(@a:=_latin2'test' collate latin2_bin) -0 +2 select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST'; (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST' 0 select charset(@a),collation(@a),coercibility(@a); charset(@a) collation(@a) coercibility(@a) -latin2 latin2_bin 0 +latin2 latin2_bin 2 select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST' collate latin2_general_ci; -ERROR HY000: Illegal mix of collations (latin2_bin,EXPLICIT) and (latin2_general_ci,EXPLICIT) for operation '=' +(@a:=_latin2'test' collate latin2_bin) = _latin2'TEST' collate latin2_general_ci +1 create table t1 (a varchar(50)); reset master; SET TIMESTAMP=10000; diff --git a/mysql-test/t/ctype_latin1.test b/mysql-test/t/ctype_latin1.test index cee0324d12f..6006ee4c527 100644 --- a/mysql-test/t/ctype_latin1.test +++ b/mysql-test/t/ctype_latin1.test @@ -66,3 +66,12 @@ SET collation_connection='latin1_swedish_ci'; -- source include/ctype_filesort.inc SET collation_connection='latin1_bin'; -- source include/ctype_filesort.inc + +# +# Bug#8041 +# An unknown character (e.g. 0x84) should result in ERROR, +# It was treated like a space character earlier. +# Howerver, it should still work fine as a string part. +--error 1064 +CREATE TABLE „a (a int); +SELECT '„a' as str; diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index 8e3eb71c3e5..35f2b2642be 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -693,3 +693,8 @@ INSERT INTO t1 VALUES ('one'),('two'); SELECT CHARSET('a'); SELECT user, CONCAT('<', user, '>') AS c FROM t1; DROP TABLE t1; + +# +# Bug#8385: utf8_general_ci treats Cyrillic letters I and SHORT I as the same +# +select convert(_koi8r'É' using utf8) < convert(_koi8r'Ê' using utf8); diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index df860d92b38..1e3ffd5160b 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -236,3 +236,15 @@ INSERT INTO t1 VALUES ('root','localhost'), ('root','%'); --error 1242 SELECT * FROM (SELECT (SELECT a.a FROM t1 AS a WHERE a.a = b.a) FROM t1 AS b) AS c; DROP TABLE t1; +# +# test of union subquery in the FROM clause with complex distinct/all (BUG#6565) +# +create table t1(a int); +create table t2(a int); +create table t3(a int); +insert into t1 values(1),(1); +insert into t2 values(2),(2); +insert into t3 values(3),(3); +select * from t1 union distinct select * from t2 union all select * from t3; +select * from (select * from t1 union distinct select * from t2 union all select * from t3) X; +drop table t1, t2, t3; diff --git a/mysql-test/t/index_merge_ror_cpk.test b/mysql-test/t/index_merge_ror_cpk.test index 867b0b3a036..94abf395d0a 100644 --- a/mysql-test/t/index_merge_ror_cpk.test +++ b/mysql-test/t/index_merge_ror_cpk.test @@ -63,6 +63,7 @@ select pk1,pk2 from t1 where key1 = 10 and key2=10 and 2*pk1+1 < 2*96+1; # Verify that CPK is always used for index intersection scans # (this is because it is used as a filter, not for retrieval) explain select * from t1 where badkey=1 and key1=10; +--replace_result 38 ROWS 37 ROWS explain select * from t1 where pk1 < 7500 and key1 = 10; # Verify that keys with 'tails' of PK members are ok. diff --git a/mysql-test/t/multi_statement-master.opt b/mysql-test/t/multi_statement-master.opt new file mode 100644 index 00000000000..b30df037531 --- /dev/null +++ b/mysql-test/t/multi_statement-master.opt @@ -0,0 +1,2 @@ +--log-slow-queries=slow.log +--log-queries-not-using-indexes diff --git a/mysql-test/t/multi_statement.test b/mysql-test/t/multi_statement.test index 862f2294641..2abec332878 100644 --- a/mysql-test/t/multi_statement.test +++ b/mysql-test/t/multi_statement.test @@ -14,3 +14,18 @@ select "abcd'";'abcd'select "'abcd";'abcd' select 5'abcd' delimiter ;'abcd' select 'finish'; + +# Bug #8475: Make sure every statement that is a slow query in +# a multi-statement query gets logged as a slow query. +flush status; +delimiter ||||; +create table t1 (i int); +insert into t1 values (1); +select * from t1 where i = 1; +insert into t1 values (2),(3),(4); +select * from t1 where i = 2; +select * from t1 where i = 3|||| +show status like 'Slow_queries'|||| +drop table t1|||| + +delimiter ;|||| diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 05e80597fab..f919bfced77 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -548,11 +548,11 @@ system rm ./var/master-data/test/t1.MYI ; drop table if exists t1; create table t1 (a int) engine=myisam; system rm ./var/master-data/test/t1.MYI ; ---error 1051 +--error 1051,6 drop table t1; create table t1 (a int) engine=myisam; system rm ./var/master-data/test/t1.MYD ; ---error 1105 +--error 1105,6 drop table t1; --error 1051 drop table t1; diff --git a/mysql-test/t/mysql_client_test.test b/mysql-test/t/mysql_client_test.test index 86aecf43cbd..3639fc2e262 100644 --- a/mysql-test/t/mysql_client_test.test +++ b/mysql-test/t/mysql_client_test.test @@ -1,3 +1,10 @@ # We run with different binaries for normal and --embedded-server +# +# If this test fails with "command "$MYSQL_CLIENT_TEST" failed", +# you should either run mysql_client_test separartely against a running +# server or run mysql-test-run --debug mysql_client_test and check +# var/log/mysql_client_test.trace + --disable_result_log +--exec echo $MYSQL_CLIENT_TEST --exec $MYSQL_CLIENT_TEST diff --git a/mysql-test/t/ps_1general.test b/mysql-test/t/ps_1general.test index 81934547f82..22a4a8bf2c9 100644 --- a/mysql-test/t/ps_1general.test +++ b/mysql-test/t/ps_1general.test @@ -11,7 +11,9 @@ --disable_warnings drop table if exists t5, t6, t7, t8; drop database if exists mysqltest ; + # Cleanup from other tests +drop database if exists client_test_db; drop database if exists testtets; drop table if exists t1Aa,t2Aa,v1Aa,v2Aa; drop view if exists t1Aa,t2Aa,v1Aa,v2Aa; diff --git a/mysql-test/t/rpl_charset.test b/mysql-test/t/rpl_charset.test index c61df09fdcc..d2c195dfdbf 100644 --- a/mysql-test/t/rpl_charset.test +++ b/mysql-test/t/rpl_charset.test @@ -157,3 +157,15 @@ connection master; drop table t1; sync_slave_with_master; +# +# BUG#6676: Derivation of variables must be correct on slave +# +connection master; +create table `t1` ( + `pk` varchar(10) not null default '', + primary key (`pk`) +) engine=myisam default charset=latin1; +set @p=_latin1 'test'; +update t1 set pk='test' where pk=@p; +drop table t1; +sync_slave_with_master; diff --git a/mysql-test/t/rpl_rotate_logs.test b/mysql-test/t/rpl_rotate_logs.test index 1029c64867a..47b5754232c 100644 --- a/mysql-test/t/rpl_rotate_logs.test +++ b/mysql-test/t/rpl_rotate_logs.test @@ -174,6 +174,9 @@ while ($1) --enable_query_log commit; drop table t1; +let $VERSION=`select version()`; +--replace_result $VERSION VERSION "xid=373" "xid=146" show binlog events in 'master-bin.000001'; +--replace_result $VERSION VERSION show binlog events in 'master-bin.000002'; diff --git a/mysql-test/t/strict.test b/mysql-test/t/strict.test index d8833f6f914..d3928a623f4 100644 --- a/mysql-test/t/strict.test +++ b/mysql-test/t/strict.test @@ -828,8 +828,8 @@ DROP TABLE t1; # Test INSERT with DOUBLE CREATE TABLE t1 (col1 DOUBLE PRECISION, col2 DOUBLE PRECISION UNSIGNED); -INSERT INTO t1 VALUES (-2.2E-307,0),(+1.7E+308,+1.7E+308); -INSERT INTO t1 VALUES ('-2.2E-307',0),('+1.7E+308','+1.7E+308'); +INSERT INTO t1 VALUES (-2.2E-307,0),(2E-307,0),(+1.7E+308,+1.7E+308); +INSERT INTO t1 VALUES ('-2.2E-307',0),('-2E-307',0),('+1.7E+308','+1.7E+308'); # We don't give warnings for underflow INSERT INTO t1 (col1) VALUES (-2.2E-330); --error 1367,1264 diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test index 6f170a52700..18ac5d1e467 100644 --- a/mysql-test/t/type_decimal.test +++ b/mysql-test/t/type_decimal.test @@ -1,7 +1,7 @@ # bug in decimal() with negative numbers by kaido@tradenet.ee --disable_warnings -DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t1, t2; --enable_warnings SET SQL_WARNINGS=1; @@ -268,3 +268,20 @@ insert into t1 values ('1'),('+1'),('-1'),('0000000001'),('+0000000001'),('-0000 --enable_warnings select * from t1; drop table t1; + +# Test for BUG#8397: decimal type in subselects (Item_cache_decimal) +CREATE TABLE t1 +(EMPNUM CHAR(3) NOT NULL, +HOURS DECIMAL(5)); +CREATE TABLE t2 +(EMPNUM CHAR(3) NOT NULL, +HOURS BIGINT); + +INSERT INTO t1 VALUES ('E1',40); +INSERT INTO t1 VALUES ('E8',NULL); +INSERT INTO t2 VALUES ('E1',40); + +SELECT EMPNUM FROM t1 WHERE HOURS IN (SELECT HOURS FROM t2); +SELECT EMPNUM FROM t1 WHERE HOURS IN (SELECT HOURS FROM t1); + +DROP TABLE t1,t2; diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test index 4f40d97743a..6e991dc53d4 100644 --- a/mysql-test/t/type_float.test +++ b/mysql-test/t/type_float.test @@ -12,6 +12,8 @@ SELECT 10,10.0,10.,.1e+2,100.0e-1; SELECT 6e-05, -6e-05, --6e-05, -6e-05+1.000000; SELECT 1e1,1.e1,1.0e1,1e+1,1.e+1,1.0e+1,1e-1,1.e-1,1.0e-1; SELECT 0.001e+1,0.001e-1, -0.001e+01,-0.001e-01; +SELECT 123.23E+02,-123.23E-02,"123.23E+02"+0.0,"-123.23E-02"+0.0; +SELECT 2147483647E+02,21474836.47E+06; create table t1 (f1 float(24),f2 float(52)); show full columns from t1; @@ -122,3 +124,23 @@ create table t1 (c char(6)); insert into t1 values (2e5),(2e6),(2e-4),(2e-5); select * from t1; drop table t1; + +# +# Test of comparison of integer with float-in-range (Bug #7840) +# This is needed because some ODBC applications (like Foxpro) uses +# floats for everything. +# + +CREATE TABLE t1 ( + reckey int unsigned NOT NULL, + recdesc varchar(50) NOT NULL, + PRIMARY KEY (reckey) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; + +INSERT INTO t1 VALUES (108, 'Has 108 as key'); +INSERT INTO t1 VALUES (109, 'Has 109 as key'); +select * from t1 where reckey=108; +select * from t1 where reckey=1.08E2; +select * from t1 where reckey=109; +select * from t1 where reckey=1.09E2; +drop table t1; diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test index 5dc24bde21f..07076f1f6f4 100644 --- a/mysql-test/t/user_var.test +++ b/mysql-test/t/user_var.test @@ -85,7 +85,6 @@ select @a=_latin2'TEST' collate latin2_bin; set @a=_latin2'test' collate latin2_general_ci; select charset(@a),collation(@a),coercibility(@a); select @a=_latin2'TEST'; ---error 1267 select @a=_latin2'TEST' collate latin2_bin; # @@ -98,7 +97,6 @@ select collation(@a:=_latin2'test' collate latin2_bin); select coercibility(@a:=_latin2'test' collate latin2_bin); select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST'; select charset(@a),collation(@a),coercibility(@a); ---error 1267 select (@a:=_latin2'test' collate latin2_bin) = _latin2'TEST' collate latin2_general_ci; # Check that user variables are binlogged correctly (BUG#3875) diff --git a/mysys/charset.c b/mysys/charset.c index bb8f2d178b9..5840c885e40 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -64,7 +64,7 @@ static my_bool init_state_maps(CHARSET_INFO *cs) else if (my_mbcharlen(cs, i)>1) state_map[i]=(uchar) MY_LEX_IDENT; #endif - else if (!my_isgraph(cs,i)) + else if (my_isspace(cs,i)) state_map[i]=(uchar) MY_LEX_SKIP; else state_map[i]=(uchar) MY_LEX_CHAR; diff --git a/ndb/src/common/logger/LogHandler.cpp b/ndb/src/common/logger/LogHandler.cpp index e038b05401e..ec4137297f1 100644 --- a/ndb/src/common/logger/LogHandler.cpp +++ b/ndb/src/common/logger/LogHandler.cpp @@ -76,15 +76,15 @@ LogHandler::append_impl(const char* pCategory, Logger::LoggerLevel level, const char* pMsg) { writeHeader(pCategory, level); - if (m_count_repeated_messages == 0) + if (m_count_repeated_messages <= 1) writeMessage(pMsg); else { BaseString str(pMsg); str.appfmt(" - Repeated %d times", m_count_repeated_messages); writeMessage(str.c_str()); - m_count_repeated_messages= 0; } + m_count_repeated_messages= 0; writeFooter(); } diff --git a/sql/field.cc b/sql/field.cc index a32b402cbdb..194f4522851 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -2432,12 +2432,23 @@ void Field_medium::sql_type(String &res) const ** long int ****************************************************************************/ +/* + A helper function to check whether the next character + in the string "s" is MINUS SIGN. +*/ +#ifdef HAVE_CHARSET_ucs2 static bool test_if_minus(CHARSET_INFO *cs, const char *s, const char *e) { my_wc_t wc; return cs->cset->mb_wc(cs, &wc, (uchar*) s, (uchar*) e) > 0 && wc == '-'; } +#else +/* + If not UCS2 support is compiled then it is easier +*/ +#define test_if_minus(cs, s, e) (*s == '-') +#endif int Field_long::store(const char *from,uint len,CHARSET_INFO *cs) diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index d6e17b3b5e2..eddc7616e66 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -1346,14 +1346,14 @@ innobase_commit_low( return; } -#ifdef HAVE_REPLICATION +#ifdef DISABLE_HAVE_REPLICATION if (current_thd->slave_thread) { /* Update the replication position info inside InnoDB */ trx->mysql_master_log_file_name = active_mi->rli.group_master_log_name; trx->mysql_master_log_pos= ((ib_longlong) - active_mi->rli.future_group_master_log_pos); + active_mi->rli.future_group_master_log_pos); } #endif /* HAVE_REPLICATION */ @@ -1698,7 +1698,9 @@ innobase_rollback_to_savepoint( innobase_release_stat_resources(trx); /* TODO: use provided savepoint data area to store savepoint data */ - char name[16]; sprintf(name, "s_%08lx", savepoint); + char name[64]; + longlong2str((ulonglong)savepoint,name,36); + error = trx_rollback_to_savepoint_for_mysql(trx, name, &mysql_binlog_cache_pos); DBUG_RETURN(convert_error_code_to_mysql(error, NULL)); @@ -1724,7 +1726,9 @@ innobase_release_savepoint( trx = check_trx_exists(thd); /* TODO: use provided savepoint data area to store savepoint data */ - char name[16]; sprintf(name, "s_%08lx", savepoint); + char name[64]; + longlong2str((ulonglong)savepoint,name,36); + error = trx_release_savepoint_for_mysql(trx, name); DBUG_RETURN(convert_error_code_to_mysql(error, NULL)); @@ -1763,7 +1767,9 @@ innobase_savepoint( DBUG_ASSERT(trx->active_trans); /* TODO: use provided savepoint data area to store savepoint data */ - char name[16]; sprintf(name, "s_%08lx", savepoint); + char name[64]; + longlong2str((ulonglong)savepoint,name,36); + error = trx_savepoint_for_mysql(trx, name, (ib_longlong)0); DBUG_RETURN(convert_error_code_to_mysql(error, NULL)); diff --git a/sql/handler.cc b/sql/handler.cc index b733ec6c267..b76fbe5ccd5 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -553,6 +553,7 @@ int ha_commit_trans(THD *thd, bool all) #ifdef USING_TRANSACTIONS if (trans->nht) { + DBUG_EXECUTE_IF("crash_commit_before", abort();); if (!trans->no_2pc && trans->nht > 1) { for (; *ht && !error; ht++) @@ -565,16 +566,20 @@ int ha_commit_trans(THD *thd, bool all) } statistic_increment(thd->status_var.ha_prepare_count,&LOCK_status); } + DBUG_EXECUTE_IF("crash_commit_after_prepare", abort();); if (error || (is_real_trans && xid && (error= !(cookie= tc_log->log(thd, xid))))) { ha_rollback_trans(thd, all); return 1; } + DBUG_EXECUTE_IF("crash_commit_after_log", abort();); } error=ha_commit_one_phase(thd, all) ? cookie ? 2 : 1 : 0; + DBUG_EXECUTE_IF("crash_commit_before_unlog", abort();); if (cookie) tc_log->unlog(cookie, xid); + DBUG_EXECUTE_IF("crash_commit_after", abort();); } #endif /* USING_TRANSACTIONS */ DBUG_RETURN(error); @@ -738,8 +743,7 @@ int ha_recover(HASH *commit_list) DBUG_ASSERT(total_ha_2pc); DBUG_ASSERT(commit_list || tc_heuristic_recover); - for (len=commit_list ? commit_list->records : MAX_XID_LIST_SIZE ; - list==0 && len > MIN_XID_LIST_SIZE; len/=2) + for (len= MAX_XID_LIST_SIZE ; list==0 && len > MIN_XID_LIST_SIZE; len/=2) { list=(XID *)my_malloc(len*sizeof(XID), MYF(0)); } diff --git a/sql/handler.h b/sql/handler.h index 3a1862cad07..ad9345ac75c 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -253,7 +253,11 @@ typedef struct xid_t XID; /* for recover() handlerton call */ #define MIN_XID_LIST_SIZE 128 +#ifdef SAFEMALLOC +#define MAX_XID_LIST_SIZE 256 +#else #define MAX_XID_LIST_SIZE (1024*128) +#endif /* handlerton is a singleton structure - one instance per storage engine - diff --git a/sql/item.cc b/sql/item.cc index 33e6d7cfc42..da9c98862b7 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -4349,7 +4349,7 @@ my_decimal *Item_cache_real::val_decimal(my_decimal *decimal_val) void Item_cache_decimal::store(Item *item) { my_decimal *val= item->val_decimal_result(&decimal_value); - if (val != &decimal_value) + if (val != &decimal_value && !item->null_value) my_decimal2decimal(val, &decimal_value); null_value= item->null_value; } diff --git a/sql/item_func.cc b/sql/item_func.cc index 40abd130d02..3742a13e0bc 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -3169,7 +3169,7 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name, entry->value=0; entry->length=0; entry->update_query_id=0; - entry->collation.set(NULL, DERIVATION_NONE); + entry->collation.set(NULL, DERIVATION_IMPLICIT); /* If we are here, we were called from a SET or a query which sets a variable. Imagine it is this: @@ -3227,8 +3227,8 @@ bool Item_func_set_user_var::fix_fields(THD *thd, TABLE_LIST *tables, and the variable has previously been initialized. */ if (!entry->collation.collation || !args[0]->null_value) - entry->collation.set(args[0]->collation); - collation.set(entry->collation); + entry->collation.set(args[0]->collation.collation, DERIVATION_IMPLICIT); + collation.set(entry->collation.collation, DERIVATION_IMPLICIT); cached_result_type= args[0]->result_type(); return FALSE; } @@ -3240,7 +3240,7 @@ Item_func_set_user_var::fix_length_and_dec() maybe_null=args[0]->maybe_null; max_length=args[0]->max_length; decimals=args[0]->decimals; - collation.set(args[0]->collation); + collation.set(args[0]->collation.collation, DERIVATION_IMPLICIT); } @@ -3516,7 +3516,7 @@ Item_func_set_user_var::update() res= update_hash((void*) save_result.vstr->ptr(), save_result.vstr->length(), STRING_RESULT, save_result.vstr->charset(), - args[0]->collation.derivation); + DERIVATION_IMPLICIT); break; } case DECIMAL_RESULT: diff --git a/sql/item_sum.h b/sql/item_sum.h index e284416f0f5..eca2ae188db 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -691,16 +691,24 @@ public: { int err_not_used; char *end_not_used; - String *res; res=val_str(&str_value); + String *res; + res=val_str(&str_value); return res ? my_strntod(res->charset(),(char*) res->ptr(),res->length(), &end_not_used, &err_not_used) : 0.0; } longlong val_int() { int err_not_used; - String *res; res=val_str(&str_value); - return res ? my_strntoll(res->charset(),res->ptr(),res->length(),10, - (char**) 0, &err_not_used) : (longlong) 0; + char *end; + String *res; + longlong value; + CHARSET_INFO *cs; + + if (!(res= val_str(&str_value))) + return 0; /* Null value */ + cs= res->charset(); + end= (char*) res->ptr()+res->length(); + return cs->cset->my_strtoll10(cs, res->ptr(), &end, &err_not_used); } my_decimal *val_decimal(my_decimal *dec); enum Item_result result_type () const { return STRING_RESULT; } diff --git a/sql/log.cc b/sql/log.cc index 6cb465f839c..5348ae795b5 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -2903,7 +2903,12 @@ int TC_LOG_BINLOG::open(const char *opt_name) pthread_cond_init (&COND_prep_xids, 0); if (using_heuristic_recover()) + { + /* generate a new binlog to mask a corrupted one */ + open(opt_name, LOG_BIN, 0, WRITE_CACHE, 0, max_binlog_size, 0); + cleanup(); return 1; + } if ((error= find_log_pos(&log_info, NullS, 1))) { @@ -2946,9 +2951,9 @@ int TC_LOG_BINLOG::open(const char *opt_name) if ((ev= Log_event::read_log_event(&log, 0, &fdle)) && ev->get_type_code() == FORMAT_DESCRIPTION_EVENT && ev->flags & LOG_EVENT_BINLOG_IN_USE_F) - error= recover(&log, (Format_description_log_event *)ev); - else - error=0; + error= recover(&log, (Format_description_log_event *)ev); + else + error=0; delete ev; end_io_cache(&log); diff --git a/sql/log_event.cc b/sql/log_event.cc index 7b030de6839..75d682fa6cd 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1450,7 +1450,6 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli) thd->query_id = next_query_id(); VOID(pthread_mutex_unlock(&LOCK_thread_count)); thd->variables.pseudo_thread_id= thread_id; // for temp tables - mysql_log.write(thd,COM_QUERY,"%s",thd->query); DBUG_PRINT("query",("%s",thd->query)); if (ignored_error_code((expected_error= error_code)) || @@ -1535,9 +1534,13 @@ START SLAVE; . Query: '%s'", expected_error, thd->query); goto end; } + /* If the query was not ignored, it is printed to the general log */ + if (thd->net.last_errno != ER_SLAVE_IGNORED_TABLE) + mysql_log.write(thd,COM_QUERY,"%s",thd->query); + compare_errors: - - /* + + /* If we expected a non-zero error code, and we don't get the same error code, and none of them should be ignored. */ @@ -3470,7 +3473,12 @@ int User_var_log_event::exec_event(struct st_relay_log_info* rli) 0 can be passed as last argument (reference on item) */ e.fix_fields(thd, 0, 0); - e.update_hash(val, val_len, type, charset, DERIVATION_NONE); + /* + A variable can just be considered as a table with + a single record and with a single column. Thus, like + a column value, it could always have IMPLICIT derivation. + */ + e.update_hash(val, val_len, type, charset, DERIVATION_IMPLICIT); free_root(thd->mem_root,0); rli->inc_event_relay_log_pos(); diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 942822c2f12..7c625c208e1 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -254,6 +254,10 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset; /* The rest of the file is included in the server only */ #ifndef MYSQL_CLIENT +/* If set to 0, then the thread will ignore all warnings with level notes. + Set by executing SET SQL_NOTES=1 */ +#define OPTION_SQL_NOTES (1L << 31) + /* Bits for different SQL modes modes (including ANSI mode) */ #define MODE_REAL_AS_FLOAT 1 #define MODE_PIPES_AS_CONCAT 2 diff --git a/sql/mysqld.cc b/sql/mysqld.cc index d638a54cf67..e5939dceec5 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -321,12 +321,14 @@ my_bool opt_old_style_user_limits= 0; volatile bool mqh_used = 0; my_bool sp_automatic_privileges= 1; +#ifdef HAVE_INITGROUPS +static bool calling_initgroups= FALSE; /* Used in SIGSEGV handler. */ +#endif uint mysqld_port, test_flags, select_errors, dropping_tables, ha_open_options; uint delay_key_write_options, protocol_version; uint lower_case_table_names; uint tc_heuristic_recover= 0; uint volatile thread_count, thread_running, kill_cached_threads, wake_thread; - ulong back_log, connect_timeout, concurrency; ulong server_id, thd_startup_options; ulong table_cache_size, thread_stack, thread_stack_min, what_to_log; @@ -1171,7 +1173,15 @@ static void set_user(const char *user, struct passwd *user_info) #if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__) DBUG_ASSERT(user_info); #ifdef HAVE_INITGROUPS - initgroups((char*) user,user_info->pw_gid); + /* + We can get a SIGSEGV when calling initgroups() on some systems when NSS + is configured to use LDAP and the server is statically linked. We set + calling_initgroups as a flag to the SIGSEGV handler that is then used to + output a specific message to help the user resolve this problem. + */ + calling_initgroups= TRUE; + initgroups((char*) user, user_info->pw_gid); + calling_initgroups= FALSE; #endif if (setgid(user_info->pw_gid) == -1) { @@ -1926,6 +1936,17 @@ information that should help you find out what is causing the crash.\n"); fflush(stderr); #endif /* HAVE_STACKTRACE */ +#ifdef HAVE_INITGROUPS + if (calling_initgroups) + fprintf(stderr, "\n\ +This crash occured while the server was calling initgroups(). This is\n\ +often due to the use of a mysqld that is statically linked against glibc\n\ +and configured to use LDAP in /etc/nsswitch.conf. You will need to either\n\ +upgrade to a version of glibc that does not have this problem (2.3.4 or\n\ +later when used with nscd), disable LDAP in your nsswitch.conf, or use a\n\ +mysqld that is not statically linked.\n"); +#endif + if (test_flags & TEST_CORE_ON_SIGNAL) { fprintf(stderr, "Writing a core file\n"); @@ -2743,7 +2764,7 @@ server."); (TC_LOG *)&tc_log_mmap : (TC_LOG *)&tc_log_dummy; - if (tc_log->open(opt_tc_log_file)) + if (tc_log->open(opt_bin_logname)) { sql_print_error("Can't init tc log"); unireg_abort(1); @@ -4662,7 +4683,7 @@ Disable with --skip-ndbcluster (will save memory).", (gptr*) &opt_ndb_optimized_node_selection, (gptr*) &opt_ndb_optimized_node_selection, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, - { "ndb_cache_check_time", OPT_NDB_CACHE_CHECK_TIME, + { "ndb-cache-check-time", OPT_NDB_CACHE_CHECK_TIME, "A dedicated thread is created to update cached commit count value" " at the given interval.", (gptr*) &opt_ndb_cache_check_time, (gptr*) &opt_ndb_cache_check_time, @@ -5799,7 +5820,8 @@ static void mysql_init_variables(void) language_ptr= language; mysql_data_home= mysql_real_data_home; thd_startup_options= (OPTION_UPDATE_LOG | OPTION_AUTO_IS_NULL | - OPTION_BIN_LOG | OPTION_QUOTE_SHOW_CREATE); + OPTION_BIN_LOG | OPTION_QUOTE_SHOW_CREATE | + OPTION_SQL_NOTES); protocol_version= PROTOCOL_VERSION; what_to_log= ~ (1L << (uint) COM_TIME); refresh_version= flush_version= 1L; /* Increments on each reload */ diff --git a/sql/opt_range.cc b/sql/opt_range.cc index ceb9f97bbbc..66d9da10334 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2562,7 +2562,8 @@ static double ror_scan_selectivity(const ROR_INTERSECT_INFO *info, char *key_ptr= (char*) key_val; SEL_ARG *sel_arg, *tuple_arg= NULL; bool cur_covered; - bool prev_covered= bitmap_is_set(&info->covered_fields, key_part->fieldnr); + bool prev_covered= test(bitmap_is_set(&info->covered_fields, + key_part->fieldnr)); key_range min_range; key_range max_range; min_range.key= (byte*) key_val; @@ -2575,7 +2576,9 @@ static double ror_scan_selectivity(const ROR_INTERSECT_INFO *info, for(i= 0, sel_arg= scan->sel_arg; sel_arg; i++, sel_arg= sel_arg->next_key_part) { - cur_covered= bitmap_is_set(&info->covered_fields, (key_part + i)->fieldnr); + DBUG_PRINT("info",("sel_arg step")); + cur_covered= test(bitmap_is_set(&info->covered_fields, + (key_part + i)->fieldnr)); if (cur_covered != prev_covered) { /* create (part1val, ..., part{n-1}val) tuple. */ diff --git a/sql/procedure.h b/sql/procedure.h index 4e5bf8a2f4b..5d0dccbcd5e 100644 --- a/sql/procedure.h +++ b/sql/procedure.h @@ -110,7 +110,7 @@ public: { int err_not_used; char *end_not_used; - CHARSET_INFO *cs=str_value.charset(); + CHARSET_INFO *cs= str_value.charset(); return my_strntod(cs, (char*) str_value.ptr(), str_value.length(), &end_not_used, &err_not_used); } diff --git a/sql/set_var.cc b/sql/set_var.cc index cdee9e6d4d1..50094bb7f00 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -459,6 +459,9 @@ static sys_var_thd_bit sys_log_binlog("sql_log_bin", static sys_var_thd_bit sys_sql_warnings("sql_warnings", 0, set_option_bit, OPTION_WARNINGS); +static sys_var_thd_bit sys_sql_notes("sql_notes", 0, + set_option_bit, + OPTION_SQL_NOTES); static sys_var_thd_bit sys_auto_is_null("sql_auto_is_null", 0, set_option_bit, OPTION_AUTO_IS_NULL); @@ -653,6 +656,7 @@ sys_var *sys_variables[]= &sys_sql_max_join_size, &sys_sql_mode, &sys_sql_warnings, + &sys_sql_notes, &sys_storage_engine, #ifdef HAVE_REPLICATION &sys_sync_binlog_period, @@ -927,6 +931,8 @@ struct show_var_st init_vars[]= { {sys_sort_buffer.name, (char*) &sys_sort_buffer, SHOW_SYS}, {sys_sql_mode.name, (char*) &sys_sql_mode, SHOW_SYS}, {sys_storage_engine.name, (char*) &sys_storage_engine, SHOW_SYS}, + {"sql_notes", (char*) &sys_sql_notes, SHOW_BOOL}, + {"sql_warnings", (char*) &sys_sql_warnings, SHOW_BOOL}, #ifdef HAVE_REPLICATION {sys_sync_binlog_period.name,(char*) &sys_sync_binlog_period, SHOW_SYS}, {sys_sync_replication.name, (char*) &sys_sync_replication, SHOW_SYS}, diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 83dbc504344..651fa947694 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -212,7 +212,8 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables) if (strcmp(host.db, tmp_name) != 0) sql_print_warning("'host' entry '%s|%s' had database in mixed " "case that has been forced to lowercase because " - "lower_case_table_names is set.", + "lower_case_table_names is set. It will not be " + "possible to remove this privilege using REVOKE.", host.host.hostname, host.db); } host.access= get_access(table,2); @@ -437,7 +438,8 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables) { sql_print_warning("'db' entry '%s %s@%s' had database in mixed " "case that has been forced to lowercase because " - "lower_case_table_names is set.", + "lower_case_table_names is set. It will not be " + "possible to remove this privilege using REVOKE.", db.db, db.user, db.host.hostname, db.host.hostname); } } diff --git a/sql/sql_class.h b/sql/sql_class.h index e793f5776d7..d57eb3d3cc6 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1072,7 +1072,8 @@ public: MEM_ROOT mem_root; // Transaction-life memory allocation pool void cleanup() { - changed_tables = 0; + changed_tables= 0; + savepoints= 0; #ifdef USING_TRANSACTIONS free_root(&mem_root,MYF(MY_KEEP_PREALLOC)); #endif diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index c01728e68d5..eb7b3e8a319 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -124,10 +124,16 @@ int mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *orig_table_list) /* Temp table is created so that it hounours if UNION without ALL is to be processed + + As 'distinct' parameter we always pass FALSE (0), because underlying + query will control distinct condition by itself. Correct test of + distinct underlying query will be is_union && + !unit->union_distinct->next_select() (i.e. it is union and last distinct + SELECT is last SELECT of UNION). */ if (!(table= create_tmp_table(thd, &derived_result->tmp_table_param, unit->types, (ORDER*) 0, - is_union && unit->union_distinct, 1, + FALSE, 1, (first_select->options | thd->options | TMP_TABLE_ALL_COLUMNS), HA_POS_ERROR, diff --git a/sql/sql_error.cc b/sql/sql_error.cc index d0f06c47edb..79f7579d311 100644 --- a/sql/sql_error.cc +++ b/sql/sql_error.cc @@ -106,6 +106,9 @@ MYSQL_ERROR *push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level, MYSQL_ERROR *err= 0; DBUG_ENTER("push_warning"); + if (level == MYSQL_ERROR::WARN_LEVEL_NOTE && !(thd->options & OPTION_SQL_NOTES)) + return(0); + if (thd->query_id != thd->warn_id) mysql_reset_errors(thd); thd->got_warning= 1; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 2bb64cd0600..3e2915e6e07 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -60,6 +60,7 @@ extern "C" int gethostname(char *name, int namelen); #endif +static void time_out_user_resource_limits(THD *thd, USER_CONN *uc); #ifndef NO_EMBEDDED_ACCESS_CHECKS static int check_for_max_user_connections(THD *thd, USER_CONN *uc); #endif @@ -70,6 +71,7 @@ static void remove_escape(char *name); static void refresh_status(void); static bool append_file_to_dir(THD *thd, const char **filename_ptr, const char *table_name); +static void log_slow_query(THD *thd); const char *any_db="*any*"; // Special symbol for check_access @@ -486,6 +488,7 @@ static int check_for_max_user_connections(THD *thd, USER_CONN *uc) error=1; goto end; } + time_out_user_resource_limits(thd, uc); if (uc->user_resources.user_conn && uc->user_resources.user_conn < uc->connections) { @@ -604,36 +607,56 @@ bool is_update_query(enum enum_sql_command command) } /* - Check if maximum queries per hour limit has been reached - returns 0 if OK. + Reset per-hour user resource limits when it has been more than + an hour since they were last checked - In theory we would need a mutex in the USER_CONN structure for this to - be 100 % safe, but as the worst scenario is that we would miss counting - a couple of queries, this isn't critical. + SYNOPSIS: + time_out_user_resource_limits() + thd Thread handler + uc User connection details + + NOTE: + This assumes that the LOCK_user_conn mutex has been acquired, so it is + safe to test and modify members of the USER_CONN structure. */ +static void time_out_user_resource_limits(THD *thd, USER_CONN *uc) +{ + bool error= 0; + time_t check_time = thd->start_time ? thd->start_time : time(NULL); + DBUG_ENTER("time_out_user_resource_limits"); + + /* If more than a hour since last check, reset resource checking */ + if (check_time - uc->intime >= 3600) + { + uc->questions=1; + uc->updates=0; + uc->conn_per_hour=0; + uc->intime=check_time; + } + + DBUG_VOID_RETURN; +} + + +/* + Check if maximum queries per hour limit has been reached + returns 0 if OK. +*/ static bool check_mqh(THD *thd, uint check_command) { -#ifdef NO_EMBEDDED_ACCESS_CHECKS - return(0); -#else - bool error=0; +#ifndef NO_EMBEDDED_ACCESS_CHECKS + bool error= 0; time_t check_time = thd->start_time ? thd->start_time : time(NULL); USER_CONN *uc=thd->user_connect; DBUG_ENTER("check_mqh"); DBUG_ASSERT(uc != 0); - /* If more than a hour since last check, reset resource checking */ - if (check_time - uc->intime >= 3600) - { - (void) pthread_mutex_lock(&LOCK_user_conn); - uc->questions=1; - uc->updates=0; - uc->conn_per_hour=0; - uc->intime=check_time; - (void) pthread_mutex_unlock(&LOCK_user_conn); - } + (void) pthread_mutex_lock(&LOCK_user_conn); + + time_out_user_resource_limits(thd, uc); + /* Check that we have not done too many questions / hour */ if (uc->user_resources.questions && uc->questions++ >= uc->user_resources.questions) @@ -656,7 +679,10 @@ static bool check_mqh(THD *thd, uint check_command) } } end: + (void) pthread_mutex_unlock(&LOCK_user_conn); DBUG_RETURN(error); +#else + return (0); #endif /* NO_EMBEDDED_ACCESS_CHECKS */ } @@ -1630,6 +1656,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd, #endif ulong length= (ulong)(packet_end-packet); + log_slow_query(thd); + /* Remove garbage at start of query */ while (my_isspace(thd->charset(), *packet) && length > 0) { @@ -1640,6 +1668,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, thd->query_length= length; thd->query= packet; thd->query_id= next_query_id(); + thd->set_time(); /* Reset the query start time. */ /* TODO: set thd->lex->sql_command to SQLCOM_END here */ VOID(pthread_mutex_unlock(&LOCK_thread_count)); #ifndef EMBEDDED_LIBRARY @@ -1968,6 +1997,24 @@ bool dispatch_command(enum enum_server_command command, THD *thd, if (thd->net.report_error) net_send_error(thd); + log_slow_query(thd); + + thd->proc_info="cleaning up"; + VOID(pthread_mutex_lock(&LOCK_thread_count)); // For process list + thd->proc_info=0; + thd->command=COM_SLEEP; + thd->query=0; + thd->query_length=0; + thread_running--; + VOID(pthread_mutex_unlock(&LOCK_thread_count)); + thd->packet.shrink(thd->variables.net_buffer_length); // Reclaim some memory + free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC)); + DBUG_RETURN(error); +} + + +static void log_slow_query(THD *thd) +{ time_t start_of_query=thd->start_time; thd->end_time(); // Set start time @@ -1986,18 +2033,6 @@ bool dispatch_command(enum enum_server_command command, THD *thd, mysql_slow_log.write(thd, thd->query, thd->query_length, start_of_query); } } - thd->proc_info="cleaning up"; - VOID(pthread_mutex_lock(&LOCK_thread_count)); // For process list - thd->proc_info=0; - thd->command=COM_SLEEP; - thd->query=0; - thd->query_length=0; - thread_running--; - VOID(pthread_mutex_unlock(&LOCK_thread_count)); - thd->packet.shrink(thd->variables.net_buffer_length); // Reclaim some memory - - free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC)); - DBUG_RETURN(error); } diff --git a/sql/sql_update.cc b/sql/sql_update.cc index b7a088ff37c..80ad13195c8 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -707,7 +707,12 @@ bool mysql_multi_update_prepare(THD *thd) else { DBUG_PRINT("info",("setting table `%s` for read-only", tl->alias)); - tl->lock_type= TL_READ; + /* + If we are using the binary log, we need TL_READ_NO_INSERT to get + correct order of statements. Otherwise, we use a TL_READ lock to + improve performance. + */ + tl->lock_type= using_update_log ? TL_READ_NO_INSERT : TL_READ; tl->updating= 0; } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index c75068f0047..ba1b999b240 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -2451,7 +2451,7 @@ create_select: SELECT_SYM { LEX *lex=Lex; - lex->lock_option= (using_update_log) ? TL_READ_NO_INSERT : TL_READ; + lex->lock_option= using_update_log ? TL_READ_NO_INSERT : TL_READ; if (lex->sql_command == SQLCOM_INSERT) lex->sql_command= SQLCOM_INSERT_SELECT; else if (lex->sql_command == SQLCOM_REPLACE) diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index 4c90726e877..187e5cb9e4a 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -578,7 +578,7 @@ static MY_UNICASE_INFO plane04[]={ {0x0412,0x0432,0x0412}, {0x0413,0x0433,0x0413}, {0x0414,0x0434,0x0414}, {0x0415,0x0435,0x0415}, {0x0416,0x0436,0x0416}, {0x0417,0x0437,0x0417}, - {0x0418,0x0438,0x0418}, {0x0419,0x0439,0x0418}, + {0x0418,0x0438,0x0418}, {0x0419,0x0439,0x0419}, {0x041A,0x043A,0x041A}, {0x041B,0x043B,0x041B}, {0x041C,0x043C,0x041C}, {0x041D,0x043D,0x041D}, {0x041E,0x043E,0x041E}, {0x041F,0x043F,0x041F}, @@ -594,7 +594,7 @@ static MY_UNICASE_INFO plane04[]={ {0x0412,0x0432,0x0412}, {0x0413,0x0433,0x0413}, {0x0414,0x0434,0x0414}, {0x0415,0x0435,0x0415}, {0x0416,0x0436,0x0416}, {0x0417,0x0437,0x0417}, - {0x0418,0x0438,0x0418}, {0x0419,0x0439,0x0418}, + {0x0418,0x0438,0x0418}, {0x0419,0x0439,0x0419}, {0x041A,0x043A,0x041A}, {0x041B,0x043B,0x041B}, {0x041C,0x043C,0x041C}, {0x041D,0x043D,0x041D}, {0x041E,0x043E,0x041E}, {0x041F,0x043F,0x041F}, diff --git a/strings/strtod.c b/strings/strtod.c index 92d93612dd0..61f2c107abe 100644 --- a/strings/strtod.c +++ b/strings/strtod.c @@ -56,8 +56,8 @@ static double scaler1[] = { double my_strtod(const char *str, char **end_ptr, int *error) { double result= 0.0; - uint negative= 0, ndigits, dec_digits= 0, pre_zero, neg_exp= 0; - int exp= 0; + uint negative= 0, ndigits, dec_digits= 0, neg_exp= 0; + int exp= 0, digits_after_dec_point= 0; const char *old_str, *end= *end_ptr, *start_of_number; char next_char; my_bool overflow=0; @@ -100,18 +100,20 @@ double my_strtod(const char *str, char **end_ptr, int *error) } ndigits= (uint) (str-old_str); - pre_zero= 0; if (next_char == '.' && str < end-1) { - double p10= 10; + /* + Continue to add numbers after decimal point to the result, as if there + was no decimal point. We will later (in the exponent handling) shift + the number down with the required number of fractions. We do it this + way to be able to get maximum precision for numbers like 123.45E+02, + which are normal for some ODBC applications. + */ old_str= ++str; while (my_isdigit(&my_charset_latin1, (next_char= *str))) { - result+= (next_char - '0')/p10; - if (!result) - pre_zero++; - else - p10*= 10; + result= result*10.0 + (next_char - '0'); + digits_after_dec_point++; if (++str == end) { next_char= 0; @@ -136,13 +138,14 @@ double my_strtod(const char *str, char **end_ptr, int *error) { do { - if (exp < 9999) /* protec against exp overfl. */ - exp= exp*10 + *str - '0'; + if (exp < 9999) /* prot. against exp overfl. */ + exp= exp*10 + (*str - '0'); str++; } while (str < end && my_isdigit(&my_charset_latin1, *str)); } } - if ((exp= neg_exp ? exp + pre_zero : exp - pre_zero)) + if ((exp= (neg_exp ? exp + digits_after_dec_point : + exp - digits_after_dec_point))) { double scaler; if (exp < 0)