diff options
78 files changed, 782 insertions, 178 deletions
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/config-win.h b/include/config-win.h index ba1a987f14c..e86e0f08596 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -408,4 +408,5 @@ inline double ulonglong2double(ulonglong value) #define HAVE_CHARSET_ucs2 1 #define HAVE_CHARSET_ujis 1 #define HAVE_CHARSET_utf8 1 +#define HAVE_UCA_COLLATIONS 1 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/include/mysys_err.h b/include/mysys_err.h index 1fd7c2eddc6..1e489395c76 100644 --- a/include/mysys_err.h +++ b/include/mysys_err.h @@ -56,7 +56,8 @@ extern const char * NEAR globerrs[]; /* my_error_messages is here */ #define EE_CANT_SYMLINK 25 #define EE_REALPATH 26 #define EE_SYNC 27 -#define EE_ERROR_LAST 27 /*Copy last error nr.*/ +#define EE_UNKNOWN_COLLATION 28 +#define EE_ERROR_LAST 28 /*Copy last error nr.*/ /* Add error numbers before EE_ERROR_LAST and change it accordingly. */ /* exit codes for all MySQL programs */ 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/myisam/myisamchk.c b/myisam/myisamchk.c index eeb1ccf528e..09e2914bbaa 100644 --- a/myisam/myisamchk.c +++ b/myisam/myisamchk.c @@ -41,8 +41,8 @@ SET_STACK_SIZE(9000) /* Minimum stack size for program */ static uint decode_bits; static char **default_argv; static const char *load_default_groups[]= { "myisamchk", 0 }; -static const char *set_charset_name, *opt_tmpdir; -static CHARSET_INFO *set_charset; +static const char *set_collation_name, *opt_tmpdir; +static CHARSET_INFO *set_collation; static long opt_myisam_block_size; static long opt_key_cache_block_size; static const char *my_progname_short; @@ -149,7 +149,7 @@ int main(int argc, char **argv) } /* main */ enum options_mc { - OPT_CHARSETS_DIR=256, OPT_SET_CHARSET,OPT_START_CHECK_POS, + OPT_CHARSETS_DIR=256, OPT_SET_COLLATION,OPT_START_CHECK_POS, OPT_CORRECT_CHECKSUM, OPT_KEY_BUFFER_SIZE, OPT_KEY_CACHE_BLOCK_SIZE, OPT_MYISAM_BLOCK_SIZE, OPT_READ_BUFFER_SIZE, OPT_WRITE_BUFFER_SIZE, OPT_SORT_BUFFER_SIZE, @@ -252,9 +252,9 @@ static struct my_option my_long_options[] = (gptr*) &check_param.auto_increment_value, (gptr*) &check_param.auto_increment_value, 0, GET_ULL, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"set-character-set", OPT_SET_CHARSET, - "Change the character set used by the index", - (gptr*) &set_charset_name, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"set-collation", OPT_SET_COLLATION, + "Change the collation used by the index", + (gptr*) &set_collation_name, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"set-variable", 'O', "Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -739,8 +739,9 @@ static void get_options(register int *argc,register char ***argv) check_param.tmpdir=&myisamchk_tmpdir; check_param.key_cache_block_size= opt_key_cache_block_size; - if (set_charset_name) - if (!(set_charset=get_charset_by_name(set_charset_name, MYF(MY_WME)))) + if (set_collation_name) + if (!(set_collation= get_charset_by_name(set_collation_name, + MYF(MY_WME)))) exit(1); myisam_block_size=(uint) 1 << my_bit_log2(opt_myisam_block_size); @@ -874,11 +875,12 @@ static int myisamchk(MI_CHECK *param, my_string filename) (((ulonglong) 1L << share->base.keys)-1)) || test_if_almost_full(info) || info->s->state.header.file_version[3] != myisam_file_magic[3] || - (set_charset && set_charset->number != share->state.header.language) || + (set_collation && + set_collation->number != share->state.header.language) || myisam_block_size != MI_KEY_BLOCK_LENGTH)) { - if (set_charset) - param->language=set_charset->number; + if (set_collation) + param->language= set_collation->number; if (recreate_table(param, &info,filename)) { VOID(fprintf(stderr, diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 8a71d8fc566..cee8ca4bfd0 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 @@ -690,7 +691,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/count_distinct2.result b/mysql-test/r/count_distinct2.result index f6b888dec3b..131e3b325ec 100644 --- a/mysql-test/r/count_distinct2.result +++ b/mysql-test/r/count_distinct2.result @@ -116,7 +116,7 @@ count(distinct n) 5000 show status like 'Created_tmp_disk_tables'; Variable_name Value -Created_tmp_disk_tables 2 +Created_tmp_disk_tables 1 drop table t1; create table t1 (s text); flush status; @@ -125,5 +125,5 @@ count(distinct s) 5000 show status like 'Created_tmp_disk_tables'; Variable_name Value -Created_tmp_disk_tables 2 +Created_tmp_disk_tables 1 drop table t1; 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 <one> two <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/func_str.result b/mysql-test/r/func_str.result index 71a1a7539b0..85a0c2c55f9 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -742,3 +742,9 @@ WHERE a = CONV('e251273eb74a8ee3', 16, 10); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 DROP TABLE t1; +SELECT CHAR(NULL,121,83,81,'76') as my_column; +my_column +ySQL +SELECT CHAR_LENGTH(CHAR(NULL,121,83,81,'76')) as my_column; +my_column +4 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/information_schema.result b/mysql-test/r/information_schema.result index e8ec4f70139..121de940560 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -494,8 +494,8 @@ select TABLE_NAME,TABLE_TYPE,ENGINE from information_schema.tables where table_schema='information_schema' limit 2; TABLE_NAME TABLE_TYPE ENGINE -SCHEMATA TEMPORARY MyISAM -TABLES TEMPORARY MyISAM +SCHEMATA TEMPORARY MEMORY +TABLES TEMPORARY MEMORY show tables from information_schema like "T%"; Tables_in_information_schema (T%) TABLES @@ -610,3 +610,24 @@ create view v1 as select * from t1, t2; set @got_val= (select count(*) from information_schema.columns); drop view v1; drop table t1, t2; +CREATE TABLE t_crashme ( f1 BIGINT); +CREATE VIEW a1 (t_CRASHME) AS SELECT f1 FROM t_crashme GROUP BY f1; +CREATE VIEW a2 AS SELECT t_CRASHME FROM a1; +drop view a2, a1; +drop table t_crashme; +select table_schema,table_name, column_name from +information_schema.columns +where data_type = 'longtext'; +table_schema table_name column_name +information_schema COLUMNS COLUMN_TYPE +information_schema ROUTINES ROUTINE_DEFINITION +information_schema ROUTINES SQL_MODE +information_schema VIEWS VIEW_DEFINITION +select table_name, column_name, data_type from information_schema.columns +where data_type = 'datetime'; +table_name column_name data_type +TABLES CREATE_TIME datetime +TABLES UPDATE_TIME datetime +TABLES CHECK_TIME datetime +ROUTINES CREATED datetime +ROUTINES LAST_ALTERED datetime 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/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/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/temp_table.result b/mysql-test/r/temp_table.result index 6e36f24d8b0..2dd58f54327 100644 --- a/mysql-test/r/temp_table.result +++ b/mysql-test/r/temp_table.result @@ -94,6 +94,6 @@ d 2002-10-24 14:50:40 show status like "created_tmp%tables"; Variable_name Value -Created_tmp_disk_tables 1 +Created_tmp_disk_tables 0 Created_tmp_tables 2 drop table t1; 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/r/warnings.result b/mysql-test/r/warnings.result index a2e99be62ad..222638f64bb 100644 --- a/mysql-test/r/warnings.result +++ b/mysql-test/r/warnings.result @@ -1,6 +1,33 @@ drop table if exists t1, t2; SET SQL_WARNINGS=1; create table t1 (a int); +create table t1 (a int); +ERROR 42S01: Table 't1' already exists +show count(*) errors; +@@session.error_count +1 +show errors; +Level Code Message +Error 1050 Table 't1' already exists +show warnings; +Level Code Message +Error 1050 Table 't1' already exists +create table t2(a int) default charset qwerty; +ERROR 42000: Unknown character set: 'qwerty' +show count(*) errors; +@@session.error_count +1 +show errors; +Level Code Message +Error 1115 Unknown character set: 'qwerty' +create table t (i); +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 ')' at line 1 +show count(*) errors; +@@session.error_count +1 +show errors; +Level Code Message +Error 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 insert into t1 values (1); insert into t1 values ("hej"); Warnings: 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/func_str.test b/mysql-test/t/func_str.test index ffbcc1d774b..a69febef340 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -479,3 +479,9 @@ EXPLAIN WHERE a = CONV('e251273eb74a8ee3', 16, 10); DROP TABLE t1; + +# +# Bug #6317: string function CHAR, parameter is NULL, wrong result +# +SELECT CHAR(NULL,121,83,81,'76') as my_column; +SELECT CHAR_LENGTH(CHAR(NULL,121,83,81,'76')) as my_column; 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/information_schema.test b/mysql-test/t/information_schema.test index baf817b7c84..86d7bad76bc 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -363,3 +363,40 @@ create view v1 as select * from t1, t2; set @got_val= (select count(*) from information_schema.columns); drop view v1; drop table t1, t2; + +# +# Bug #7476: crash on SELECT * FROM INFORMATION_SCHEMA.TABLES +# + +CREATE TABLE t_crashme ( f1 BIGINT); +CREATE VIEW a1 (t_CRASHME) AS SELECT f1 FROM t_crashme GROUP BY f1; +CREATE VIEW a2 AS SELECT t_CRASHME FROM a1; +let $tab_count= 65; +--disable_query_log +while ($tab_count) +{ + EVAL CREATE TABLE t_$tab_count (f1 BIGINT); + dec $tab_count ; +} +--disable_result_log +SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES; +--enable_result_log +let $tab_count= 65; +while ($tab_count) +{ + EVAL DROP TABLE t_$tab_count; + dec $tab_count ; +} +--enable_query_log +drop view a2, a1; +drop table t_crashme; + +# +# Bug #7215 information_schema: columns are longtext instead of varchar +# Bug #7217 information_schema: columns are varbinary() instead of timestamp +# +select table_schema,table_name, column_name from +information_schema.columns +where data_type = 'longtext'; +select table_name, column_name, data_type from information_schema.columns +where data_type = 'datetime'; 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/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 850d3c1741c..47b5754232c 100644 --- a/mysql-test/t/rpl_rotate_logs.test +++ b/mysql-test/t/rpl_rotate_logs.test @@ -175,7 +175,7 @@ while ($1) commit; drop table t1; let $VERSION=`select version()`; ---replace_result $VERSION 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/mysql-test/t/warnings.test b/mysql-test/t/warnings.test index 67162e7f84b..c71365c3da6 100644 --- a/mysql-test/t/warnings.test +++ b/mysql-test/t/warnings.test @@ -7,6 +7,19 @@ drop table if exists t1, t2; SET SQL_WARNINGS=1; create table t1 (a int); +--error 1050 +create table t1 (a int); +show count(*) errors; +show errors; +show warnings; +--error 1115 +create table t2(a int) default charset qwerty; +show count(*) errors; +show errors; +--error 1064 +create table t (i); +show count(*) errors; +show errors; insert into t1 values (1); insert into t1 values ("hej"); insert into t1 values ("hej"),("då"); diff --git a/mysys/charset.c b/mysys/charset.c index bb8f2d178b9..4b7ad3e59f4 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; @@ -530,7 +530,7 @@ CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags) { char index_file[FN_REFLEN]; strmov(get_charsets_dir(index_file),MY_CHARSET_INDEX); - my_error(EE_UNKNOWN_CHARSET, MYF(ME_BELL), cs_name, index_file); + my_error(EE_UNKNOWN_COLLATION, MYF(ME_BELL), cs_name, index_file); } return cs; diff --git a/mysys/errors.c b/mysys/errors.c index 5f548cad480..d321e7f6125 100644 --- a/mysys/errors.c +++ b/mysys/errors.c @@ -49,6 +49,7 @@ const char * NEAR globerrs[GLOBERRS]= "Can't create symlink '%s' pointing at '%s' (Error %d)", "Error on realpath() on '%s' (Error %d)", "Can't sync file '%s' to disk (Errcode: %d)", + "Collation '%s' is not a compiled collation and is not specified in the '%s' file", }; void init_glob_errs(void) @@ -87,5 +88,6 @@ void init_glob_errs() EE(EE_CANT_SYMLINK)= "Can't create symlink '%s' pointing at '%s' (Error %d)"; EE(EE_REALPATH)= "Error on realpath() on '%s' (Error %d)"; EE(EE_SYNC)= "Can't sync file '%s' to disk (Errcode: %d)"; + EE(EE_UNKNOWN_COLLATION)= "Collation '%s' is not a compiled collation and is not specified in the %s file"; } #endif 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/ndb/src/kernel/main.cpp b/ndb/src/kernel/main.cpp index 7d435d4505b..ead9e68526c 100644 --- a/ndb/src/kernel/main.cpp +++ b/ndb/src/kernel/main.cpp @@ -187,11 +187,9 @@ int main(int argc, char** argv) assert("Illegal state globalData.theRestartFlag" == 0); } - SocketServer socket_server; - globalTransporterRegistry.startSending(); globalTransporterRegistry.startReceiving(); - if (!globalTransporterRegistry.start_service(socket_server)){ + if (!globalTransporterRegistry.start_service(*globalEmulatorData.m_socket_server)){ ndbout_c("globalTransporterRegistry.start_service() failed"); exit(-1); } @@ -203,7 +201,7 @@ int main(int argc, char** argv) globalEmulatorData.theWatchDog->doStart(); - socket_server.startServer(); + globalEmulatorData.m_socket_server->startServer(); struct ndb_mgm_reply mgm_reply; for(unsigned int i=0;i<globalTransporterRegistry.m_transporter_interface.size();i++) @@ -215,18 +213,12 @@ int main(int argc, char** argv) &mgm_reply); - // theConfig->closeConfiguration(); globalEmulatorData.theThreadConfig->ipControlLoop(); NdbShutdown(NST_Normal); - socket_server.stopServer(); - socket_server.stopSessions(); - - globalTransporterRegistry.stop_clients(); - return NRT_Default; } diff --git a/ndb/src/kernel/vm/Emulator.cpp b/ndb/src/kernel/vm/Emulator.cpp index 068610b6778..d6ed6c0dafd 100644 --- a/ndb/src/kernel/vm/Emulator.cpp +++ b/ndb/src/kernel/vm/Emulator.cpp @@ -68,6 +68,7 @@ EmulatorData::EmulatorData(){ theThreadConfig = 0; theSimBlockList = 0; theShutdownMutex = 0; + m_socket_server = 0; } void @@ -83,6 +84,7 @@ EmulatorData::create(){ theWatchDog = new WatchDog(); theThreadConfig = new ThreadConfig(); theSimBlockList = new SimBlockList(); + m_socket_server = new SocketServer(); theShutdownMutex = NdbMutex_Create(); @@ -99,7 +101,8 @@ EmulatorData::destroy(){ delete theThreadConfig; theThreadConfig = 0; if(theSimBlockList) delete theSimBlockList; theSimBlockList = 0; - + if(m_socket_server) + delete m_socket_server; m_socket_server = 0; NdbMem_Destroy(); } @@ -195,9 +198,22 @@ NdbShutdown(NdbShutdownType type, fclose(outputStream); #endif + /** + * Stop all transporter connection attempts and accepts + */ + globalEmulatorData.m_socket_server->stopServer(); + globalEmulatorData.m_socket_server->stopSessions(); + globalTransporterRegistry.stop_clients(); + + /** + * Stop transporter communication with other nodes + */ globalTransporterRegistry.stopSending(); globalTransporterRegistry.stopReceiving(); + /** + * Remove all transporters + */ globalTransporterRegistry.removeAll(); #ifdef VM_TRACE diff --git a/ndb/src/kernel/vm/Emulator.hpp b/ndb/src/kernel/vm/Emulator.hpp index b3c64830802..dba8cb3ab9b 100644 --- a/ndb/src/kernel/vm/Emulator.hpp +++ b/ndb/src/kernel/vm/Emulator.hpp @@ -55,7 +55,8 @@ struct EmulatorData { class WatchDog * theWatchDog; class ThreadConfig * theThreadConfig; class SimBlockList * theSimBlockList; - + class SocketServer * m_socket_server; + /** * Constructor * 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 d2607616a55..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", (ulong) 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", (ulong) 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", (ulong) 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 05c7ce265a8..3b920bd218d 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -4393,7 +4393,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_strfunc.cc b/sql/item_strfunc.cc index 9f2da0f7fa1..536ee46f4db 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1874,6 +1874,7 @@ String *Item_func_char::val_str(String *str) { int32 num=(int32) args[i]->val_int(); if (!args[i]->null_value) + { #ifdef USE_MB if (use_mb(collation.collation)) { @@ -1889,6 +1890,7 @@ b1: str->append((char)(num>>8)); } #endif str->append((char)num); + } } str->set_charset(collation.collation); str->realloc(str->length()); // Add end 0 (for Purify) 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..a873d75def9 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -2457,8 +2457,8 @@ void sql_print_information(const char *format, ...) static const char tc_log_magic[]={254, 0x23, 0x05, 0x74}; uint opt_tc_log_size=TC_LOG_MIN_SIZE; -uint tc_log_max_pages_used=0, tc_log_page_size=0, - tc_log_page_waits=0, tc_log_cur_pages_used=0; +ulong tc_log_max_pages_used=0, tc_log_page_size=0, + tc_log_page_waits=0, tc_log_cur_pages_used=0; int TC_LOG_MMAP::open(const char *opt_name) { @@ -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 180d9427c66..9013a7f5c3d 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -316,12 +316,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; @@ -1166,7 +1168,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) { @@ -1921,6 +1931,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"); @@ -2738,7 +2759,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); @@ -5782,7 +5803,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..0418225965a 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. */ @@ -7027,8 +7030,12 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree) cur_group_key_parts, tree, cur_index_tree, cur_quick_prefix_records, have_min, have_max, &cur_read_cost, &cur_records); - - if (cur_read_cost < best_read_cost) + /* + If cur_read_cost is lower than best_read_cost use cur_index. + Do not compare doubles directly because they may have different + representations (64 vs. 80 bits). + */ + if (cur_read_cost < best_read_cost - (DBL_EPSILON * cur_read_cost)) { index_info= cur_index_info; index= cur_index; 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/protocol.cc b/sql/protocol.cc index 03d02d37d51..f31462ddad1 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -59,6 +59,7 @@ void net_send_error(THD *thd, uint sql_errno, const char *err) uint length; char buff[MYSQL_ERRMSG_SIZE+2], *pos; #endif + const char *orig_err= err; NET *net= &thd->net; DBUG_ENTER("net_send_error"); DBUG_PRINT("enter",("sql_errno: %d err: %s", sql_errno, @@ -91,6 +92,7 @@ void net_send_error(THD *thd, uint sql_errno, const char *err) err=ER(sql_errno); /* purecov: inspected */ } } + orig_err= err; } #ifdef EMBEDDED_LIBRARY @@ -129,6 +131,8 @@ void net_send_error(THD *thd, uint sql_errno, const char *err) } VOID(net_write_command(net,(uchar) 255, "", 0, (char*) err,length)); #endif /* EMBEDDED_LIBRARY*/ + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, sql_errno, + orig_err ? orig_err : ER(sql_errno)); thd->is_fatal_error=0; // Error message is given thd->net.report_error= 0; @@ -242,6 +246,8 @@ net_printf_error(THD *thd, uint errcode, ...) strmake(net->last_error, text_pos, length); strmake(net->sqlstate, mysql_errno_to_sqlstate(errcode), SQLSTATE_LENGTH); #endif + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, errcode, + text_pos ? text_pos : ER(errcode)); thd->is_fatal_error=0; // Error message is given DBUG_VOID_RETURN; } 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 bed8bd160c8..f3a61b43c34 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..2d89ded63c2 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -46,9 +46,9 @@ extern const char **errmesg; #define TC_LOG_PAGE_SIZE 8192 #define TC_LOG_MIN_SIZE (3*TC_LOG_PAGE_SIZE) extern uint opt_tc_log_size; -extern uint tc_log_max_pages_used; -extern uint tc_log_page_size; -extern uint tc_log_page_waits; +extern ulong tc_log_max_pages_used; +extern ulong tc_log_page_size; +extern ulong tc_log_page_waits; #define TC_HEURISTIC_RECOVER_COMMIT 1 #define TC_HEURISTIC_RECOVER_ROLLBACK 2 @@ -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 @@ -1612,10 +1613,12 @@ public: /* If >0 convert all blob fields to varchar(convert_blob_length) */ uint convert_blob_length; CHARSET_INFO *table_charset; + bool schema_table; TMP_TABLE_PARAM() :copy_field(0), group_parts(0), - group_length(0), group_null_parts(0), convert_blob_length(0) + group_length(0), group_null_parts(0), convert_blob_length(0), + schema_table(0) {} ~TMP_TABLE_PARAM() { 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 a03cdfb41ed..43fa1d6ced9 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 bool check_mqh(THD *thd, uint check_command) +static void time_out_user_resource_limits(THD *thd, USER_CONN *uc) { -#ifdef NO_EMBEDDED_ACCESS_CHECKS - return(0); -#else - bool error=0; + bool error= 0; time_t check_time = thd->start_time ? thd->start_time : time(NULL); - USER_CONN *uc=thd->user_connect; - DBUG_ENTER("check_mqh"); - DBUG_ASSERT(uc != 0); + DBUG_ENTER("time_out_user_resource_limits"); /* 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); } + + 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) +{ +#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); + + (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 */ } @@ -1733,6 +1759,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) { @@ -1743,6 +1771,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 @@ -2082,6 +2111,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 @@ -2100,18 +2147,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_select.cc b/sql/sql_select.cc index 992574a9ca1..7aa1c968d4b 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -7676,6 +7676,36 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table, return new_field; } + +/* + Create field for information schema table + + SYNOPSIS + create_tmp_field_for_schema() + thd Thread handler + table Temporary table + item Item to create a field for + + RETURN + 0 on error + new_created field +*/ + +Field *create_tmp_field_for_schema(THD *thd, Item *item, TABLE *table) +{ + if (item->field_type() == MYSQL_TYPE_VARCHAR) + { + if (item->max_length > MAX_FIELD_VARCHARLENGTH / + item->collation.collation->mbmaxlen) + return new Field_blob(item->max_length, item->maybe_null, + item->name, table, item->collation.collation); + return new Field_varstring(item->max_length, item->maybe_null, item->name, + table, item->collation.collation); + } + return item->tmp_table_field_from_field_type(table); +} + + /* Create field for temporary table @@ -7978,10 +8008,13 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, We here distinguish between UNION and multi-table-updates by the fact that in the later case group is set to the row pointer. */ - Field *new_field= create_tmp_field(thd, table, item, type, ©_func, - tmp_from_field, group != 0, - not_all_columns || group !=0, - param->convert_blob_length); + Field *new_field= (param->schema_table) ? + create_tmp_field_for_schema(thd, item, table) : + create_tmp_field(thd, table, item, type, ©_func, + tmp_from_field, group != 0, + not_all_columns || group !=0, + param->convert_blob_length); + if (!new_field) { if (thd->is_fatal_error) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index e46ad024f70..8bf6f36ccdc 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1778,6 +1778,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) LEX *lex= thd->lex; TABLE *table= tables->table; SELECT_LEX *select_lex= &lex->select_lex; + SELECT_LEX *old_all_select_lex= lex->all_selects_list; SELECT_LEX *lsel= tables->schema_select_lex; ST_SCHEMA_TABLE *schema_table= tables->schema_table; SELECT_LEX sel; @@ -1790,6 +1791,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) List<char> bases; List_iterator_fast<char> it(bases); COND *partial_cond; + uint derived_tables= lex->derived_tables; int error= 1; DBUG_ENTER("get_all_tables"); @@ -1814,7 +1816,6 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) goto err; } - lex->all_selects_list= &sel; schema_table_idx= get_schema_table_idx(schema_table); lock_type= TL_UNLOCK; @@ -1911,6 +1912,8 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) goto err; TABLE_LIST *show_table_list= (TABLE_LIST*) sel.table_list.first; show_table_list->lock_type= lock_type; + lex->all_selects_list= &sel; + lex->derived_tables= 0; res= open_and_lock_tables(thd, show_table_list); if (schema_table->process_table(thd, show_table_list, table, res, base_name, @@ -1930,7 +1933,8 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) error= 0; err: - lex->all_selects_list= select_lex; + lex->derived_tables= derived_tables; + lex->all_selects_list= old_all_select_lex; DBUG_RETURN(error); } @@ -3013,6 +3017,7 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list) tmp_table_param->init(); tmp_table_param->table_charset= cs; tmp_table_param->field_count= field_count; + tmp_table_param->schema_table= 1; SELECT_LEX *select_lex= thd->lex->current_select; if (!(table= create_tmp_table(thd, tmp_table_param, field_list, (ORDER*) 0, 0, 0, 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) |