diff options
author | Kristofer Pettersson <kristofer.pettersson@sun.com> | 2009-10-19 15:00:38 +0200 |
---|---|---|
committer | Kristofer Pettersson <kristofer.pettersson@sun.com> | 2009-10-19 15:00:38 +0200 |
commit | d1b03b432fff88d5a0a1c3cb5eabb9bdc434c8ae (patch) | |
tree | bdacd3d55076a3cdb1fd8dcc23dc264a2f7073fc | |
parent | 0659b857e7fe232ebfe7f48c5e0affd59dbf5862 (diff) | |
parent | b7c3a76cfe1b24283bea37d82d33444ed95aa6e5 (diff) | |
download | mariadb-git-d1b03b432fff88d5a0a1c3cb5eabb9bdc434c8ae.tar.gz |
Automerge
304 files changed, 4690 insertions, 3470 deletions
diff --git a/.bzr-mysql/default.conf b/.bzr-mysql/default.conf index 771201a109b..9a769e5712c 100644 --- a/.bzr-mysql/default.conf +++ b/.bzr-mysql/default.conf @@ -1,4 +1,4 @@ [MYSQL] post_commit_to = "commits@lists.mysql.com" post_push_to = "commits@lists.mysql.com" -tree_name = "mysql-5.4.5-next-mr" +tree_name = "mysql-5.5.0-next-mr-runtime" diff --git a/.bzrignore b/.bzrignore index 0dd59e5cee8..49cef565bfc 100644 --- a/.bzrignore +++ b/.bzrignore @@ -3065,3 +3065,4 @@ sql/share/swedish sql/share/ukrainian libmysqld/examples/mysqltest.cc libmysqld/sql_signal.cc +libmysqld/rpl_handler.cc diff --git a/Makefile.am b/Makefile.am index 0435489456b..b32ad443595 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -# Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. +# Copyright 2000-2008 MySQL AB, 2009 Sun Microsystems, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -24,7 +24,7 @@ EXTRA_DIST = INSTALL-SOURCE INSTALL-WIN-SOURCE \ SUBDIRS = . include @docs_dirs@ @zlib_dir@ \ @readline_topdir@ sql-common scripts \ @pstack_dir@ \ - @sql_union_dirs@ unittest storage plugin \ + @sql_union_dirs@ unittest \ @sql_server@ @man_dirs@ tests \ netware @libmysqld_dirs@ \ mysql-test support-files sql-bench \ @@ -98,7 +98,8 @@ test-pr: test-ns: cd mysql-test ; \ - @PERL@ ./mysql-test-run.pl $(force) $(mem) --mysqld=--binlog-format=mixed + @PERL@ ./mysql-test-run.pl $(force) $(mem) --mysqld=--binlog-format=mixed ; \ + @PERL@ ./mysql-test-run.pl $(force) $(mem) --suite=funcs_1 test-binlog-statement: cd mysql-test ; \ @@ -137,46 +138,48 @@ test-force-full: test-force-mem: $(MAKE) force=--force mem=--mem test +EXP = --experimental=collections/default.experimental + test-bt: -cd mysql-test ; MTR_BUILD_THREAD=auto \ @PERL@ ./mysql-test-run.pl --comment=normal --force --timer \ - --skip-ndbcluster --report-features + --skip-ndbcluster --report-features $(EXP) -cd mysql-test ; MTR_BUILD_THREAD=auto \ @PERL@ ./mysql-test-run.pl --comment=ps --force --timer \ - --skip-ndbcluster --ps-protocol + --skip-ndbcluster --ps-protocol $(EXP) -if [ -e bin/ndbd -o -e storage/ndb/src/kernel/ndbd ] ; then \ cd mysql-test ; \ MTR_BUILD_THREAD=auto \ @PERL@ ./mysql-test-run.pl --comment=ndb+rpl_ndb+ps --force --timer \ - --ps-protocol --mysqld=--binlog-format=row --suite=ndb,rpl_ndb ; \ + --ps-protocol --mysqld=--binlog-format=row --suite=ndb,rpl_ndb $(EXP) ; \ MTR_BUILD_THREAD=auto \ @PERL@ ./mysql-test-run.pl --comment=ndb --force --timer \ - --with-ndbcluster-only ; \ + --with-ndbcluster-only $(EXP) ; \ else \ echo "no program found for 'ndbcluster' tests - skipped testing" ; \ fi -cd mysql-test ; MTR_BUILD_THREAD=auto \ - @PERL@ ./mysql-test-run.pl --force --comment=funcs1+ps --ps-protocol --reorder --suite=funcs_1 + @PERL@ ./mysql-test-run.pl --force --comment=funcs1+ps --ps-protocol --reorder --suite=funcs_1 $(EXP) -cd mysql-test ; MTR_BUILD_THREAD=auto \ - @PERL@ ./mysql-test-run.pl --force --comment=funcs2 --suite=funcs_2 + @PERL@ ./mysql-test-run.pl --force --comment=funcs2 --suite=funcs_2 $(EXP) -cd mysql-test ; MTR_BUILD_THREAD=auto \ - @PERL@ ./mysql-test-run.pl --force --comment=partitions --suite=parts + @PERL@ ./mysql-test-run.pl --force --comment=partitions --suite=parts $(EXP) -cd mysql-test ; MTR_BUILD_THREAD=auto \ - @PERL@ ./mysql-test-run.pl --force --comment=stress --suite=stress + @PERL@ ./mysql-test-run.pl --force --comment=stress --suite=stress $(EXP) -cd mysql-test ; MTR_BUILD_THREAD=auto \ - @PERL@ ./mysql-test-run.pl --force --comment=jp --suite=jp + @PERL@ ./mysql-test-run.pl --force --comment=jp --suite=jp $(EXP) -if [ -d mysql-test/suite/nist ] ; then \ cd mysql-test ; MTR_BUILD_THREAD=auto \ - @PERL@ ./mysql-test-run.pl --comment=nist --force --suite=nist ; \ + @PERL@ ./mysql-test-run.pl --comment=nist --force --suite=nist $(EXP) ; \ fi -if [ -d mysql-test/suite/nist ] ; then \ cd mysql-test ; MTR_BUILD_THREAD=auto \ - @PERL@ ./mysql-test-run.pl --comment=nist+ps --force --suite=nist --ps-protocol ; \ + @PERL@ ./mysql-test-run.pl --comment=nist+ps --force --suite=nist --ps-protocol $(EXP) ; \ fi -if [ -e bin/mysqltest_embedded -o -e libmysqld/examples/mysqltest_embedded ] ; then \ cd mysql-test ; MTR_BUILD_THREAD=auto \ @PERL@ ./mysql-test-run.pl --comment=embedded --force --timer \ - --embedded-server --skip-rpl --skip-ndbcluster ; \ + --embedded-server --skip-rpl --skip-ndbcluster $(EXP) ; \ else \ echo "no program found for 'embedded' tests - skipped testing" ; \ fi @@ -184,22 +187,22 @@ test-bt: test-bt-fast: -cd mysql-test ; MTR_BUILD_THREAD=auto \ @PERL@ ./mysql-test-run.pl --comment=ps --force --timer \ - --skip-ndbcluster --ps-protocol --report-features + --skip-ndbcluster --ps-protocol --report-features $(EXP) -if [ -e bin/ndbd -o -e storage/ndb/src/kernel/ndbd ] ; then \ cd mysql-test ; \ MTR_BUILD_THREAD=auto \ @PERL@ ./mysql-test-run.pl --comment=ndb --force --timer \ - --with-ndbcluster-only ; \ + --with-ndbcluster-only $(EXP) ; \ else \ echo "no program found for 'ndbcluster' tests - skipped testing" ; \ fi -cd mysql-test ; MTR_BUILD_THREAD=auto \ - @PERL@ ./mysql-test-run.pl --force --comment=stress --suite=stress + @PERL@ ./mysql-test-run.pl --force --comment=stress --suite=stress $(EXP) test-bt-debug: -cd mysql-test ; MTR_BUILD_THREAD=auto \ @PERL@ ./mysql-test-run.pl --comment=debug --force --timer \ - --skip-ndbcluster --skip-rpl --report-features + --skip-ndbcluster --skip-rpl --report-features $(EXP) test-bt-debug-fast: diff --git a/client/mysqldump.c b/client/mysqldump.c index e9e3124b9cb..aa81a0e98bf 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -861,9 +861,9 @@ static int get_options(int *argc, char ***argv) load_defaults("my",load_default_groups,argc,argv); defaults_argv= *argv; - if (hash_init(&ignore_table, charset_info, 16, 0, 0, - (hash_get_key) get_table_key, - (hash_free_key) free_table_ent, 0)) + if (my_hash_init(&ignore_table, charset_info, 16, 0, 0, + (my_hash_get_key) get_table_key, + (my_hash_free_key) free_table_ent, 0)) return(EX_EOM); /* Don't copy internal log tables */ if (my_hash_insert(&ignore_table, @@ -1273,120 +1273,68 @@ static int switch_character_set_results(MYSQL *mysql, const char *cs_name) } /** - Rewrite CREATE TRIGGER statement, enclosing DEFINER clause in - version-specific comment. + Rewrite statement, enclosing DEFINER clause in version-specific comment. - This function parses the CREATE TRIGGER statement and encloses - DEFINER-clause in version-specific comment: - input query: CREATE DEFINER=a@b TRIGGER ... - rewritten query: CREATE * / / *!50017 DEFINER=a@b * / / *!50003 TRIGGER ... - - @note This function will go away when WL#3995 is implemented. - - @param[in] trigger_def_str CREATE TRIGGER statement string. - @param[in] trigger_def_length length of the trigger_def_str. - - @return pointer to the new allocated query string. -*/ - -static char *cover_definer_clause_in_trigger(const char *trigger_def_str, - uint trigger_def_length) -{ - char *query_str= NULL; - char *definer_begin= my_case_str(trigger_def_str, trigger_def_length, - C_STRING_WITH_LEN(" DEFINER")); - char *definer_end; - - if (!definer_begin) - return NULL; - - definer_end= my_case_str(definer_begin, strlen(definer_begin), - C_STRING_WITH_LEN(" TRIGGER")); - - if (definer_end) - { - char *query_str_tail; - - /* - Allocate memory for new query string: original string - from SHOW statement and version-specific comments. - */ - query_str= alloc_query_str(trigger_def_length + 23); - - query_str_tail= strnmov(query_str, - trigger_def_str, - definer_begin - trigger_def_str); - - query_str_tail= strmov(query_str_tail, - "*/ /*!50017"); - - query_str_tail= strnmov(query_str_tail, - definer_begin, - definer_end - definer_begin); - - query_str_tail= strxmov(query_str_tail, - "*/ /*!50003", - definer_end, - NullS); - } - - return query_str; -} - -/** - Rewrite CREATE FUNCTION or CREATE PROCEDURE statement, enclosing DEFINER - clause in version-specific comment. - - This function parses the CREATE FUNCTION | PROCEDURE statement and - encloses DEFINER-clause in version-specific comment: + This function parses any CREATE statement and encloses DEFINER-clause in + version-specific comment: input query: CREATE DEFINER=a@b FUNCTION ... rewritten query: CREATE * / / *!50020 DEFINER=a@b * / / *!50003 FUNCTION ... @note This function will go away when WL#3995 is implemented. - @param[in] def_str CREATE FUNCTION|PROCEDURE statement string. - @param[in] def_str_length length of the def_str. + @param[in] stmt_str CREATE statement string. + @param[in] stmt_length Length of the stmt_str. + @param[in] definer_version_str Minimal MySQL version number when + DEFINER clause is supported in the + given statement. + @param[in] definer_version_length Length of definer_version_str. + @param[in] stmt_version_str Minimal MySQL version number when the + given statement is supported. + @param[in] stmt_version_length Length of stmt_version_str. + @param[in] keyword_str Keyword to look for after CREATE. + @param[in] keyword_length Length of keyword_str. @return pointer to the new allocated query string. */ -static char *cover_definer_clause_in_sp(const char *def_str, - uint def_str_length) +static char *cover_definer_clause(const char *stmt_str, + uint stmt_length, + const char *definer_version_str, + uint definer_version_length, + const char *stmt_version_str, + uint stmt_version_length, + const char *keyword_str, + uint keyword_length) { - char *query_str= NULL; - char *definer_begin= my_case_str(def_str, def_str_length, + char *definer_begin= my_case_str(stmt_str, stmt_length, C_STRING_WITH_LEN(" DEFINER")); - char *definer_end; + char *definer_end= NULL; + + char *query_str= NULL; + char *query_ptr; if (!definer_begin) return NULL; definer_end= my_case_str(definer_begin, strlen(definer_begin), - C_STRING_WITH_LEN(" PROCEDURE")); + keyword_str, keyword_length); if (!definer_end) - { - definer_end= my_case_str(definer_begin, strlen(definer_begin), - C_STRING_WITH_LEN(" FUNCTION")); - } + return NULL; - if (definer_end) - { - char *query_str_tail; + /* + Allocate memory for new query string: original string + from SHOW statement and version-specific comments. + */ + query_str= alloc_query_str(stmt_length + 23); - /* - Allocate memory for new query string: original string - from SHOW statement and version-specific comments. - */ - query_str= alloc_query_str(def_str_length + 23); - - query_str_tail= strnmov(query_str, def_str, definer_begin - def_str); - query_str_tail= strmov(query_str_tail, "*/ /*!50020"); - query_str_tail= strnmov(query_str_tail, definer_begin, - definer_end - definer_begin); - query_str_tail= strxmov(query_str_tail, "*/ /*!50003", - definer_end, NullS); - } + query_ptr= strnmov(query_str, stmt_str, definer_begin - stmt_str); + query_ptr= strnmov(query_ptr, C_STRING_WITH_LEN("*/ /*!")); + query_ptr= strnmov(query_ptr, definer_version_str, definer_version_length); + query_ptr= strnmov(query_ptr, definer_begin, definer_end - definer_begin); + query_ptr= strnmov(query_ptr, C_STRING_WITH_LEN("*/ /*!")); + query_ptr= strnmov(query_ptr, stmt_version_str, stmt_version_length); + query_ptr= strxmov(query_ptr, definer_end, NullS); return query_str; } @@ -1419,8 +1367,8 @@ static void free_resources() if (md_result_file && md_result_file != stdout) my_fclose(md_result_file, MYF(0)); my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR)); - if (hash_inited(&ignore_table)) - hash_free(&ignore_table); + if (my_hash_inited(&ignore_table)) + my_hash_free(&ignore_table); if (extended_insert) dynstr_free(&extended_row); if (insert_pat_inited) @@ -1922,6 +1870,8 @@ static uint dump_events_for_db(char *db) */ if (strlen(row[3]) != 0) { + char *query_str; + if (opt_drop) fprintf(sql_file, "/*!50106 DROP EVENT IF EXISTS %s */%s\n", event_name, delimiter); @@ -1948,31 +1898,36 @@ static uint dump_events_for_db(char *db) row[4], /* character_set_results */ row[5]); /* collation_connection */ } - else - { - /* - mysqldump is being run against the server, that does not - provide character set information in SHOW CREATE - statements. + else + { + /* + mysqldump is being run against the server, that does not + provide character set information in SHOW CREATE + statements. - NOTE: the dump may be incorrect, since character set - information is required in order to restore event properly. - */ + NOTE: the dump may be incorrect, since character set + information is required in order to restore event properly. + */ - fprintf(sql_file, - "--\n" - "-- WARNING: old server version. " - "The following dump may be incomplete.\n" - "--\n"); - } + fprintf(sql_file, + "--\n" + "-- WARNING: old server version. " + "The following dump may be incomplete.\n" + "--\n"); + } switch_sql_mode(sql_file, delimiter, row[1]); switch_time_zone(sql_file, delimiter, row[2]); + query_str= cover_definer_clause(row[3], strlen(row[3]), + C_STRING_WITH_LEN("50117"), + C_STRING_WITH_LEN("50106"), + C_STRING_WITH_LEN(" EVENT")); + fprintf(sql_file, "/*!50106 %s */ %s\n", - (const char *) row[3], + (const char *) (query_str != NULL ? query_str : row[3]), (const char *) delimiter); restore_time_zone(sql_file, delimiter); @@ -2127,7 +2082,16 @@ static uint dump_routines_for_db(char *db) fprintf(sql_file, "/*!50003 DROP %s IF EXISTS %s */;\n", routine_type[i], routine_name); - query_str= cover_definer_clause_in_sp(row[2], strlen(row[2])); + query_str= cover_definer_clause(row[2], strlen(row[2]), + C_STRING_WITH_LEN("50020"), + C_STRING_WITH_LEN("50003"), + C_STRING_WITH_LEN(" FUNCTION")); + + if (!query_str) + query_str= cover_definer_clause(row[2], strlen(row[2]), + C_STRING_WITH_LEN("50020"), + C_STRING_WITH_LEN("50003"), + C_STRING_WITH_LEN(" PROCEDURE")); if (mysql_num_fields(routine_res) >= 6) { @@ -2806,8 +2770,10 @@ static int dump_trigger(FILE *sql_file, MYSQL_RES *show_create_trigger_rs, while ((row= mysql_fetch_row(show_create_trigger_rs))) { - char *query_str= cover_definer_clause_in_trigger(row[2], strlen(row[2])); - + char *query_str= cover_definer_clause(row[2], strlen(row[2]), + C_STRING_WITH_LEN("50017"), + C_STRING_WITH_LEN("50003"), + C_STRING_WITH_LEN(" TRIGGER")); if (switch_db_collation(sql_file, db_name, ";", db_cl_name, row[5], &db_cl_altered)) @@ -3316,7 +3282,7 @@ static void dump_table(char *table, char *db) { if (length) { - if (!IS_NUM_FIELD(field)) + if (!(field->flags & NUM_FLAG)) { /* "length * 2 + 2" is OK for both HEX and non-HEX modes: @@ -3384,7 +3350,7 @@ static void dump_table(char *table, char *db) } if (row[i]) { - if (!IS_NUM_FIELD(field)) + if (!(field->flags & NUM_FLAG)) { if (opt_xml) { @@ -3992,7 +3958,7 @@ static int init_dumping(char *database, int init_func(char*)) my_bool include_table(const uchar *hash_key, size_t len) { - return !hash_search(&ignore_table, hash_key, len); + return ! my_hash_search(&ignore_table, hash_key, len); } diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 92e9702aea0..ef38d760e5d 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright (C) 2000-2006 MySQL AB, 2009 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -583,7 +583,7 @@ error: counter--; pthread_cond_signal(&count_threshhold); pthread_mutex_unlock(&counter_mutex); - my_thread_end(); + mysql_thread_end(); return 0; } diff --git a/client/mysqlslap.c b/client/mysqlslap.c index 6a016b72383..0bbc15eb24e 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2005 MySQL AB +/* Copyright (C) 2005 MySQL AB, 2009 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1918,7 +1918,7 @@ end: if (!opt_only_print) mysql_close(mysql); - my_thread_end(); + mysql_thread_end(); pthread_mutex_lock(&counter_mutex); thread_counter--; diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 3812a1bb8d1..ed2613eaef0 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -112,6 +112,8 @@ static uint my_end_arg= 0; /* Number of lines of the result to include in failure report */ static uint opt_tail_lines= 0; +static uint opt_connect_timeout= 0; + static char delimiter[MAX_DELIMITER_LENGTH]= ";"; static uint delimiter_length= 1; @@ -257,8 +259,7 @@ enum enum_commands { Q_SEND, Q_REAP, Q_DIRTY_CLOSE, Q_REPLACE, Q_REPLACE_COLUMN, Q_PING, Q_EVAL, - Q_RPL_PROBE, Q_ENABLE_RPL_PARSE, - Q_DISABLE_RPL_PARSE, Q_EVAL_RESULT, + Q_EVAL_RESULT, Q_ENABLE_QUERY_LOG, Q_DISABLE_QUERY_LOG, Q_ENABLE_RESULT_LOG, Q_DISABLE_RESULT_LOG, Q_WAIT_FOR_SLAVE_TO_STOP, @@ -317,9 +318,6 @@ const char *command_names[]= "replace_column", "ping", "eval", - "rpl_probe", - "enable_rpl_parse", - "disable_rpl_parse", "eval_result", /* Enable/disable that the _query_ is logged to result file */ "enable_query_log", @@ -659,14 +657,6 @@ public: LogFile log_file; LogFile progress_file; - -/* Disable functions that only exist in MySQL 4.0 */ -#if MYSQL_VERSION_ID < 40000 -void mysql_enable_rpl_parse(MYSQL* mysql __attribute__((unused))) {} -void mysql_disable_rpl_parse(MYSQL* mysql __attribute__((unused))) {} -int mysql_rpl_parse_enabled(MYSQL* mysql __attribute__((unused))) { return 1; } -my_bool mysql_rpl_probe(MYSQL *mysql __attribute__((unused))) { return 1; } -#endif void replace_dynstr_append_mem(DYNAMIC_STRING *ds, const char *val, int len); void replace_dynstr_append(DYNAMIC_STRING *ds, const char *val); @@ -1135,7 +1125,7 @@ void free_used_memory() close_connections(); close_files(); - hash_free(&var_hash); + my_hash_free(&var_hash); for (i= 0 ; i < q_lines.elements ; i++) { @@ -1535,7 +1525,7 @@ void show_diff(DYNAMIC_STRING* ds, else diff_name = 0; #else - diff_name = "diff"; // Otherwise always assume it's called diff + diff_name = "diff"; /* Otherwise always assume it's called diff */ #endif if (diff_name) @@ -1998,8 +1988,8 @@ VAR* var_get(const char *var_name, const char **var_name_end, my_bool raw, if (length >= MAX_VAR_NAME_LENGTH) die("Too long variable name: %s", save_var_name); - if (!(v = (VAR*) hash_search(&var_hash, (const uchar*) save_var_name, - length))) + if (!(v = (VAR*) my_hash_search(&var_hash, (const uchar*) save_var_name, + length))) { char buff[MAX_VAR_NAME_LENGTH+1]; strmake(buff, save_var_name, length); @@ -2030,7 +2020,7 @@ err: VAR *var_obtain(const char *name, int len) { VAR* v; - if ((v = (VAR*)hash_search(&var_hash, (const uchar *) name, len))) + if ((v = (VAR*)my_hash_search(&var_hash, (const uchar *) name, len))) return v; v = var_init(0, name, len, "", 0); my_hash_insert(&var_hash, (uchar*)v); @@ -2964,6 +2954,7 @@ void do_move_file(struct st_command *command) void do_chmod_file(struct st_command *command) { long mode= 0; + int err_code; static DYNAMIC_STRING ds_mode; static DYNAMIC_STRING ds_file; const struct command_arg chmod_file_args[] = { @@ -2983,7 +2974,10 @@ void do_chmod_file(struct st_command *command) die("You must write a 4 digit octal number for mode"); DBUG_PRINT("info", ("chmod %o %s", (uint)mode, ds_file.str)); - handle_command_error(command, chmod(ds_file.str, mode)); + err_code= chmod(ds_file.str, mode); + if (err_code < 0) + err_code= 1; + handle_command_error(command, err_code); dynstr_free(&ds_mode); dynstr_free(&ds_file); DBUG_VOID_RETURN; @@ -3844,12 +3838,8 @@ int do_save_master_pos() MYSQL_ROW row; MYSQL *mysql = &cur_con->mysql; const char *query; - int rpl_parse; DBUG_ENTER("do_save_master_pos"); - rpl_parse = mysql_rpl_parse_enabled(mysql); - mysql_disable_rpl_parse(mysql); - #ifdef HAVE_NDB_BINLOG /* Wait for ndb binlog to be up-to-date with all changes @@ -3999,10 +3989,6 @@ int do_save_master_pos() strnmov(master_pos.file, row[0], sizeof(master_pos.file)-1); master_pos.pos = strtoul(row[1], (char**) 0, 10); mysql_free_result(res); - - if (rpl_parse) - mysql_enable_rpl_parse(mysql); - DBUG_RETURN(0); } @@ -4065,29 +4051,6 @@ void do_let(struct st_command *command) } -int do_rpl_probe(struct st_command *command __attribute__((unused))) -{ - DBUG_ENTER("do_rpl_probe"); - if (mysql_rpl_probe(&cur_con->mysql)) - die("Failed in mysql_rpl_probe(): '%s'", mysql_error(&cur_con->mysql)); - DBUG_RETURN(0); -} - - -int do_enable_rpl_parse(struct st_command *command __attribute__((unused))) -{ - mysql_enable_rpl_parse(&cur_con->mysql); - return 0; -} - - -int do_disable_rpl_parse(struct st_command *command __attribute__((unused))) -{ - mysql_disable_rpl_parse(&cur_con->mysql); - return 0; -} - - /* Sleep the number of specified seconds @@ -5003,6 +4966,11 @@ void do_connect(struct st_command *command) #endif if (!mysql_init(&con_slot->mysql)) die("Failed on mysql_init()"); + + if (opt_connect_timeout) + mysql_options(&con_slot->mysql, MYSQL_OPT_CONNECT_TIMEOUT, + (void *) &opt_connect_timeout); + if (opt_compress || con_compress) mysql_options(&con_slot->mysql, MYSQL_OPT_COMPRESS, NullS); mysql_options(&con_slot->mysql, MYSQL_OPT_LOCAL_INFILE, 0); @@ -5758,6 +5726,11 @@ static struct my_option my_long_options[] = {"view-protocol", OPT_VIEW_PROTOCOL, "Use views for select", (uchar**) &view_protocol, (uchar**) &view_protocol, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"connect_timeout", OPT_CONNECT_TIMEOUT, + "Number of seconds before connection timeout.", + (uchar**) &opt_connect_timeout, + (uchar**) &opt_connect_timeout, 0, GET_UINT, REQUIRED_ARG, + 120, 0, 3600 * 12, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; @@ -6496,8 +6469,6 @@ void run_query_normal(struct st_connection *cn, struct st_command *command, if (!disable_result_log) { - ulonglong UNINIT_VAR(affected_rows); /* Ok to be undef if 'disable_info' is set */ - if (res) { MYSQL_FIELD *fields= mysql_fetch_fields(res); @@ -6514,10 +6485,10 @@ void run_query_normal(struct st_connection *cn, struct st_command *command, /* Need to call mysql_affected_rows() before the "new" - query to find the warnings + query to find the warnings. */ if (!disable_info) - affected_rows= mysql_affected_rows(mysql); + append_info(ds, mysql_affected_rows(mysql), mysql_info(mysql)); /* Add all warnings to the result. We can't do this if we are in @@ -6532,9 +6503,6 @@ void run_query_normal(struct st_connection *cn, struct st_command *command, dynstr_append_mem(ds, ds_warnings->str, ds_warnings->length); } } - - if (!disable_info) - append_info(ds, affected_rows, mysql_info(mysql)); } if (res) @@ -6907,6 +6875,13 @@ void run_query_stmt(MYSQL *mysql, struct st_command *command, */ } + /* + Fetch info before fetching warnings, since it will be reset + otherwise. + */ + if (!disable_info) + append_info(ds, mysql_stmt_affected_rows(stmt), mysql_info(mysql)); + if (!disable_warnings) { /* Get the warnings from execute */ @@ -6930,9 +6905,6 @@ void run_query_stmt(MYSQL *mysql, struct st_command *command, } } - if (!disable_info) - append_info(ds, mysql_affected_rows(mysql), mysql_info(mysql)); - } end: @@ -6981,6 +6953,10 @@ int util_query(MYSQL* org_mysql, const char* query){ if (!(mysql= mysql_init(mysql))) die("Failed in mysql_init()"); + if (opt_connect_timeout) + mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, + (void *) &opt_connect_timeout); + /* enable local infile, in non-binary builds often disabled by default */ mysql_options(mysql, MYSQL_OPT_LOCAL_INFILE, 0); safe_connect(mysql, "util", org_mysql->host, org_mysql->user, @@ -7576,8 +7552,8 @@ int main(int argc, char **argv) my_init_dynamic_array(&q_lines, sizeof(struct st_command*), 1024, 1024); - if (hash_init(&var_hash, charset_info, - 1024, 0, 0, get_var_key, var_free, MYF(0))) + if (my_hash_init(&var_hash, charset_info, + 1024, 0, 0, get_var_key, var_free, MYF(0))) die("Variable hash initialization failed"); var_set_string("$MYSQL_SERVER_VERSION", MYSQL_SERVER_VERSION); @@ -7640,6 +7616,9 @@ int main(int argc, char **argv) st_connection *con= connections; if (!( mysql_init(&con->mysql))) die("Failed in mysql_init()"); + if (opt_connect_timeout) + mysql_options(&con->mysql, MYSQL_OPT_CONNECT_TIMEOUT, + (void *) &opt_connect_timeout); if (opt_compress) mysql_options(&con->mysql,MYSQL_OPT_COMPRESS,NullS); mysql_options(&con->mysql, MYSQL_OPT_LOCAL_INFILE, 0); @@ -7738,9 +7717,6 @@ int main(int argc, char **argv) case Q_DISCONNECT: case Q_DIRTY_CLOSE: do_close_connection(command); break; - case Q_RPL_PROBE: do_rpl_probe(command); break; - case Q_ENABLE_RPL_PARSE: do_enable_rpl_parse(command); break; - case Q_DISABLE_RPL_PARSE: do_disable_rpl_parse(command); break; case Q_ENABLE_QUERY_LOG: disable_query_log=0; break; case Q_DISABLE_QUERY_LOG: disable_query_log=1; break; case Q_ENABLE_ABORT_ON_ERROR: abort_on_error=1; break; diff --git a/configure.in b/configure.in index 60a583fa25b..d4b7a217ec5 100644 --- a/configure.in +++ b/configure.in @@ -10,7 +10,7 @@ AC_CANONICAL_SYSTEM # # When changing major version number please also check switch statement # in client/mysqlbinlog.cc:check_master_version(). -AM_INIT_AUTOMAKE(mysql, 5.4.5-beta) +AM_INIT_AUTOMAKE(mysql, 5.5.0-beta) AM_CONFIG_HEADER([include/config.h:config.h.in]) PROTOCOL_VERSION=10 @@ -617,24 +617,6 @@ then fi fi -AC_MSG_CHECKING(whether features provided by the user community should be included.) -AC_ARG_ENABLE(community-features, - AC_HELP_STRING( - [--disable-community-features], - [Disable additional features provided by the user community.]), - [ ENABLE_COMMUNITY_FEATURES=$enableval ], - [ ENABLE_COMMUNITY_FEATURES=yes ] - ) - -if test "$ENABLE_COMMUNITY_FEATURES" = "yes" -then - AC_DEFINE([COMMUNITY_SERVER], [1], - [Whether features provided by the user community should be included]) - AC_MSG_RESULT([yes]) -else - AC_MSG_RESULT([no]) -fi - AC_ARG_WITH(server-suffix, [ --with-server-suffix Append value to the version string.], [ MYSQL_SERVER_SUFFIX=`echo "$withval" | sed -e 's/^\(...................................\)..*$/\1/'` ], @@ -700,21 +682,14 @@ fi # Add query profiler AC_MSG_CHECKING(if SHOW PROFILE should be enabled.) AC_ARG_ENABLE(profiling, - AS_HELP_STRING([--enable-profiling], [Build a version with query profiling code (req. community-features)]), + AS_HELP_STRING([--enable-profiling], [Enable profiling of query lifetime.]), [ ENABLED_PROFILING=$enableval ], - [ ENABLED_PROFILING=$ENABLE_COMMUNITY_FEATURES ]) + [ ENABLED_PROFILING=no ]) +AC_DEFINE([ENABLED_PROFILING], [1], [If SHOW PROFILE should be enabled]) if test "$ENABLED_PROFILING" = "yes" then - if test "$ENABLE_COMMUNITY_FEATURES" = "yes"; - then - AC_DEFINE([ENABLED_PROFILING], [1], - [If SHOW PROFILE should be enabled]) - AC_MSG_RESULT([yes]) - else - ENABLED_PROFILING="no" - AC_MSG_RESULT([no, overridden by community-features disabled]) - fi + AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi @@ -1665,13 +1640,14 @@ then DEBUG_OPTIMIZE_CXX="-O" OPTIMIZE_CXXFLAGS="$MAX_CXX_OPTIMIZE" else - DEBUG_CXXFLAGS="-g" DEBUG_OPTIMIZE_CXX="" case $SYSTEM_TYPE in *solaris*) + DEBUG_CXXFLAGS="-g0" OPTIMIZE_CXXFLAGS="-O1" ;; *) + DEBUG_CXXFLAGS="-g" OPTIMIZE_CXXFLAGS="-O" ;; esac @@ -2817,7 +2793,7 @@ server_scripts= dnl This probably should be cleaned up more - for now the threaded dnl client is just using plain-old libs. -sql_client_dirs="strings regex mysys libmysql" +sql_client_dirs="strings regex mysys dbug libmysql" AM_CONDITIONAL(THREAD_SAFE_CLIENT, test "$THREAD_SAFE_CLIENT" != "no") @@ -2845,15 +2821,20 @@ fi AC_SUBST(netware_dir) AM_CONDITIONAL(HAVE_NETWARE, test "$netware_dir" = "netware") -if test "$with_server" = "yes" -o "$THREAD_SAFE_CLIENT" != "no" +if test "$with_server" != "no" -o "$THREAD_SAFE_CLIENT" != "no" then AC_DEFINE([THREAD], [1], [Define if you want to have threaded code. This may be undef on client code]) # Avoid _PROGRAMS names THREAD_LOBJECTS="thr_alarm.o thr_lock.o thr_mutex.o thr_rwlock.o my_pthread.o my_thr_init.o mf_keycache.o" AC_SUBST(THREAD_LOBJECTS) +fi +AM_CONDITIONAL(NEED_THREAD, test "$with_server" != "no" -o "$THREAD_SAFE_CLIENT" != "no") + +if test "$with_server" != "no" +then server_scripts="mysqld_safe mysql_install_db" - sql_server_dirs="strings mysys dbug extra regex" + sql_server_dirs="strings mysys dbug extra regex storage plugin" sql_server="vio sql" fi diff --git a/include/config-win.h b/include/config-win.h index 725b4fdf07b..acfd86edade 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -353,7 +353,6 @@ inline ulonglong double2ulonglong(double d) #define HAVE_OPENSSL 1 #define HAVE_YASSL 1 -#define COMMUNITY_SERVER 1 #define ENABLED_PROFILING 1 /* diff --git a/include/errmsg.h b/include/errmsg.h index a6d8c770de8..92d70abb9f5 100644 --- a/include/errmsg.h +++ b/include/errmsg.h @@ -97,6 +97,7 @@ extern const char *client_errors[]; /* Error messages */ #define CR_SERVER_LOST_EXTENDED 2055 #define CR_STMT_CLOSED 2056 #define CR_NEW_STMT_METADATA 2057 -#define CR_ERROR_LAST /*Copy last error nr:*/ 2057 +#define CR_ALREADY_CONNECTED 2058 +#define CR_ERROR_LAST /*Copy last error nr:*/ 2058 /* Add error numbers before CR_ERROR_LAST and change it accordingly. */ diff --git a/include/hash.h b/include/hash.h index 629b404e8a7..d870e17c341 100644 --- a/include/hash.h +++ b/include/hash.h @@ -22,40 +22,6 @@ extern "C" { #endif /* - There was a problem on MacOSX with a shared object ha_example.so. - It used hash_search(). During build of ha_example.so no libmysys - was specified. Since MacOSX had a hash_search() in the system - library, it built the shared object so that the dynamic linker - linked hash_search() to the system library, which caused a crash - when called. To come around this, we renamed hash_search() to - my_hash_search(), as we did long ago with hash_insert() and - hash_reset(). However, this time we made the move complete with - all names. To keep compatibility, we redefine the old names. - Since every C and C++ file, that uses HASH, needs to include - this file, the change is complete. Both names could be used - in the code, but the my_* versions are recommended now. -*/ -#define hash_get_key my_hash_get_key -#define hash_free_key my_hash_free_key -#define hash_init my_hash_init -#define hash_init2 my_hash_init2 -#define _hash_init _my_hash_init -#define hash_free my_hash_free -#define hash_reset my_hash_reset -#define hash_element my_hash_element -#define hash_search my_hash_search -#define hash_first my_hash_first -#define hash_next my_hash_next -#define hash_insert my_hash_insert -#define hash_delete my_hash_delete -#define hash_update my_hash_update -#define hash_replace my_hash_replace -#define hash_check my_hash_check -#define hash_clear my_hash_clear -#define hash_inited my_hash_inited -#define hash_init_opt my_hash_init_opt - -/* Overhead to store an element in hash Can be used to approximate memory consumption for a hash */ diff --git a/include/my_base.h b/include/my_base.h index a01b2ec9b82..70bd9b5e073 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -255,7 +255,17 @@ enum ha_base_keytype { HA_BINARY_PACK_KEY | HA_FULLTEXT | HA_UNIQUE_CHECK | \ HA_SPATIAL | HA_NULL_ARE_EQUAL | HA_GENERATED_KEY) -#define HA_KEY_HAS_PART_KEY_SEG 65536 /* Key contains partial segments */ +/* + Key contains partial segments. + + This flag is internal to the MySQL server by design. It is not supposed + neither to be saved in FRM-files, nor to be passed to storage engines. + It is intended to pass information into internal static sort_keys(KEY *, + KEY *) function. + + This flag can be calculated -- it's based on key lengths comparison. +*/ +#define HA_KEY_HAS_PART_KEY_SEG 65536 /* Automatic bits in key-flag */ diff --git a/include/mysql.h b/include/mysql.h index d114afb6c93..ca682e6f30b 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -86,9 +86,11 @@ extern char *mysql_unix_port; #define IS_PRI_KEY(n) ((n) & PRI_KEY_FLAG) #define IS_NOT_NULL(n) ((n) & NOT_NULL_FLAG) #define IS_BLOB(n) ((n) & BLOB_FLAG) -#define IS_NUM(t) ((t) <= MYSQL_TYPE_INT24 || (t) == MYSQL_TYPE_YEAR || (t) == MYSQL_TYPE_NEWDECIMAL) -#define IS_NUM_FIELD(f) ((f)->flags & NUM_FLAG) -#define INTERNAL_NUM_FIELD(f) (((f)->type <= MYSQL_TYPE_INT24 && ((f)->type != MYSQL_TYPE_TIMESTAMP || (f)->length == 14 || (f)->length == 8)) || (f)->type == MYSQL_TYPE_YEAR) +/** + Returns true if the value is a number which does not need quotes for + the sql_lex.cc parser to parse correctly. +*/ +#define IS_NUM(t) (((t) <= MYSQL_TYPE_INT24 && (t) != MYSQL_TYPE_TIMESTAMP) || (t) == MYSQL_TYPE_YEAR || (t) == MYSQL_TYPE_NEWDECIMAL) #define IS_LONGDATA(t) ((t) >= MYSQL_TYPE_TINY_BLOB && (t) <= MYSQL_TYPE_STRING) @@ -186,24 +188,10 @@ struct st_mysql_options { unsigned long max_allowed_packet; my_bool use_ssl; /* if to use SSL or not */ my_bool compress,named_pipe; - /* - On connect, find out the replication role of the server, and - establish connections to all the peers - */ - my_bool rpl_probe; - /* - Each call to mysql_real_query() will parse it to tell if it is a read - or a write, and direct it to the slave or the master - */ - my_bool rpl_parse; - /* - If set, never read from a master, only from slave, when doing - a read that is replication-aware - */ - my_bool no_master_reads; -#if !defined(CHECK_EMBEDDED_DIFFERENCES) || defined(EMBEDDED_LIBRARY) - my_bool separate_thread; -#endif + my_bool unused1; + my_bool unused2; + my_bool unused3; + my_bool unused4; enum mysql_option methods_to_use; char *client_ip; /* Refuse client connecting to server if it uses old (pre-4.1.1) protocol */ @@ -230,15 +218,6 @@ enum mysql_protocol_type MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET, MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY }; -/* - There are three types of queries - the ones that have to go to - the master, the ones that go to a slave, and the adminstrative - type which must happen on the pivot connectioin -*/ -enum mysql_rpl_type -{ - MYSQL_RPL_MASTER, MYSQL_RPL_SLAVE, MYSQL_RPL_ADMIN -}; typedef struct character_set { @@ -283,21 +262,8 @@ typedef struct st_mysql /* session-wide random string */ char scramble[SCRAMBLE_LENGTH+1]; - - /* - Set if this is the original connection, not a master or a slave we have - added though mysql_rpl_probe() or mysql_set_master()/ mysql_add_slave() - */ - my_bool rpl_pivot; - /* - Pointers to the master, and the next slave connections, points to - itself if lone connection. - */ - struct st_mysql* master, *next_slave; - - struct st_mysql* last_used_slave; /* needed for round-robin slave pick */ - /* needed for send/read/store/use result to work correctly with replication */ - struct st_mysql* last_used_con; + my_bool unused1; + void *unused2, *unused3, *unused4, *unused5; LIST *stmts; /* list of all statements */ const struct st_mysql_methods *methods; @@ -331,35 +297,12 @@ typedef struct st_mysql_res { void *extension; } MYSQL_RES; -#define MAX_MYSQL_MANAGER_ERR 256 -#define MAX_MYSQL_MANAGER_MSG 256 - -#define MANAGER_OK 200 -#define MANAGER_INFO 250 -#define MANAGER_ACCESS 401 -#define MANAGER_CLIENT_ERR 450 -#define MANAGER_INTERNAL_ERR 500 #if !defined(MYSQL_SERVER) && !defined(MYSQL_CLIENT) #define MYSQL_CLIENT #endif -typedef struct st_mysql_manager -{ - NET net; - char *host, *user, *passwd; - char *net_buf, *net_buf_pos, *net_data_end; - unsigned int port; - int cmd_status; - int last_errno; - int net_buf_size; - my_bool free_me; - my_bool eof; - char last_error[MAX_MYSQL_MANAGER_ERR]; - void *extension; -} MYSQL_MANAGER; - typedef struct st_mysql_parameters { unsigned long *p_max_allowed_packet; @@ -452,16 +395,6 @@ int STDCALL mysql_real_query(MYSQL *mysql, const char *q, MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql); MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql); -/* perform query on master */ -my_bool STDCALL mysql_master_query(MYSQL *mysql, const char *q, - unsigned long length); -my_bool STDCALL mysql_master_send_query(MYSQL *mysql, const char *q, - unsigned long length); -/* perform query on slave */ -my_bool STDCALL mysql_slave_query(MYSQL *mysql, const char *q, - unsigned long length); -my_bool STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q, - unsigned long length); void STDCALL mysql_get_character_set_info(MYSQL *mysql, MY_CHARSET_INFO *charset); @@ -483,37 +416,6 @@ mysql_set_local_infile_handler(MYSQL *mysql, void mysql_set_local_infile_default(MYSQL *mysql); - -/* - enable/disable parsing of all queries to decide if they go on master or - slave -*/ -void STDCALL mysql_enable_rpl_parse(MYSQL* mysql); -void STDCALL mysql_disable_rpl_parse(MYSQL* mysql); -/* get the value of the parse flag */ -int STDCALL mysql_rpl_parse_enabled(MYSQL* mysql); - -/* enable/disable reads from master */ -void STDCALL mysql_enable_reads_from_master(MYSQL* mysql); -void STDCALL mysql_disable_reads_from_master(MYSQL* mysql); -/* get the value of the master read flag */ -my_bool STDCALL mysql_reads_from_master_enabled(MYSQL* mysql); - -enum mysql_rpl_type STDCALL mysql_rpl_query_type(const char* q, int len); - -/* discover the master and its slaves */ -my_bool STDCALL mysql_rpl_probe(MYSQL* mysql); - -/* set the master, close/free the old one, if it is not a pivot */ -int STDCALL mysql_set_master(MYSQL* mysql, const char* host, - unsigned int port, - const char* user, - const char* passwd); -int STDCALL mysql_add_slave(MYSQL* mysql, const char* host, - unsigned int port, - const char* user, - const char* passwd); - int STDCALL mysql_shutdown(MYSQL *mysql, enum mysql_enum_shutdown_level shutdown_level); @@ -560,18 +462,6 @@ void STDCALL mysql_debug(const char *debug); void STDCALL myodbc_remove_escape(MYSQL *mysql,char *name); unsigned int STDCALL mysql_thread_safe(void); my_bool STDCALL mysql_embedded(void); -MYSQL_MANAGER* STDCALL mysql_manager_init(MYSQL_MANAGER* con); -MYSQL_MANAGER* STDCALL mysql_manager_connect(MYSQL_MANAGER* con, - const char* host, - const char* user, - const char* passwd, - unsigned int port); -void STDCALL mysql_manager_close(MYSQL_MANAGER* con); -int STDCALL mysql_manager_command(MYSQL_MANAGER* con, - const char* cmd, int cmd_len); -int STDCALL mysql_manager_fetch_line(MYSQL_MANAGER* con, - char* res_buf, - int res_buf_size); my_bool STDCALL mysql_read_query_result(MYSQL *mysql); @@ -840,7 +730,6 @@ MYSQL * STDCALL mysql_connect(MYSQL *mysql, const char *host, const char *user, const char *passwd); int STDCALL mysql_create_db(MYSQL *mysql, const char *DB); int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB); -#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT) #endif #define HAVE_MYSQL_REAL_CONNECT diff --git a/include/mysql.h.pp b/include/mysql.h.pp index 633cde41130..0b809a6ab23 100644 --- a/include/mysql.h.pp +++ b/include/mysql.h.pp @@ -28,15 +28,15 @@ typedef struct st_net { unsigned int *return_status; unsigned char reading_or_writing; char save_char; - my_bool unused0; - my_bool unused; - my_bool compress; my_bool unused1; - unsigned char *query_cache_query; + my_bool unused2; + my_bool compress; + my_bool unused3; + unsigned char *unused; unsigned int last_errno; unsigned char error; - my_bool unused2; - my_bool return_errno; + my_bool unused4; + my_bool unused5; char last_error[512]; char sqlstate[5 +1]; void *extension; @@ -277,10 +277,10 @@ struct st_mysql_options { unsigned long max_allowed_packet; my_bool use_ssl; my_bool compress,named_pipe; - my_bool rpl_probe; - my_bool rpl_parse; - my_bool no_master_reads; - my_bool separate_thread; + my_bool unused1; + my_bool unused2; + my_bool unused3; + my_bool unused4; enum mysql_option methods_to_use; char *client_ip; my_bool secure_auth; @@ -301,10 +301,6 @@ enum mysql_protocol_type MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET, MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY }; -enum mysql_rpl_type -{ - MYSQL_RPL_MASTER, MYSQL_RPL_SLAVE, MYSQL_RPL_ADMIN -}; typedef struct character_set { unsigned int number; @@ -344,10 +340,8 @@ typedef struct st_mysql my_bool free_me; my_bool reconnect; char scramble[20 +1]; - my_bool rpl_pivot; - struct st_mysql* master, *next_slave; - struct st_mysql* last_used_slave; - struct st_mysql* last_used_con; + my_bool unused1; + void *unused2, *unused3, *unused4, *unused5; LIST *stmts; const struct st_mysql_methods *methods; void *thd; @@ -371,20 +365,6 @@ typedef struct st_mysql_res { my_bool unbuffered_fetch_cancelled; void *extension; } MYSQL_RES; -typedef struct st_mysql_manager -{ - NET net; - char *host, *user, *passwd; - char *net_buf, *net_buf_pos, *net_data_end; - unsigned int port; - int cmd_status; - int last_errno; - int net_buf_size; - my_bool free_me; - my_bool eof; - char last_error[256]; - void *extension; -} MYSQL_MANAGER; typedef struct st_mysql_parameters { unsigned long *p_max_allowed_packet; @@ -437,14 +417,6 @@ int mysql_real_query(MYSQL *mysql, const char *q, unsigned long length); MYSQL_RES * mysql_store_result(MYSQL *mysql); MYSQL_RES * mysql_use_result(MYSQL *mysql); -my_bool mysql_master_query(MYSQL *mysql, const char *q, - unsigned long length); -my_bool mysql_master_send_query(MYSQL *mysql, const char *q, - unsigned long length); -my_bool mysql_slave_query(MYSQL *mysql, const char *q, - unsigned long length); -my_bool mysql_slave_send_query(MYSQL *mysql, const char *q, - unsigned long length); void mysql_get_character_set_info(MYSQL *mysql, MY_CHARSET_INFO *charset); void @@ -459,22 +431,6 @@ mysql_set_local_infile_handler(MYSQL *mysql, void *); void mysql_set_local_infile_default(MYSQL *mysql); -void mysql_enable_rpl_parse(MYSQL* mysql); -void mysql_disable_rpl_parse(MYSQL* mysql); -int mysql_rpl_parse_enabled(MYSQL* mysql); -void mysql_enable_reads_from_master(MYSQL* mysql); -void mysql_disable_reads_from_master(MYSQL* mysql); -my_bool mysql_reads_from_master_enabled(MYSQL* mysql); -enum mysql_rpl_type mysql_rpl_query_type(const char* q, int len); -my_bool mysql_rpl_probe(MYSQL* mysql); -int mysql_set_master(MYSQL* mysql, const char* host, - unsigned int port, - const char* user, - const char* passwd); -int mysql_add_slave(MYSQL* mysql, const char* host, - unsigned int port, - const char* user, - const char* passwd); int mysql_shutdown(MYSQL *mysql, enum mysql_enum_shutdown_level shutdown_level); @@ -521,18 +477,6 @@ void mysql_debug(const char *debug); void myodbc_remove_escape(MYSQL *mysql,char *name); unsigned int mysql_thread_safe(void); my_bool mysql_embedded(void); -MYSQL_MANAGER* mysql_manager_init(MYSQL_MANAGER* con); -MYSQL_MANAGER* mysql_manager_connect(MYSQL_MANAGER* con, - const char* host, - const char* user, - const char* passwd, - unsigned int port); -void mysql_manager_close(MYSQL_MANAGER* con); -int mysql_manager_command(MYSQL_MANAGER* con, - const char* cmd, int cmd_len); -int mysql_manager_fetch_line(MYSQL_MANAGER* con, - char* res_buf, - int res_buf_size); my_bool mysql_read_query_result(MYSQL *mysql); enum enum_mysql_stmt_state { diff --git a/include/mysql_com.h b/include/mysql_com.h index db5a5eb8741..2641aeda205 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -254,24 +254,23 @@ typedef struct st_net { unsigned int *return_status; unsigned char reading_or_writing; char save_char; - my_bool unused0; /* Please remove with the next incompatible ABI change. */ - my_bool unused; /* Please remove with the next incompatible ABI change */ - my_bool compress; my_bool unused1; /* Please remove with the next incompatible ABI change. */ + my_bool unused2; /* Please remove with the next incompatible ABI change */ + my_bool compress; + my_bool unused3; /* Please remove with the next incompatible ABI change. */ /* Pointer to query object in query cache, do not equal NULL (0) for queries in cache that have not stored its results yet */ #endif /* - 'query_cache_query' should be accessed only via query cache - functions and methods to maintain proper locking. + Unused, please remove with the next incompatible ABI change. */ - unsigned char *query_cache_query; + unsigned char *unused; unsigned int last_errno; unsigned char error; - my_bool unused2; /* Please remove with the next incompatible ABI change. */ - my_bool return_errno; + my_bool unused4; /* Please remove with the next incompatible ABI change. */ + my_bool unused5; /* Please remove with the next incompatible ABI change. */ /** Client library error message buffer. Actually belongs to struct MYSQL. */ char last_error[MYSQL_ERRMSG_SIZE]; /** Client library sqlstate buffer. Set along with the error message. */ @@ -409,10 +408,6 @@ void my_net_set_write_timeout(NET *net, uint timeout); void my_net_set_read_timeout(NET *net, uint timeout); #endif -/* - The following function is not meant for normal usage - Currently it's used internally by manager.c -*/ struct sockaddr; int my_connect(my_socket s, const struct sockaddr *name, unsigned int namelen, unsigned int timeout); diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt index 805551b7ee3..84ad50e03e3 100755 --- a/libmysql/CMakeLists.txt +++ b/libmysql/CMakeLists.txt @@ -73,7 +73,7 @@ SET(CLIENT_SOURCES ../mysys/array.c ../strings/bchange.c ../strings/bmove.c ../mysys/hash.c ../mysys/my_sleep.c ../mysys/default_modify.c get_password.c ../strings/int2str.c ../strings/is_prefix.c libmysql.c ../mysys/list.c ../strings/llstr.c - ../strings/longlong2str.c manager.c ../mysys/mf_arr_appstr.c ../mysys/mf_cache.c + ../strings/longlong2str.c ../mysys/mf_arr_appstr.c ../mysys/mf_cache.c ../mysys/mf_dirname.c ../mysys/mf_fn_ext.c ../mysys/mf_format.c ../mysys/mf_iocache.c ../mysys/mf_iocache2.c ../mysys/mf_loadpath.c ../mysys/mf_pack.c ../mysys/mf_path.c ../mysys/mf_tempfile.c ../mysys/mf_unixpath.c diff --git a/libmysql/Makefile.shared b/libmysql/Makefile.shared index eb4fd75ed11..acc709bfb89 100644 --- a/libmysql/Makefile.shared +++ b/libmysql/Makefile.shared @@ -31,7 +31,7 @@ pkglib_LTLIBRARIES = $(target) noinst_PROGRAMS = conf_to_src -target_sources = libmysql.c password.c manager.c \ +target_sources = libmysql.c password.c \ get_password.c errmsg.c mystringsobjects = strmov.lo strxmov.lo strxnmov.lo strnmov.lo \ diff --git a/libmysql/errmsg.c b/libmysql/errmsg.c index 95ee6862aa8..abdf65322ef 100644 --- a/libmysql/errmsg.c +++ b/libmysql/errmsg.c @@ -85,6 +85,7 @@ const char *client_errors[]= "Lost connection to MySQL server at '%s', system error: %d", "Statement closed indirectly because of a preceeding %s() call", "The number of columns in the result set differs from the number of bound buffers. You must reset the statement, rebind the result set columns, and execute the statement again", + "This handle is already connected. Use a separate handle for each connection." "" }; @@ -151,6 +152,7 @@ const char *client_errors[]= "Lost connection to MySQL server at '%s', system error: %d", "Statement closed indirectly because of a preceeding %s() call", "The number of columns in the result set differs from the number of bound buffers. You must reset the statement, rebind the result set columns, and execute the statement again", + "This handle is already connected. Use a separate handle for each connection." "" }; @@ -215,6 +217,7 @@ const char *client_errors[]= "Lost connection to MySQL server at '%s', system error: %d", "Statement closed indirectly because of a preceeding %s() call", "The number of columns in the result set differs from the number of bound buffers. You must reset the statement, rebind the result set columns, and execute the statement again", + "This handle is already connected. Use a separate handle for each connection." "" }; #endif diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 1264f2765ba..f922c98de3a 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -249,16 +249,6 @@ void STDCALL mysql_thread_end() #endif } -/* - Let the user specify that we don't want SIGPIPE; This doesn't however work - with threaded applications as we can have multiple read in progress. -*/ -static MYSQL* spawn_init(MYSQL* parent, const char* host, - unsigned int port, - const char* user, - const char* passwd); - - /* Expand wildcard to a sql string @@ -320,7 +310,7 @@ mysql_debug(const char *debug __attribute__((unused))) /************************************************************************** - Close the server connection if we get a SIGPIPE + Ignore SIGPIPE handler ARGSUSED **************************************************************************/ @@ -333,305 +323,6 @@ my_pipe_sig_handler(int sig __attribute__((unused))) #endif } -/* perform query on master */ -my_bool STDCALL mysql_master_query(MYSQL *mysql, const char *q, - unsigned long length) -{ - DBUG_ENTER("mysql_master_query"); - if (mysql_master_send_query(mysql, q, length)) - DBUG_RETURN(1); - DBUG_RETURN((*mysql->methods->read_query_result)(mysql)); -} - -my_bool STDCALL mysql_master_send_query(MYSQL *mysql, const char *q, - unsigned long length) -{ - MYSQL *master = mysql->master; - DBUG_ENTER("mysql_master_send_query"); - if (!master->net.vio && !mysql_real_connect(master,0,0,0,0,0,0,0)) - DBUG_RETURN(1); - master->reconnect= 1; - mysql->last_used_con = master; - DBUG_RETURN(simple_command(master, COM_QUERY, (const uchar*) q, length, 1)); -} - - -/* perform query on slave */ -my_bool STDCALL mysql_slave_query(MYSQL *mysql, const char *q, - unsigned long length) -{ - DBUG_ENTER("mysql_slave_query"); - if (mysql_slave_send_query(mysql, q, length)) - DBUG_RETURN(1); - DBUG_RETURN((*mysql->methods->read_query_result)(mysql)); -} - - -my_bool STDCALL mysql_slave_send_query(MYSQL *mysql, const char *q, - unsigned long length) -{ - MYSQL* last_used_slave, *slave_to_use = 0; - DBUG_ENTER("mysql_slave_send_query"); - - if ((last_used_slave = mysql->last_used_slave)) - slave_to_use = last_used_slave->next_slave; - else - slave_to_use = mysql->next_slave; - /* - Next_slave is always safe to use - we have a circular list of slaves - if there are no slaves, mysql->next_slave == mysql - */ - mysql->last_used_con = mysql->last_used_slave = slave_to_use; - if (!slave_to_use->net.vio && !mysql_real_connect(slave_to_use, 0,0,0, - 0,0,0,0)) - DBUG_RETURN(1); - slave_to_use->reconnect= 1; - DBUG_RETURN(simple_command(slave_to_use, COM_QUERY, (const uchar*) q, - length, 1)); -} - - -/* enable/disable parsing of all queries to decide - if they go on master or slave */ -void STDCALL mysql_enable_rpl_parse(MYSQL* mysql) -{ - mysql->options.rpl_parse = 1; -} - -void STDCALL mysql_disable_rpl_parse(MYSQL* mysql) -{ - mysql->options.rpl_parse = 0; -} - -/* get the value of the parse flag */ -int STDCALL mysql_rpl_parse_enabled(MYSQL* mysql) -{ - return mysql->options.rpl_parse; -} - -/* enable/disable reads from master */ -void STDCALL mysql_enable_reads_from_master(MYSQL* mysql) -{ - mysql->options.no_master_reads = 0; -} - -void STDCALL mysql_disable_reads_from_master(MYSQL* mysql) -{ - mysql->options.no_master_reads = 1; -} - -/* get the value of the master read flag */ -my_bool STDCALL mysql_reads_from_master_enabled(MYSQL* mysql) -{ - return !(mysql->options.no_master_reads); -} - - -/* - We may get an error while doing replication internals. - In this case, we add a special explanation to the original - error -*/ - -static void expand_error(MYSQL* mysql, int error) -{ - char tmp[MYSQL_ERRMSG_SIZE]; - char *p; - uint err_length; - strmake(tmp, mysql->net.last_error, MYSQL_ERRMSG_SIZE-1); - p = strmake(mysql->net.last_error, ER(error), MYSQL_ERRMSG_SIZE-1); - err_length= (uint) (p - mysql->net.last_error); - strmake(p, tmp, MYSQL_ERRMSG_SIZE-1 - err_length); - mysql->net.last_errno = error; -} - -/* - This function assumes we have just called SHOW SLAVE STATUS and have - read the given result and row -*/ - -static my_bool get_master(MYSQL* mysql, MYSQL_RES* res, MYSQL_ROW row) -{ - MYSQL* master; - DBUG_ENTER("get_master"); - if (mysql_num_fields(res) < 3) - DBUG_RETURN(1); /* safety */ - - /* use the same username and password as the original connection */ - if (!(master = spawn_init(mysql, row[0], atoi(row[2]), 0, 0))) - DBUG_RETURN(1); - mysql->master = master; - DBUG_RETURN(0); -} - - -/* - Assuming we already know that mysql points to a master connection, - retrieve all the slaves -*/ - -static my_bool get_slaves_from_master(MYSQL* mysql) -{ - MYSQL_RES* res = 0; - MYSQL_ROW row; - my_bool error = 1; - int has_auth_info; - int port_ind; - DBUG_ENTER("get_slaves_from_master"); - - if (!mysql->net.vio && !mysql_real_connect(mysql,0,0,0,0,0,0,0)) - { - expand_error(mysql, CR_PROBE_MASTER_CONNECT); - DBUG_RETURN(1); - } - mysql->reconnect= 1; - - if (mysql_query(mysql, "SHOW SLAVE HOSTS") || - !(res = mysql_store_result(mysql))) - { - expand_error(mysql, CR_PROBE_SLAVE_HOSTS); - DBUG_RETURN(1); - } - - switch (mysql_num_fields(res)) { - case 5: - has_auth_info = 0; - port_ind=2; - break; - case 7: - has_auth_info = 1; - port_ind=4; - break; - default: - goto err; - } - - while ((row = mysql_fetch_row(res))) - { - MYSQL* slave; - const char* tmp_user, *tmp_pass; - - if (has_auth_info) - { - tmp_user = row[2]; - tmp_pass = row[3]; - } - else - { - tmp_user = mysql->user; - tmp_pass = mysql->passwd; - } - - if (!(slave = spawn_init(mysql, row[1], atoi(row[port_ind]), - tmp_user, tmp_pass))) - goto err; - - /* Now add slave into the circular linked list */ - slave->next_slave = mysql->next_slave; - mysql->next_slave = slave; - } - error = 0; -err: - if (res) - mysql_free_result(res); - DBUG_RETURN(error); -} - - -my_bool STDCALL mysql_rpl_probe(MYSQL* mysql) -{ - MYSQL_RES *res= 0; - MYSQL_ROW row; - my_bool error= 1; - DBUG_ENTER("mysql_rpl_probe"); - - /* - First determine the replication role of the server we connected to - the most reliable way to do this is to run SHOW SLAVE STATUS and see - if we have a non-empty master host. This is still not fool-proof - - it is not a sin to have a master that has a dormant slave thread with - a non-empty master host. However, it is more reliable to check - for empty master than whether the slave thread is actually running - */ - if (mysql_query(mysql, "SHOW SLAVE STATUS") || - !(res = mysql_store_result(mysql))) - { - expand_error(mysql, CR_PROBE_SLAVE_STATUS); - DBUG_RETURN(1); - } - - row= mysql_fetch_row(res); - /* - Check master host for emptiness/NULL - For MySQL 4.0 it's enough to check for row[0] - */ - if (row && row[0] && *(row[0])) - { - /* this is a slave, ask it for the master */ - if (get_master(mysql, res, row) || get_slaves_from_master(mysql)) - goto err; - } - else - { - mysql->master = mysql; - if (get_slaves_from_master(mysql)) - goto err; - } - - error = 0; -err: - if (res) - mysql_free_result(res); - DBUG_RETURN(error); -} - - -/* - Make a not so fool-proof decision on where the query should go, to - the master or the slave. Ideally the user should always make this - decision himself with mysql_master_query() or mysql_slave_query(). - However, to be able to more easily port the old code, we support the - option of an educated guess - this should work for most applications, - however, it may make the wrong decision in some particular cases. If - that happens, the user would have to change the code to call - mysql_master_query() or mysql_slave_query() explicitly in the place - where we have made the wrong decision -*/ - -enum mysql_rpl_type -STDCALL mysql_rpl_query_type(const char* q, int len) -{ - const char *q_end= q + len; - for (; q < q_end; ++q) - { - char c; - if (my_isalpha(&my_charset_latin1, (c= *q))) - { - switch (my_tolower(&my_charset_latin1,c)) { - case 'i': /* insert */ - case 'u': /* update or unlock tables */ - case 'l': /* lock tables or load data infile */ - case 'd': /* drop or delete */ - case 'a': /* alter */ - return MYSQL_RPL_MASTER; - case 'c': /* create or check */ - return my_tolower(&my_charset_latin1,q[1]) == 'h' ? MYSQL_RPL_ADMIN : - MYSQL_RPL_MASTER; - case 's': /* select or show */ - return my_tolower(&my_charset_latin1,q[1]) == 'h' ? MYSQL_RPL_ADMIN : - MYSQL_RPL_SLAVE; - case 'f': /* flush */ - case 'r': /* repair */ - case 'g': /* grant */ - return MYSQL_RPL_ADMIN; - default: - return MYSQL_RPL_SLAVE; - } - } - } - return MYSQL_RPL_MASTER; /* By default, send to master */ -} - /************************************************************************** Connect to sql server @@ -1093,68 +784,6 @@ mysql_query(MYSQL *mysql, const char *query) } -static MYSQL* spawn_init(MYSQL* parent, const char* host, - unsigned int port, const char* user, - const char* passwd) -{ - MYSQL* child; - DBUG_ENTER("spawn_init"); - if (!(child= mysql_init(0))) - DBUG_RETURN(0); - - child->options.user= my_strdup((user) ? user : - (parent->user ? parent->user : - parent->options.user), MYF(0)); - child->options.password= my_strdup((passwd) ? passwd : - (parent->passwd ? - parent->passwd : - parent->options.password), MYF(0)); - child->options.port= port; - child->options.host= my_strdup((host) ? host : - (parent->host ? - parent->host : - parent->options.host), MYF(0)); - if (parent->db) - child->options.db= my_strdup(parent->db, MYF(0)); - else if (parent->options.db) - child->options.db= my_strdup(parent->options.db, MYF(0)); - - /* - rpl_pivot is set to 1 in mysql_init(); Reset it as we are not doing - replication here - */ - child->rpl_pivot= 0; - DBUG_RETURN(child); -} - - -int -STDCALL mysql_set_master(MYSQL* mysql, const char* host, - unsigned int port, const char* user, - const char* passwd) -{ - if (mysql->master != mysql && !mysql->master->rpl_pivot) - mysql_close(mysql->master); - if (!(mysql->master = spawn_init(mysql, host, port, user, passwd))) - return 1; - return 0; -} - - -int -STDCALL mysql_add_slave(MYSQL* mysql, const char* host, - unsigned int port, - const char* user, - const char* passwd) -{ - MYSQL* slave; - if (!(slave = spawn_init(mysql, host, port, user, passwd))) - return 1; - slave->next_slave = mysql->next_slave; - mysql->next_slave = slave; - return 0; -} - /************************************************************************** Return next field of the query results **************************************************************************/ @@ -1483,17 +1112,17 @@ MYSQL_FIELD_OFFSET STDCALL mysql_field_tell(MYSQL_RES *res) unsigned int STDCALL mysql_field_count(MYSQL *mysql) { - return mysql->last_used_con->field_count; + return mysql->field_count; } my_ulonglong STDCALL mysql_affected_rows(MYSQL *mysql) { - return mysql->last_used_con->affected_rows; + return mysql->affected_rows; } my_ulonglong STDCALL mysql_insert_id(MYSQL *mysql) { - return mysql->last_used_con->insert_id; + return mysql->insert_id; } const char *STDCALL mysql_sqlstate(MYSQL *mysql) @@ -1858,7 +1487,6 @@ my_bool cli_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt) MYSQL_DATA *fields_data; DBUG_ENTER("cli_read_prepare_result"); - mysql= mysql->last_used_con; if ((packet_length= cli_safe_read(mysql)) == packet_error) DBUG_RETURN(1); mysql->warning_count= 0; @@ -2092,7 +1720,7 @@ static void alloc_stmt_fields(MYSQL_STMT *stmt) { MYSQL_FIELD *fields, *field, *end; MEM_ROOT *alloc= &stmt->mem_root; - MYSQL *mysql= stmt->mysql->last_used_con; + MYSQL *mysql= stmt->mysql; stmt->field_count= mysql->field_count; @@ -2479,7 +2107,6 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length) DBUG_ENTER("execute"); DBUG_DUMP("packet", (uchar *) packet, length); - mysql->last_used_con= mysql; int4store(buff, stmt->stmt_id); /* Send stmt id to server */ buff[4]= (char) stmt->flags; int4store(buff+5, 1); /* iteration count */ @@ -4689,7 +4316,6 @@ int cli_read_binary_rows(MYSQL_STMT *stmt) } net = &mysql->net; - mysql= mysql->last_used_con; while ((pkt_len= cli_safe_read(mysql)) != packet_error) { @@ -4787,8 +4413,6 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt) DBUG_RETURN(1); } - mysql= mysql->last_used_con; - if (!stmt->field_count) DBUG_RETURN(0); @@ -5193,8 +4817,7 @@ my_bool STDCALL mysql_more_results(MYSQL *mysql) my_bool res; DBUG_ENTER("mysql_more_results"); - res= ((mysql->last_used_con->server_status & SERVER_MORE_RESULTS_EXISTS) ? - 1: 0); + res= ((mysql->server_status & SERVER_MORE_RESULTS_EXISTS) ? 1: 0); DBUG_PRINT("exit",("More results exists ? %d", res)); DBUG_RETURN(res); } @@ -5216,7 +4839,7 @@ int STDCALL mysql_next_result(MYSQL *mysql) net_clear_error(&mysql->net); mysql->affected_rows= ~(my_ulonglong) 0; - if (mysql->last_used_con->server_status & SERVER_MORE_RESULTS_EXISTS) + if (mysql->server_status & SERVER_MORE_RESULTS_EXISTS) DBUG_RETURN((*mysql->methods->next_result)(mysql)); DBUG_RETURN(-1); /* No more results */ diff --git a/libmysql/libmysql.def b/libmysql/libmysql.def index 81f86dc8726..f6e93ca35fb 100644 --- a/libmysql/libmysql.def +++ b/libmysql/libmysql.def @@ -135,15 +135,6 @@ EXPORTS client_errors mysql_set_local_infile_default mysql_set_local_infile_handler - mysql_disable_reads_from_master - mysql_disable_rpl_parse - mysql_enable_reads_from_master - mysql_enable_rpl_parse - mysql_master_query - mysql_rpl_parse_enabled - mysql_rpl_probe - mysql_rpl_query_type - mysql_slave_query mysql_embedded mysql_server_init mysql_server_end diff --git a/libmysql/manager.c b/libmysql/manager.c deleted file mode 100644 index 53ffffa55c0..00000000000 --- a/libmysql/manager.c +++ /dev/null @@ -1,269 +0,0 @@ -/* Copyright (C) 2000-2004 MySQL AB - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation. - - There are special exceptions to the terms and conditions of the GPL as it - is applied to this software. View the full text of the exception in file - EXCEPTIONS-CLIENT in the directory of this software distribution. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#include <my_global.h> -#if defined(THREAD) -#include <my_pthread.h> /* because of signal() */ -#endif -#include "mysql.h" -#include "mysql_version.h" -#include "mysqld_error.h" -#include <my_sys.h> -#include <mysys_err.h> -#include <m_string.h> -#include <m_ctype.h> -#include <my_net.h> -#include <errmsg.h> -#include <violite.h> -#include <sys/stat.h> -#include <signal.h> -#include <errno.h> - -#if defined(__NETWARE__) -#include <netdb.h> -#include <sys/select.h> -#include <sys/utsname.h> -#elif !defined( __WIN__) -#include <sys/resource.h> -#ifdef HAVE_SYS_UN_H -# include <sys/un.h> -#endif -#include <netdb.h> -#ifdef HAVE_SELECT_H -# include <select.h> -#endif -#ifdef HAVE_SYS_SELECT_H -#include <sys/select.h> -#endif -#include <sys/utsname.h> -#endif /* __WIN__ */ - -#ifndef INADDR_NONE -#define INADDR_NONE -1 -#endif - -#define RES_BUF_SHIFT 5 -#define NET_BUF_SIZE 2048 - -MYSQL_MANAGER* STDCALL mysql_manager_init(MYSQL_MANAGER* con) -{ - int net_buf_size=NET_BUF_SIZE; - if (!con) - { - if (!(con=(MYSQL_MANAGER*)my_malloc(sizeof(*con)+net_buf_size, - MYF(MY_WME|MY_ZEROFILL)))) - return 0; - con->free_me=1; - con->net_buf=(char*)con+sizeof(*con); - } - else - { - bzero((char*)con,sizeof(*con)); - if (!(con->net_buf=my_malloc(net_buf_size,MYF(0)))) - return 0; - } - con->net_buf_pos=con->net_data_end=con->net_buf; - con->net_buf_size=net_buf_size; - return con; -} - -MYSQL_MANAGER* STDCALL mysql_manager_connect(MYSQL_MANAGER* con, - const char* host, - const char* user, - const char* passwd, - unsigned int port) -{ - my_socket sock; - struct sockaddr_in sock_addr; - in_addr_t ip_addr; - char msg_buf[MAX_MYSQL_MANAGER_MSG]; - int msg_len; - Vio* vio; - my_bool not_used; - - if (!host) - host="localhost"; - if (!user) - user="root"; - if (!passwd) - passwd=""; - - if ((sock=(my_socket)socket(AF_INET,SOCK_STREAM,0)) == INVALID_SOCKET) - { - con->last_errno=errno; - strmov(con->last_error,"Cannot create socket"); - goto err; - } - if (!(vio=vio_new(sock,VIO_TYPE_TCPIP,FALSE))) - { - con->last_errno=ENOMEM; - strmov(con->last_error,"Cannot create network I/O object"); - goto err; - } - vio_blocking(vio, TRUE, ¬_used); - my_net_init(&con->net,vio); - bzero((char*) &sock_addr,sizeof(sock_addr)); - sock_addr.sin_family = AF_INET; - if ((int) (ip_addr = inet_addr(host)) != (int) INADDR_NONE) - { - memcpy_fixed(&sock_addr.sin_addr,&ip_addr,sizeof(ip_addr)); - } - else - { - int tmp_errno; - struct hostent tmp_hostent,*hp; - char buff2[GETHOSTBYNAME_BUFF_SIZE]; - hp = my_gethostbyname_r(host,&tmp_hostent,buff2,sizeof(buff2), - &tmp_errno); - if (!hp) - { - con->last_errno=tmp_errno; - sprintf(con->last_error,"Could not resolve host '%-.64s'",host); - my_gethostbyname_r_free(); - goto err; - } - memcpy(&sock_addr.sin_addr,hp->h_addr, (size_t) hp->h_length); - my_gethostbyname_r_free(); - } - sock_addr.sin_port = (ushort) htons((ushort) port); - if (my_connect(sock,(struct sockaddr *) &sock_addr, sizeof(sock_addr), - 0)) - { - con->last_errno=errno; - sprintf(con->last_error ,"Could not connect to %-.64s", host); - goto err; - } - /* read the greating */ - if (my_net_read(&con->net) == packet_error) - { - con->last_errno=errno; - strmov(con->last_error,"Read error on socket"); - goto err; - } - sprintf(msg_buf,"%-.16s %-.16s\n",user,passwd); - msg_len=strlen(msg_buf); - if (my_net_write(&con->net,(uchar*) msg_buf,msg_len) || net_flush(&con->net)) - { - con->last_errno=con->net.last_errno; - strmov(con->last_error,"Write error on socket"); - goto err; - } - if (my_net_read(&con->net) == packet_error) - { - con->last_errno=errno; - strmov(con->last_error,"Read error on socket"); - goto err; - } - if ((con->cmd_status=atoi((char*) con->net.read_pos)) != MANAGER_OK) - { - strmov(con->last_error,"Access denied"); - goto err; - } - if (!my_multi_malloc(MYF(0), &con->host, (uint)strlen(host)+1, - &con->user, (uint)strlen(user)+1, - &con->passwd, (uint)strlen(passwd)+1, - NullS)) - { - con->last_errno=ENOMEM; - strmov(con->last_error,"Out of memory"); - goto err; - } - strmov(con->host,host); - strmov(con->user,user); - strmov(con->passwd,passwd); - return con; - -err: - { - my_bool free_me=con->free_me; - con->free_me=0; - mysql_manager_close(con); - con->free_me=free_me; - } - return 0; -} - -void STDCALL mysql_manager_close(MYSQL_MANAGER* con) -{ - /* - No need to free con->user and con->passwd, because they were - allocated in my_multimalloc() along with con->host, freeing - con->hosts frees the whole block - */ - my_free((uchar*)con->host,MYF(MY_ALLOW_ZERO_PTR)); - net_end(&con->net); - if (con->free_me) - my_free((uchar*)con,MYF(0)); -} - - -int STDCALL mysql_manager_command(MYSQL_MANAGER* con,const char* cmd, - int cmd_len) -{ - if (!cmd_len) - cmd_len=strlen(cmd); - if (my_net_write(&con->net,(const uchar*)cmd,cmd_len) || net_flush(&con->net)) - { - con->last_errno=errno; - strmov(con->last_error,"Write error on socket"); - return 1; - } - con->eof=0; - return 0; -} - - -int STDCALL mysql_manager_fetch_line(MYSQL_MANAGER* con, char* res_buf, - int res_buf_size) -{ - char* res_buf_end=res_buf+res_buf_size; - char* net_buf=(char*) con->net.read_pos, *net_buf_end; - int res_buf_shift=RES_BUF_SHIFT; - ulong num_bytes; - - if (res_buf_size<RES_BUF_SHIFT) - { - con->last_errno=ENOMEM; - strmov(con->last_error,"Result buffer too small"); - return 1; - } - - if ((num_bytes=my_net_read(&con->net)) == packet_error) - { - con->last_errno=errno; - strmov(con->last_error,"socket read failed"); - return 1; - } - - net_buf_end=net_buf+num_bytes; - - if ((con->eof=(net_buf[3]==' '))) - res_buf_shift--; - net_buf+=res_buf_shift; - res_buf_end[-1]=0; - for (;net_buf<net_buf_end && res_buf < res_buf_end;res_buf++,net_buf++) - { - if ((*res_buf=*net_buf) == '\r') - { - *res_buf=0; - break; - } - } - return 0; -} diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 2ac2556d4de..31f9d97a413 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -98,7 +98,7 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command, thd= (THD *) mysql->thd; } -#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER) +#if defined(ENABLED_PROFILING) thd->profiling.start_new_query(); #endif @@ -142,7 +142,7 @@ emb_advanced_command(MYSQL *mysql, enum enum_server_command command, if (!skip_check) result= thd->is_error() ? -1 : 0; -#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER) +#if defined(ENABLED_PROFILING) thd->profiling.finish_current_query(); #endif return result; @@ -952,7 +952,7 @@ bool Protocol::send_fields(List<Item> *list, uint flags) client_field->catalog= dup_str_aux(field_alloc, "def", 3, cs, thd_cs); client_field->catalog_length= 3; - if (INTERNAL_NUM_FIELD(client_field)) + if (IS_NUM(client_field->type)) client_field->flags|= NUM_FLAG; if (flags & (int) Protocol::SEND_DEFAULTS) diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c index aff9391e015..bcb72041961 100644 --- a/libmysqld/libmysqld.c +++ b/libmysqld/libmysqld.c @@ -28,6 +28,7 @@ #include <sys/stat.h> #include <signal.h> #include <time.h> +#include <sql_common.h> #include "client_settings.h" #ifdef HAVE_PWD_H #include <pwd.h> @@ -77,17 +78,6 @@ static my_bool is_NT(void) } #endif -/************************************************************************** -** Shut down connection -**************************************************************************/ - -static void end_server(MYSQL *mysql) -{ - DBUG_ENTER("end_server"); - free_old_query(mysql); - DBUG_VOID_RETURN; -} - int mysql_init_character_set(MYSQL *mysql); @@ -99,11 +89,18 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, char name_buff[USERNAME_LENGTH]; DBUG_ENTER("mysql_real_connect"); - DBUG_PRINT("enter",("host: %s db: %s user: %s", + DBUG_PRINT("enter",("host: %s db: %s user: %s (libmysqld)", host ? host : "(Null)", db ? db : "(Null)", user ? user : "(Null)")); + /* Test whether we're already connected */ + if (mysql->server_version) + { + set_mysql_error(mysql, CR_ALREADY_CONNECTED, unknown_sqlstate); + DBUG_RETURN(0); + } + if (!host || !host[0]) host= mysql->options.host; @@ -215,7 +212,7 @@ error: { /* Free alloced memory */ my_bool free_me=mysql->free_me; - end_server(mysql); + free_old_query(mysql); mysql->free_me=0; mysql_close(mysql); mysql->free_me=free_me; diff --git a/libmysqld/libmysqld.def b/libmysqld/libmysqld.def index 047cfe0fe57..d7f98f8b32b 100644 --- a/libmysqld/libmysqld.def +++ b/libmysqld/libmysqld.def @@ -13,9 +13,7 @@ EXPORTS mysql_commit mysql_data_seek mysql_debug - mysql_disable_rpl_parse mysql_dump_debug_info - mysql_enable_rpl_parse mysql_eof mysql_errno mysql_error @@ -61,8 +59,6 @@ EXPORTS mysql_rollback mysql_row_seek mysql_row_tell - mysql_rpl_parse_enabled - mysql_rpl_probe mysql_select_db mysql_send_query mysql_shutdown diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental index fc057256147..6d5655ba499 100644 --- a/mysql-test/collections/default.experimental +++ b/mysql-test/collections/default.experimental @@ -11,6 +11,8 @@ main.ctype_gbk_binlog @solaris # Bug#46010: main.ctype_gbk_binlog fail main.information_schema # Bug#47449 2009-09-19 alik main.information_schema and innodb.innodb_information_schema fail sporadically main.innodb-autoinc # Bug#44030 2009-09-24 alik Marking innodb-autoinc experimental while waiting for the patch to be merged main.lock_multi_bug38499 # Bug#47448 2009-09-19 alik main.lock_multi_bug38499 times out sporadically +main.lock_multi_bug38691 @solaris # Bug#47792 2009-10-02 alik main.lock_multi_bug38691 times out sporadically on Solaris 10 +main.log_tables # Bug#47924 2009-10-08 alik main.log_tables times out sporadically main.plugin # Bug#47146 Linking problem with example plugin when dtrace enabled main.plugin_load # Bug#47146 @@ -19,9 +21,16 @@ rpl.rpl_innodb_bug28430* @solaris # Bug#46029 rpl.rpl_innodb_bug30888* @solaris # Bug#47646 2009-09-25 alik rpl.rpl_innodb_bug30888 fails sporadically on Solaris rpl.rpl_plugin_load* @solaris # Bug#47146 rpl.rpl_row_create_table* # Bug#45576: rpl_row_create_table fails on PB2 +rpl.rpl_log_pos* # Bug#47743 2009-10-02 alik rpl.rpl_log_pos fails sporadically rpl.rpl_trigger* # Bug#46656 2009-09-25 alik InnoDB plugin: memory leaks (Valgrind) -rpl_ndb.rpl_ndb_log # Bug#38998 +# Declare all NDB-tests in ndb and rpl_ndb test suites experimental. +# Usually the test cases from ndb and rpl_ndb test suites are not run in PB, +# but they run by gcov. +# + +ndb.* +rpl_ndb.* # Declare all NDB-tests in other test suites experimental. diff --git a/mysql-test/include/have_community_features.inc b/mysql-test/include/have_community_features.inc deleted file mode 100644 index 66697d8dd00..00000000000 --- a/mysql-test/include/have_community_features.inc +++ /dev/null @@ -1,4 +0,0 @@ ---require r/have_community_features.require ---disable_query_log -show variables like 'have_community_features'; ---enable_query_log diff --git a/mysql-test/include/have_profiling.inc b/mysql-test/include/have_profiling.inc new file mode 100644 index 00000000000..48f6668ff92 --- /dev/null +++ b/mysql-test/include/have_profiling.inc @@ -0,0 +1,4 @@ +--require r/have_profiling.require +--disable_query_log +show variables like 'have_profiling'; +--enable_query_log diff --git a/mysql-test/include/query_cache_sql_prepare.inc b/mysql-test/include/query_cache_sql_prepare.inc index 1842d5412bb..baa041aa058 100644 --- a/mysql-test/include/query_cache_sql_prepare.inc +++ b/mysql-test/include/query_cache_sql_prepare.inc @@ -1,11 +1,13 @@ ############### include/query_cache_sql_prepare.inc ################ # # This is to see how statements prepared via the PREPARE SQL command -# go into the query cache: if using parameters they cannot; if not -# using parameters they can. +# go into the query cache. # Query cache is abbreviated as "QC" # # Last update: +# 2008-05-26 Kostja +# - Add test coverage for automatic statement reprepare +# # 2007-05-03 ML - Move t/query_cache_sql_prepare.test # to include/query_cache_sql_prepare.inc # - Create two toplevel tests sourcing this routine @@ -490,6 +492,37 @@ use test; --echo --echo ######################################################################## +--echo # +--echo # Bug#27430 Crash in subquery code when in PS and table DDL changed +--echo # after PREPARE +--echo # Check the effect of automatic reprepare on query cache +--echo # +--echo ######################################################################## +--disable_warnings +drop table if exists t1; +--enable_warnings +create table t1 (a varchar(255)); +insert into t1 (a) values ("Pack my box with five dozen liquor jugs."); +flush status; +prepare stmt from "select a from t1"; +execute stmt; +set @@global.query_cache_size=0; +alter table t1 add column b int; +execute stmt; +set @@global.query_cache_size=100000; +execute stmt; +execute stmt; +--echo # +--echo # Sic: ALTER TABLE caused an automatic reprepare +--echo # of the prepared statement. Since the query cache was disabled +--echo # at the time of reprepare, the new prepared statement doesn't +--echo # work with it. +--echo # +show status like 'Qcache_hits'; +show status like 'Qcache_queries_in_cache'; +--echo # Cleanup +deallocate prepare stmt; +drop table t1; ############################################################################### diff --git a/mysql-test/include/wait_for_slave_param.inc b/mysql-test/include/wait_for_slave_param.inc index 82e57922913..1e690bdfe9c 100644 --- a/mysql-test/include/wait_for_slave_param.inc +++ b/mysql-test/include/wait_for_slave_param.inc @@ -49,6 +49,8 @@ if (!$_slave_timeout_counter) { let $_slave_timeout_counter= 3000; } +# Save resulting counter for later use. +let $slave_tcnt= $_slave_timeout_counter; let $_slave_param_comparison= $slave_param_comparison; if (`SELECT '$_slave_param_comparison' = ''`) @@ -70,7 +72,7 @@ while (`SELECT NOT('$_show_slave_status_value' $_slave_param_comparison '$slave_ # This has to be outside the loop until BUG#41913 has been fixed if (!$_slave_timeout_counter) { - --echo **** ERROR: timeout after $slave_timeout seconds while waiting for slave parameter $slave_param $_slave_param_comparison $slave_param_value **** + --echo **** ERROR: timeout after $slave_tcnt deci-seconds while waiting for slave parameter $slave_param $_slave_param_comparison $slave_param_value **** if (`SELECT '$slave_error_message' != ''`) { --echo Message: $slave_error_message diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index 5a115e9ea99..28bf6e9edc3 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -1269,3 +1269,11 @@ a b 5 a DROP TABLE t1; End of 5.1 tests +CREATE TABLE t1(c CHAR(10), +i INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY); +INSERT INTO t1 VALUES('a',2),('b',4),('c',6); +ALTER TABLE t1 +DROP i, +ADD i INT UNSIGNED NOT NULL AUTO_INCREMENT, +AUTO_INCREMENT = 1; +DROP TABLE t1; diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result index 7c23f1267c2..6b0954655e9 100644 --- a/mysql-test/r/bigint.result +++ b/mysql-test/r/bigint.result @@ -385,7 +385,7 @@ def -((9223372036854775808)) 8 20 20 N 32897 0 63 -9223372036854775808 select -(-(9223372036854775808)); Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def -(-(9223372036854775808)) 246 21 19 N 129 0 63 +def -(-(9223372036854775808)) 246 21 19 N 32897 0 63 -(-(9223372036854775808)) 9223372036854775808 select --9223372036854775808, ---9223372036854775808, ----9223372036854775808; diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index b829ef30fb1..471cc6e9a3d 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -1922,3 +1922,37 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp # -- End of Bug#45829 End of 5.1 tests + +# -- +# -- Bug #43054 Assertion `!table->auto_increment_field_not_null' +# -- failed when redefining trigger + +CREATE TABLE B ( +pk INTEGER AUTO_INCREMENT, +int_key INTEGER NOT NULL, +PRIMARY KEY (pk), +KEY (int_key) +); +INSERT IGNORE INTO B VALUES ('9', '9'); +CREATE TABLE IF NOT EXISTS t1 ( +`pk` INTEGER NOT NULL AUTO_INCREMENT , +`int` INTEGER , +PRIMARY KEY ( `pk` ) +) SELECT `pk` , `int_key` FROM B ; +CREATE TRIGGER f BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +INSERT INTO t1 ( `int` ) VALUES (4 ),( 8 ),( 2 ) ; +END ; | +CREATE TABLE IF NOT EXISTS t1 ( +`pk` INTEGER NOT NULL AUTO_INCREMENT , +`int` INTEGER , +PRIMARY KEY ( `pk` ) +) SELECT `pk` , `int_key` FROM B ; +ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger. +CREATE TRIGGER f BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +UPDATE A SET `pk`=1 WHERE `pk`=0 ; +END ;| +ERROR 42000: This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table' +DROP TABLE t1; +DROP TABLE B; diff --git a/mysql-test/r/ddl_i18n_koi8r.result b/mysql-test/r/ddl_i18n_koi8r.result index fe24c17a1c5..92da2b37e97 100644 --- a/mysql-test/r/ddl_i18n_koi8r.result +++ b/mysql-test/r/ddl_i18n_koi8r.result @@ -2226,7 +2226,7 @@ END| SHOW CREATE EVENT ev1| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev1 SYSTEM CREATE EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev1 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10); SELECT COLLATION(ÐÅÒÅÍ1) AS c1, @@ -2239,7 +2239,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE EVENT ev2| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev2 SYSTEM CREATE EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev2 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(ÐÅÒÅÍ1) AS c1, @@ -2252,7 +2252,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE EVENT mysqltest2.ev3| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev3 SYSTEM CREATE EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev3 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(ÐÅÒÅÍ1) AS c1, @@ -2265,7 +2265,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE EVENT mysqltest2.ev3| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev3 SYSTEM CREATE EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev3 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(ÐÅÒÅÍ1) AS c1, @@ -2361,7 +2361,7 @@ set names koi8r| SHOW CREATE EVENT ev1| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev1 SYSTEM CREATE EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev1 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10); SELECT COLLATION(ÐÅÒÅÍ1) AS c1, @@ -2374,7 +2374,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE EVENT ev2| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev2 SYSTEM CREATE EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev2 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(ÐÅÒÅÍ1) AS c1, @@ -2387,7 +2387,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE EVENT mysqltest2.ev3| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev3 SYSTEM CREATE EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev3 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(ÐÅÒÅÍ1) AS c1, @@ -2400,7 +2400,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE EVENT mysqltest2.ev3| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev3 SYSTEM CREATE EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev3 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(ÐÅÒÅÍ1) AS c1, @@ -2497,7 +2497,7 @@ ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;; /*!50003 SET sql_mode = '' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10); SELECT COLLATION(ÐÅÒÅÍ1) AS c1, @@ -2525,7 +2525,7 @@ ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;; /*!50003 SET sql_mode = '' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(ÐÅÒÅÍ1) AS c1, @@ -2564,7 +2564,7 @@ ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;; /*!50003 SET sql_mode = '' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(ÐÅÒÅÍ1) AS c1, @@ -2592,7 +2592,7 @@ ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;; /*!50003 SET sql_mode = '' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE EVENT `ev4` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `ev4` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(ÐÅÒÅÍ1) AS c1, @@ -2634,7 +2634,7 @@ set names koi8r| SHOW CREATE EVENT ev1| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev1 SYSTEM CREATE EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev1 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10); SELECT COLLATION(ÐÅÒÅÍ1) AS c1, @@ -2647,7 +2647,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE EVENT ev2| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev2 SYSTEM CREATE EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev2 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(ÐÅÒÅÍ1) AS c1, @@ -2660,7 +2660,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE EVENT mysqltest2.ev3| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev3 SYSTEM CREATE EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev3 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(ÐÅÒÅÍ1) AS c1, @@ -2673,7 +2673,7 @@ END koi8r koi8r_general_ci utf8_unicode_ci SHOW CREATE EVENT mysqltest2.ev3| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev3 SYSTEM CREATE EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev3 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(ÐÅÒÅÍ1) AS c1, diff --git a/mysql-test/r/ddl_i18n_utf8.result b/mysql-test/r/ddl_i18n_utf8.result index cf4272bf90c..4cce13fb7c5 100644 --- a/mysql-test/r/ddl_i18n_utf8.result +++ b/mysql-test/r/ddl_i18n_utf8.result @@ -2226,7 +2226,7 @@ END| SHOW CREATE EVENT ev1| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev1 SYSTEM CREATE EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev1 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE перем1 CHAR(10); SELECT COLLATION(перем1) AS c1, @@ -2239,7 +2239,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE EVENT ev2| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev2 SYSTEM CREATE EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev2 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(перем1) AS c1, @@ -2252,7 +2252,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE EVENT mysqltest2.ev3| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev3 SYSTEM CREATE EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev3 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(перем1) AS c1, @@ -2265,7 +2265,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE EVENT mysqltest2.ev3| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev3 SYSTEM CREATE EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev3 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(перем1) AS c1, @@ -2361,7 +2361,7 @@ set names utf8| SHOW CREATE EVENT ev1| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev1 SYSTEM CREATE EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev1 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE перем1 CHAR(10); SELECT COLLATION(перем1) AS c1, @@ -2374,7 +2374,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE EVENT ev2| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev2 SYSTEM CREATE EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev2 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(перем1) AS c1, @@ -2387,7 +2387,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE EVENT mysqltest2.ev3| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev3 SYSTEM CREATE EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev3 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(перем1) AS c1, @@ -2400,7 +2400,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE EVENT mysqltest2.ev3| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev3 SYSTEM CREATE EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev3 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(перем1) AS c1, @@ -2497,7 +2497,7 @@ ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;; /*!50003 SET sql_mode = '' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE перем1 CHAR(10); SELECT COLLATION(перем1) AS c1, @@ -2525,7 +2525,7 @@ ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;; /*!50003 SET sql_mode = '' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(перем1) AS c1, @@ -2564,7 +2564,7 @@ ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;; /*!50003 SET sql_mode = '' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(перем1) AS c1, @@ -2592,7 +2592,7 @@ ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;; /*!50003 SET sql_mode = '' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE EVENT `ev4` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `ev4` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(перем1) AS c1, @@ -2634,7 +2634,7 @@ set names utf8| SHOW CREATE EVENT ev1| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev1 SYSTEM CREATE EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev1 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE перем1 CHAR(10); SELECT COLLATION(перем1) AS c1, @@ -2647,7 +2647,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE EVENT ev2| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev2 SYSTEM CREATE EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev2 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev2` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(перем1) AS c1, @@ -2660,7 +2660,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE EVENT mysqltest2.ev3| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev3 SYSTEM CREATE EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev3 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(перем1) AS c1, @@ -2673,7 +2673,7 @@ END utf8 utf8_general_ci utf8_unicode_ci SHOW CREATE EVENT mysqltest2.ev3| Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev3 SYSTEM CREATE EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN +ev3 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev3` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN DECLARE перем1 CHAR(10) CHARACTER SET utf8; SELECT COLLATION(перем1) AS c1, diff --git a/mysql-test/r/delayed.result b/mysql-test/r/delayed.result index 4d5d656f3ce..da6f36120aa 100644 --- a/mysql-test/r/delayed.result +++ b/mysql-test/r/delayed.result @@ -311,3 +311,25 @@ a b drop table t1; set global low_priority_updates = @old_delayed_updates; End of 5.1 tests +# +# Bug #47274 assert in open_table on CREATE TABLE <already existing> +# +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; +CREATE TABLE t1 ( f1 INTEGER AUTO_INCREMENT, PRIMARY KEY (f1)); +# The following CREATE TABLEs before gave an assert. +INSERT DELAYED t1 VALUES (4); +CREATE TABLE t1 AS SELECT 1 AS f1; +ERROR 42S01: Table 't1' already exists +REPLACE DELAYED t1 VALUES (5); +CREATE TABLE t1 AS SELECT 1 AS f1; +ERROR 42S01: Table 't1' already exists +INSERT DELAYED t1 VALUES (6); +CREATE TABLE t1 (f1 INTEGER); +ERROR 42S01: Table 't1' already exists +CREATE TABLE t2 (f1 INTEGER); +INSERT DELAYED t1 VALUES (7); +CREATE TABLE t1 LIKE t2; +ERROR 42S01: Table 't1' already exists +DROP TABLE t2; +DROP TABLE t1; diff --git a/mysql-test/r/drop-no_root.result b/mysql-test/r/drop-no_root.result new file mode 100644 index 00000000000..3e1f2fe2cf0 --- /dev/null +++ b/mysql-test/r/drop-no_root.result @@ -0,0 +1,28 @@ + +# -- +# -- Bug#26704: Failing DROP DATABASE brings mysql-client out of sync. +# -- + +DROP DATABASE IF EXISTS mysql_test; + +CREATE DATABASE mysql_test; +CREATE TABLE mysql_test.t1(c INT); +use mysql_test; + +chmod 000 mysql_test/t1.frm + +DROP DATABASE mysql_test; + +SELECT DATABASE(); +DATABASE() +mysql_test + +rm -f mysql_test/t1.MYD mysql_test/t1.MYI +chmod 666 mysql_test/t1.frm +rm -f mysql_test/t1.frm + +DROP DATABASE mysql_test; + +use test; + +# -- End of Bug#26704. diff --git a/mysql-test/r/events_1.result b/mysql-test/r/events_1.result index e7b645f5556..e068158e6ce 100644 --- a/mysql-test/r/events_1.result +++ b/mysql-test/r/events_1.result @@ -123,80 +123,80 @@ set names utf8; CREATE EVENT root6 ON SCHEDULE EVERY '10:20' MINUTE_SECOND ON COMPLETION PRESERVE ENABLE COMMENT 'some comment' DO select 1; SHOW CREATE EVENT root6; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -root6 SYSTEM CREATE EVENT `root6` ON SCHEDULE EVERY '10:20' MINUTE_SECOND STARTS '#' ON COMPLETION PRESERVE ENABLE COMMENT 'some comment' DO select 1 utf8 utf8_general_ci latin1_swedish_ci +root6 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root6` ON SCHEDULE EVERY '10:20' MINUTE_SECOND STARTS '#' ON COMPLETION PRESERVE ENABLE COMMENT 'some comment' DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root7 on schedule every 2 year do select 1; SHOW CREATE EVENT root7; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -root7 SYSTEM CREATE EVENT `root7` ON SCHEDULE EVERY 2 YEAR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci +root7 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root7` ON SCHEDULE EVERY 2 YEAR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root8 on schedule every '2:5' year_month do select 1; SHOW CREATE EVENT root8; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -root8 SYSTEM CREATE EVENT `root8` ON SCHEDULE EVERY '2-5' YEAR_MONTH STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci +root8 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root8` ON SCHEDULE EVERY '2-5' YEAR_MONTH STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root8_1 on schedule every '2:15' year_month do select 1; SHOW CREATE EVENT root8_1; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -root8_1 SYSTEM CREATE EVENT `root8_1` ON SCHEDULE EVERY '3-3' YEAR_MONTH STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci +root8_1 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root8_1` ON SCHEDULE EVERY '3-3' YEAR_MONTH STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root9 on schedule every 2 week ON COMPLETION PRESERVE DISABLE COMMENT 'коментар на кирилица' do select 1; SHOW CREATE EVENT root9; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -root9 SYSTEM CREATE EVENT `root9` ON SCHEDULE EVERY 2 WEEK STARTS '#' ON COMPLETION PRESERVE DISABLE COMMENT 'коментар на кирилица' DO select 1 utf8 utf8_general_ci latin1_swedish_ci +root9 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root9` ON SCHEDULE EVERY 2 WEEK STARTS '#' ON COMPLETION PRESERVE DISABLE COMMENT 'коментар на кирилица' DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root10 on schedule every '20:5' day_hour do select 1; SHOW CREATE EVENT root10; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -root10 SYSTEM CREATE EVENT `root10` ON SCHEDULE EVERY '20 5' DAY_HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci +root10 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root10` ON SCHEDULE EVERY '20 5' DAY_HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root11 on schedule every '20:25' day_hour do select 1; SHOW CREATE EVENT root11; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -root11 SYSTEM CREATE EVENT `root11` ON SCHEDULE EVERY '21 1' DAY_HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci +root11 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root11` ON SCHEDULE EVERY '21 1' DAY_HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root12 on schedule every '20:25' hour_minute do select 1; SHOW CREATE EVENT root12; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -root12 SYSTEM CREATE EVENT `root12` ON SCHEDULE EVERY '20:25' HOUR_MINUTE STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci +root12 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root12` ON SCHEDULE EVERY '20:25' HOUR_MINUTE STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root13 on schedule every '25:25' hour_minute do select 1; SHOW CREATE EVENT root13; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -root13 SYSTEM CREATE EVENT `root13` ON SCHEDULE EVERY '25:25' HOUR_MINUTE STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci +root13 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root13` ON SCHEDULE EVERY '25:25' HOUR_MINUTE STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root13_1 on schedule every '11:65' hour_minute do select 1; SHOW CREATE EVENT root13_1; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -root13_1 SYSTEM CREATE EVENT `root13_1` ON SCHEDULE EVERY '12:5' HOUR_MINUTE STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci +root13_1 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root13_1` ON SCHEDULE EVERY '12:5' HOUR_MINUTE STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root14 on schedule every '35:35' minute_second do select 1; SHOW CREATE EVENT root14; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -root14 SYSTEM CREATE EVENT `root14` ON SCHEDULE EVERY '35:35' MINUTE_SECOND STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci +root14 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root14` ON SCHEDULE EVERY '35:35' MINUTE_SECOND STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root15 on schedule every '35:66' minute_second do select 1; SHOW CREATE EVENT root15; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -root15 SYSTEM CREATE EVENT `root15` ON SCHEDULE EVERY '36:6' MINUTE_SECOND STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci +root15 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root15` ON SCHEDULE EVERY '36:6' MINUTE_SECOND STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root16 on schedule every '35:56' day_minute do select 1; SHOW CREATE EVENT root16; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -root16 SYSTEM CREATE EVENT `root16` ON SCHEDULE EVERY '1 11:56' DAY_MINUTE STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci +root16 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root16` ON SCHEDULE EVERY '1 11:56' DAY_MINUTE STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root17 on schedule every '35:12:45' day_minute do select 1; SHOW CREATE EVENT root17; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -root17 SYSTEM CREATE EVENT `root17` ON SCHEDULE EVERY '35 12:45' DAY_MINUTE STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci +root17 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root17` ON SCHEDULE EVERY '35 12:45' DAY_MINUTE STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root17_1 on schedule every '35:25:65' day_minute do select 1; SHOW CREATE EVENT root17_1; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -root17_1 SYSTEM CREATE EVENT `root17_1` ON SCHEDULE EVERY '36 2:5' DAY_MINUTE STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci +root17_1 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root17_1` ON SCHEDULE EVERY '36 2:5' DAY_MINUTE STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root18 on schedule every '35:12:45' hour_second do select 1; SHOW CREATE EVENT root18; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -root18 SYSTEM CREATE EVENT `root18` ON SCHEDULE EVERY '35:12:45' HOUR_SECOND STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci +root18 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root18` ON SCHEDULE EVERY '35:12:45' HOUR_SECOND STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root19 on schedule every '15:59:85' hour_second do select 1; SHOW CREATE EVENT root19; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -root19 SYSTEM CREATE EVENT `root19` ON SCHEDULE EVERY '16:0:25' HOUR_SECOND STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci +root19 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root19` ON SCHEDULE EVERY '16:0:25' HOUR_SECOND STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root20 on schedule every '50:20:12:45' day_second do select 1; SHOW CREATE EVENT root20; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -root20 SYSTEM CREATE EVENT `root20` ON SCHEDULE EVERY '50 20:12:45' DAY_SECOND STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci +root20 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root20` ON SCHEDULE EVERY '50 20:12:45' DAY_SECOND STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci set names cp1251; create event ðóóò21 on schedule every '50:23:59:95' day_second COMMENT 'òîâà å 1251 êîìåíòàð' do select 1; SHOW CREATE EVENT ðóóò21; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ðóóò21 SYSTEM CREATE EVENT `руут21` ON SCHEDULE EVERY '51 0:0:35' DAY_SECOND STARTS '#' ON COMPLETION NOT PRESERVE ENABLE COMMENT 'това е 1251 коментар' DO select 1 cp1251 cp1251_general_ci latin1_swedish_ci +ðóóò21 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `руут21` ON SCHEDULE EVERY '51 0:0:35' DAY_SECOND STARTS '#' ON COMPLETION NOT PRESERVE ENABLE COMMENT 'това е 1251 коментар' DO select 1 cp1251 cp1251_general_ci latin1_swedish_ci insert into mysql.event ( db, name, @@ -271,7 +271,7 @@ event_name intact_check SHOW CREATE EVENT intact_check; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -intact_check SYSTEM CREATE EVENT `intact_check` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO SELECT "nothing" latin1 latin1_swedish_ci latin1_swedish_ci +intact_check SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `intact_check` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO SELECT "nothing" latin1 latin1_swedish_ci latin1_swedish_ci DROP EVENT no_such_event; ERROR HY000: Unknown event 'no_such_event' CREATE EVENT intact_check_1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5; diff --git a/mysql-test/r/events_2.result b/mysql-test/r/events_2.result index db503f7aa6d..44eaa668b04 100644 --- a/mysql-test/r/events_2.result +++ b/mysql-test/r/events_2.result @@ -134,7 +134,7 @@ create event e1 on schedule every 10 hour do select 1; lock table t1 read; show create event e1; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci +e1 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci select event_name from information_schema.events; event_name e1 @@ -152,7 +152,7 @@ unlock tables; lock table t1 write; show create event e1; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci +e1 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci select event_name from information_schema.events; event_name e1 @@ -170,7 +170,7 @@ unlock tables; lock table t1 read, mysql.event read; show create event e1; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci +e1 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci select event_name from information_schema.events; event_name e1 @@ -188,7 +188,7 @@ unlock tables; lock table t1 write, mysql.event read; show create event e1; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci +e1 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci select event_name from information_schema.events; event_name e1 @@ -210,7 +210,7 @@ ERROR HY000: You can't combine write-locking of system tables with other tables lock table mysql.event write; show create event e1; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci +e1 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci select event_name from information_schema.events; event_name e1 diff --git a/mysql-test/r/events_bugs.result b/mysql-test/r/events_bugs.result index 50bfa97c59f..ef881145bc9 100644 --- a/mysql-test/r/events_bugs.result +++ b/mysql-test/r/events_bugs.result @@ -77,7 +77,7 @@ set sql_mode='traditional'; alter event e_16407 do select 1; select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name; event_schema event_name sql_mode -events_test e_16407 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER +events_test e_16407 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION drop event e_16407; set sql_mode="ansi"; select get_lock('ee_16407_2', 60); @@ -114,8 +114,8 @@ insert into events_test.events_smode_test values ('ee_16407_4','10-11-1956'); end| select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name; event_schema event_name sql_mode -events_test ee_16407_2 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER -events_test ee_16407_3 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER +events_test ee_16407_2 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION +events_test ee_16407_3 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION events_test ee_16407_4 select /*2*/ user, host, db, info from information_schema.processlist where state = 'User lock' and info = 'select get_lock(\'ee_16407_2\', 60)'; @@ -138,8 +138,8 @@ ee_16407_4 0000-00-00 "OK, last check before we drop them" select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name; event_schema event_name sql_mode -events_test ee_16407_2 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER -events_test ee_16407_3 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER +events_test ee_16407_2 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION +events_test ee_16407_3 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION events_test ee_16407_4 drop event ee_16407_2; drop event ee_16407_3; @@ -185,8 +185,8 @@ ee_16407_6 2004-02-29 "And here we check one more time before we drop the events" select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name; event_schema event_name sql_mode -events_test ee_16407_5 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER -events_test ee_16407_6 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER +events_test ee_16407_5 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION +events_test ee_16407_6 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION drop event ee_16407_5; drop event ee_16407_6; drop procedure ee_16407_5_pendant; @@ -444,13 +444,13 @@ events_test e2 root@localhost -05:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NU events_test e3 root@localhost +00:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci SHOW CREATE EVENT e1; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -e1 +05:00 CREATE EVENT `e1` ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO SELECT 1 latin1 latin1_swedish_ci latin1_swedish_ci +e1 +05:00 CREATE DEFINER=`root`@`localhost` EVENT `e1` ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO SELECT 1 latin1 latin1_swedish_ci latin1_swedish_ci SHOW CREATE EVENT e2; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -e2 -05:00 CREATE EVENT `e2` ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO SELECT 1 latin1 latin1_swedish_ci latin1_swedish_ci +e2 -05:00 CREATE DEFINER=`root`@`localhost` EVENT `e2` ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO SELECT 1 latin1 latin1_swedish_ci latin1_swedish_ci SHOW CREATE EVENT e3; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -e3 +00:00 CREATE EVENT `e3` ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO SELECT 1 latin1 latin1_swedish_ci latin1_swedish_ci +e3 +00:00 CREATE DEFINER=`root`@`localhost` EVENT `e3` ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO SELECT 1 latin1 latin1_swedish_ci latin1_swedish_ci The following should fail, and nothing should be altered. ALTER EVENT e1 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00' ENDS '1999-01-02 00:00:00'; diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result index d8b8a14afc6..33ae2e0a5a4 100644 --- a/mysql-test/r/func_math.result +++ b/mysql-test/r/func_math.result @@ -382,6 +382,9 @@ y SELECT b DIV 900 y FROM t1 GROUP BY y; y 0 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'str1' +Warning 1292 Truncated incorrect INTEGER value: 'str2' SELECT c DIV 900 y FROM t1 GROUP BY y; y 0 diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index c87879e13b5..6b4a844c01b 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -1151,6 +1151,9 @@ INSERT INTO t2 VALUES (0), (1); SELECT * FROM t1, t2 WHERE num=str; str num notnumber 0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'notnumber' +Warning 1292 Truncated incorrect DOUBLE value: 'notnumber' SELECT * FROM t1, t2 WHERE num=substring(str from 1 for 6); str num notnumber 0 diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index 8c8a7dc64d2..0fe729407be 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -13,8 +13,8 @@ GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3 GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost' grant delete on mysqltest.* to mysqltest_1@localhost; select * from mysql.user where user="mysqltest_1"; -Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections -localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED EDH-RSA-DES-CBC3-SHA 0 0 0 0 +Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections +localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED EDH-RSA-DES-CBC3-SHA 0 0 0 0 show grants for mysqltest_1@localhost; Grants for mysqltest_1@localhost GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA' @@ -44,15 +44,15 @@ delete from mysql.user where user='mysqltest_1'; flush privileges; grant usage on *.* to mysqltest_1@localhost with max_queries_per_hour 10; select * from mysql.user where user="mysqltest_1"; -Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections -localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N 10 0 0 0 +Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections +localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 10 0 0 0 show grants for mysqltest_1@localhost; Grants for mysqltest_1@localhost GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10 grant usage on *.* to mysqltest_1@localhost with max_updates_per_hour 20 max_connections_per_hour 30; select * from mysql.user where user="mysqltest_1"; -Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections -localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N 10 20 30 0 +Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections +localhost mysqltest_1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 10 20 30 0 show grants for mysqltest_1@localhost; Grants for mysqltest_1@localhost GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10 MAX_UPDATES_PER_HOUR 20 MAX_CONNECTIONS_PER_HOUR 30 @@ -483,6 +483,7 @@ Show view Tables To see views with SHOW CREATE VIEW Shutdown Server Admin To shut down the server Super Server Admin To use KILL thread, SET GLOBAL, CHANGE MASTER, etc. Trigger Tables To use triggers +Create tablespace Server Admin To create/alter/drop tablespaces Update Tables To update existing rows Usage Server Admin No privileges - allow connect only create database mysqltest; @@ -1413,3 +1414,26 @@ DROP USER 'user1'; DROP USER 'user1'@'localhost'; DROP USER 'user2'; DROP DATABASE db1; +# +# Bug #25863 No database selected error, but documentation +# says * for global allowed +# +GRANT ALL ON * TO mysqltest_1; +ERROR 3D000: No database selected +GRANT ALL ON *.* TO mysqltest_1; +SHOW GRANTS FOR mysqltest_1; +Grants for mysqltest_1@% +GRANT ALL PRIVILEGES ON *.* TO 'mysqltest_1'@'%' +DROP USER mysqltest_1; +USE test; +GRANT ALL ON * TO mysqltest_1; +SHOW GRANTS FOR mysqltest_1; +Grants for mysqltest_1@% +GRANT USAGE ON *.* TO 'mysqltest_1'@'%' +GRANT ALL PRIVILEGES ON `test`.* TO 'mysqltest_1'@'%' +DROP USER mysqltest_1; +GRANT ALL ON *.* TO mysqltest_1; +SHOW GRANTS FOR mysqltest_1; +Grants for mysqltest_1@% +GRANT ALL PRIVILEGES ON *.* TO 'mysqltest_1'@'%' +DROP USER mysqltest_1; diff --git a/mysql-test/r/have_community_features.require b/mysql-test/r/have_community_features.require deleted file mode 100644 index 9233bba91e1..00000000000 --- a/mysql-test/r/have_community_features.require +++ /dev/null @@ -1,2 +0,0 @@ -Variable_name Value -have_community_features YES diff --git a/mysql-test/r/have_profiling.require b/mysql-test/r/have_profiling.require new file mode 100644 index 00000000000..453ee5bb084 --- /dev/null +++ b/mysql-test/r/have_profiling.require @@ -0,0 +1,2 @@ +Variable_name Value +have_profiling YES diff --git a/mysql-test/r/index_merge_innodb.result b/mysql-test/r/index_merge_innodb.result index 71b81d6acd2..6d130a64e35 100644 --- a/mysql-test/r/index_merge_innodb.result +++ b/mysql-test/r/index_merge_innodb.result @@ -1,329 +1,3 @@ -#---------------- Index merge test 2 ------------------------------------------- -SET SESSION STORAGE_ENGINE = InnoDB; -drop table if exists t1,t2; -create table t1 -( -key1 int not null, -key2 int not null, -INDEX i1(key1), -INDEX i2(key2) -); -explain select * from t1 where key1 < 5 or key2 > 197; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge i1,i2 i1,i2 4,4 NULL 8 Using sort_union(i1,i2); Using where -select * from t1 where key1 < 5 or key2 > 197; -key1 key2 -0 200 -1 199 -2 198 -3 197 -4 196 -explain select * from t1 where key1 < 3 or key2 > 195; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge i1,i2 i1,i2 4,4 NULL 8 Using sort_union(i1,i2); Using where -select * from t1 where key1 < 3 or key2 > 195; -key1 key2 -0 200 -1 199 -2 198 -3 197 -4 196 -alter table t1 add str1 char (255) not null, -add zeroval int not null default 0, -add str2 char (255) not null, -add str3 char (255) not null; -update t1 set str1='aaa', str2='bbb', str3=concat(key2, '-', key1 div 2, '_' ,if(key1 mod 2 = 0, 'a', 'A')); -alter table t1 add primary key (str1, zeroval, str2, str3); -explain select * from t1 where key1 < 5 or key2 > 197; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge i1,i2 i1,i2 4,4 NULL 8 Using sort_union(i1,i2); Using where -select * from t1 where key1 < 5 or key2 > 197; -key1 key2 str1 zeroval str2 str3 -4 196 aaa 0 bbb 196-2_a -3 197 aaa 0 bbb 197-1_A -2 198 aaa 0 bbb 198-1_a -1 199 aaa 0 bbb 199-0_A -0 200 aaa 0 bbb 200-0_a -explain select * from t1 where key1 < 3 or key2 > 195; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge i1,i2 i1,i2 4,4 NULL 8 Using sort_union(i1,i2); Using where -select * from t1 where key1 < 3 or key2 > 195; -key1 key2 str1 zeroval str2 str3 -4 196 aaa 0 bbb 196-2_a -3 197 aaa 0 bbb 197-1_A -2 198 aaa 0 bbb 198-1_a -1 199 aaa 0 bbb 199-0_A -0 200 aaa 0 bbb 200-0_a -drop table t1; -create table t1 ( -pk integer not null auto_increment primary key, -key1 integer, -key2 integer not null, -filler char (200), -index (key1), -index (key2) -); -show warnings; -Level Code Message -explain select pk from t1 where key1 = 1 and key2 = 1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge key1,key2 key1,key2 5,4 NULL 1 Using intersect(key1,key2); Using where; Using index -select pk from t1 where key2 = 1 and key1 = 1; -pk -26 -27 -select pk from t1 ignore index(key1,key2) where key2 = 1 and key1 = 1; -pk -26 -27 -drop table t1; -create table t1 ( -pk int primary key auto_increment, -key1a int, -key2a int, -key1b int, -key2b int, -dummy1 int, -dummy2 int, -dummy3 int, -dummy4 int, -key3a int, -key3b int, -filler1 char (200), -index i1(key1a, key1b), -index i2(key2a, key2b), -index i3(key3a, key3b) -); -create table t2 (a int); -insert into t2 values (0),(1),(2),(3),(4),(NULL); -insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b) -select A.a, B.a, C.a, D.a, C.a, D.a from t2 A,t2 B,t2 C, t2 D; -insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b) -select key1a, key1b, key2a, key2b, key3a, key3b from t1; -insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b) -select key1a, key1b, key2a, key2b, key3a, key3b from t1; -analyze table t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -select count(*) from t1; -count(*) -5184 -explain select count(*) from t1 where -key1a = 2 and key1b is null and key2a = 2 and key2b is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge i1,i2 i1,i2 10,10 NULL # Using intersect(i1,i2); Using where; Using index -select count(*) from t1 where -key1a = 2 and key1b is null and key2a = 2 and key2b is null; -count(*) -4 -explain select count(*) from t1 where -key1a = 2 and key1b is null and key3a = 2 and key3b is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge i1,i3 i1,i3 10,10 NULL # Using intersect(i1,i3); Using where; Using index -select count(*) from t1 where -key1a = 2 and key1b is null and key3a = 2 and key3b is null; -count(*) -4 -drop table t1,t2; -create table t1 ( -id1 int, -id2 date , -index idx2 (id1,id2), -index idx1 (id2) -); -insert into t1 values(1,'20040101'), (2,'20040102'); -select * from t1 where id1 = 1 and id2= '20040101'; -id1 id2 -1 2004-01-01 -drop table t1; -drop view if exists v1; -CREATE TABLE t1 ( -`oid` int(11) unsigned NOT NULL auto_increment, -`fk_bbk_niederlassung` int(11) unsigned NOT NULL, -`fk_wochentag` int(11) unsigned NOT NULL, -`uhrzeit_von` time NOT NULL COMMENT 'HH:MM', -`uhrzeit_bis` time NOT NULL COMMENT 'HH:MM', -`geloescht` tinyint(4) NOT NULL, -`version` int(5) NOT NULL, -PRIMARY KEY (`oid`), -KEY `fk_bbk_niederlassung` (`fk_bbk_niederlassung`), -KEY `fk_wochentag` (`fk_wochentag`), -KEY `ix_version` (`version`) -) DEFAULT CHARSET=latin1; -insert into t1 values -(1, 38, 1, '08:00:00', '13:00:00', 0, 1), -(2, 38, 2, '08:00:00', '13:00:00', 0, 1), -(3, 38, 3, '08:00:00', '13:00:00', 0, 1), -(4, 38, 4, '08:00:00', '13:00:00', 0, 1), -(5, 38, 5, '08:00:00', '13:00:00', 0, 1), -(6, 38, 5, '08:00:00', '13:00:00', 1, 2), -(7, 38, 3, '08:00:00', '13:00:00', 1, 2), -(8, 38, 1, '08:00:00', '13:00:00', 1, 2), -(9, 38, 2, '08:00:00', '13:00:00', 1, 2), -(10, 38, 4, '08:00:00', '13:00:00', 1, 2), -(11, 38, 1, '08:00:00', '13:00:00', 0, 3), -(12, 38, 2, '08:00:00', '13:00:00', 0, 3), -(13, 38, 3, '08:00:00', '13:00:00', 0, 3), -(14, 38, 4, '08:00:00', '13:00:00', 0, 3), -(15, 38, 5, '08:00:00', '13:00:00', 0, 3), -(16, 38, 4, '08:00:00', '13:00:00', 0, 4), -(17, 38, 5, '08:00:00', '13:00:00', 0, 4), -(18, 38, 1, '08:00:00', '13:00:00', 0, 4), -(19, 38, 2, '08:00:00', '13:00:00', 0, 4), -(20, 38, 3, '08:00:00', '13:00:00', 0, 4), -(21, 7, 1, '08:00:00', '13:00:00', 0, 1), -(22, 7, 2, '08:00:00', '13:00:00', 0, 1), -(23, 7, 3, '08:00:00', '13:00:00', 0, 1), -(24, 7, 4, '08:00:00', '13:00:00', 0, 1), -(25, 7, 5, '08:00:00', '13:00:00', 0, 1); -create view v1 as -select -zeit1.oid AS oid, -zeit1.fk_bbk_niederlassung AS fk_bbk_niederlassung, -zeit1.fk_wochentag AS fk_wochentag, -zeit1.uhrzeit_von AS uhrzeit_von, -zeit1.uhrzeit_bis AS uhrzeit_bis, -zeit1.geloescht AS geloescht, -zeit1.version AS version -from -t1 zeit1 -where -(zeit1.version = -(select max(zeit2.version) AS `max(version)` - from t1 zeit2 -where -((zeit1.fk_bbk_niederlassung = zeit2.fk_bbk_niederlassung) and -(zeit1.fk_wochentag = zeit2.fk_wochentag) and -(zeit1.uhrzeit_von = zeit2.uhrzeit_von) and -(zeit1.uhrzeit_bis = zeit2.uhrzeit_bis) -) -) -) -and (zeit1.geloescht = 0); -select * from v1 where oid = 21; -oid fk_bbk_niederlassung fk_wochentag uhrzeit_von uhrzeit_bis geloescht version -21 7 1 08:00:00 13:00:00 0 1 -drop view v1; -drop table t1; -CREATE TABLE t1( -t_cpac varchar(2) NOT NULL, -t_vers varchar(4) NOT NULL, -t_rele varchar(2) NOT NULL, -t_cust varchar(4) NOT NULL, -filler1 char(250) default NULL, -filler2 char(250) default NULL, -PRIMARY KEY (t_cpac,t_vers,t_rele,t_cust), -UNIQUE KEY IX_4 (t_cust,t_cpac,t_vers,t_rele), -KEY IX_5 (t_vers,t_rele,t_cust) -); -insert into t1 values -('tm','2.5 ','a ',' ','',''), ('tm','2.5U','a ','stnd','',''), -('da','3.3 ','b ',' ','',''), ('da','3.3U','b ','stnd','',''), -('tl','7.6 ','a ',' ','',''), ('tt','7.6 ','a ',' ','',''), -('bc','B61 ','a ',' ','',''), ('bp','B61 ','a ',' ','',''), -('ca','B61 ','a ',' ','',''), ('ci','B61 ','a ',' ','',''), -('cp','B61 ','a ',' ','',''), ('dm','B61 ','a ',' ','',''), -('ec','B61 ','a ',' ','',''), ('ed','B61 ','a ',' ','',''), -('fm','B61 ','a ',' ','',''), ('nt','B61 ','a ',' ','',''), -('qm','B61 ','a ',' ','',''), ('tc','B61 ','a ',' ','',''), -('td','B61 ','a ',' ','',''), ('tf','B61 ','a ',' ','',''), -('tg','B61 ','a ',' ','',''), ('ti','B61 ','a ',' ','',''), -('tp','B61 ','a ',' ','',''), ('ts','B61 ','a ',' ','',''), -('wh','B61 ','a ',' ','',''), ('bc','B61U','a ','stnd','',''), -('bp','B61U','a ','stnd','',''), ('ca','B61U','a ','stnd','',''), -('ci','B61U','a ','stnd','',''), ('cp','B61U','a ','stnd','',''), -('dm','B61U','a ','stnd','',''), ('ec','B61U','a ','stnd','',''), -('fm','B61U','a ','stnd','',''), ('nt','B61U','a ','stnd','',''), -('qm','B61U','a ','stnd','',''), ('tc','B61U','a ','stnd','',''), -('td','B61U','a ','stnd','',''), ('tf','B61U','a ','stnd','',''), -('tg','B61U','a ','stnd','',''), ('ti','B61U','a ','stnd','',''), -('tp','B61U','a ','stnd','',''), ('ts','B61U','a ','stnd','',''), -('wh','B61U','a ','stnd','',''); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `t_cpac` varchar(2) NOT NULL, - `t_vers` varchar(4) NOT NULL, - `t_rele` varchar(2) NOT NULL, - `t_cust` varchar(4) NOT NULL, - `filler1` char(250) DEFAULT NULL, - `filler2` char(250) DEFAULT NULL, - PRIMARY KEY (`t_cpac`,`t_vers`,`t_rele`,`t_cust`), - UNIQUE KEY `IX_4` (`t_cust`,`t_cpac`,`t_vers`,`t_rele`), - KEY `IX_5` (`t_vers`,`t_rele`,`t_cust`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -select t_vers,t_rele,t_cust,filler1 from t1 where t_vers = '7.6'; -t_vers t_rele t_cust filler1 -7.6 a -7.6 a -select t_vers,t_rele,t_cust,filler1 from t1 where t_vers = '7.6' - and t_rele='a' and t_cust = ' '; -t_vers t_rele t_cust filler1 -7.6 a -7.6 a -drop table t1; -create table t1 ( -pk int(11) not null auto_increment, -a int(11) not null default '0', -b int(11) not null default '0', -c int(11) not null default '0', -filler1 datetime, filler2 varchar(15), -filler3 longtext, -kp1 varchar(4), kp2 varchar(7), -kp3 varchar(2), kp4 varchar(4), -kp5 varchar(7), -filler4 char(1), -primary key (pk), -key idx1(a,b,c), -key idx2(c), -key idx3(kp1,kp2,kp3,kp4,kp5) -) default charset=latin1; -set @fill=NULL; -SELECT COUNT(*) FROM t1 WHERE b = 0 AND a = 0 AND c = 13286427 AND -kp1='279' AND kp2='ELM0678' AND kp3='6' AND kp4='10' AND kp5 = 'R '; -COUNT(*) -1 -drop table t1; -create table t1 -( -key1 int not null, -key2 int not null default 0, -key3 int not null default 0 -); -insert into t1(key1) values (1),(2),(3),(4),(5),(6),(7),(8); -set @d=8; -insert into t1 (key1) select key1+@d from t1; -set @d=@d*2; -insert into t1 (key1) select key1+@d from t1; -set @d=@d*2; -insert into t1 (key1) select key1+@d from t1; -set @d=@d*2; -insert into t1 (key1) select key1+@d from t1; -set @d=@d*2; -insert into t1 (key1) select key1+@d from t1; -set @d=@d*2; -insert into t1 (key1) select key1+@d from t1; -set @d=@d*2; -insert into t1 (key1) select key1+@d from t1; -set @d=@d*2; -alter table t1 add index i2(key2); -alter table t1 add index i3(key3); -update t1 set key2=key1,key3=key1; -explain select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40); -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge i2,i3 i3,i2 4,4 NULL 9 Using sort_union(i3,i2); Using where -select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40); -key1 key2 key3 -31 31 31 -32 32 32 -33 33 33 -34 34 34 -35 35 35 -36 36 36 -37 37 37 -38 38 38 -39 39 39 -drop table t1; #---------------- 2-sweeps read Index merge test 2 ------------------------------- SET SESSION STORAGE_ENGINE = InnoDB; drop table if exists t1; diff --git a/mysql-test/r/information_schema-big.result b/mysql-test/r/information_schema-big.result new file mode 100644 index 00000000000..248b8d606dc --- /dev/null +++ b/mysql-test/r/information_schema-big.result @@ -0,0 +1,93 @@ +DROP TABLE IF EXISTS t0,t1,t2,t3,t4,t5; +DROP VIEW IF EXISTS v1; +# +# Bug#18925: subqueries with MIN/MAX functions on INFORMARTION_SCHEMA +# +SELECT t.table_name, c1.column_name +FROM information_schema.tables t +INNER JOIN +information_schema.columns c1 +ON t.table_schema = c1.table_schema AND +t.table_name = c1.table_name +WHERE t.table_schema = 'information_schema' AND +c1.ordinal_position = +( SELECT COALESCE(MIN(c2.ordinal_position),1) +FROM information_schema.columns c2 +WHERE c2.table_schema = t.table_schema AND +c2.table_name = t.table_name AND +c2.column_name LIKE '%SCHEMA%' + ) +AND t.table_name NOT LIKE 'innodb%'; +table_name column_name +CHARACTER_SETS CHARACTER_SET_NAME +COLLATIONS COLLATION_NAME +COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME +COLUMNS TABLE_SCHEMA +COLUMN_PRIVILEGES TABLE_SCHEMA +ENGINES ENGINE +EVENTS EVENT_SCHEMA +FILES TABLE_SCHEMA +GLOBAL_STATUS VARIABLE_NAME +GLOBAL_VARIABLES VARIABLE_NAME +KEY_COLUMN_USAGE CONSTRAINT_SCHEMA +PARTITIONS TABLE_SCHEMA +PLUGINS PLUGIN_NAME +PROCESSLIST ID +PROFILING QUERY_ID +REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA +ROUTINES ROUTINE_SCHEMA +SCHEMATA SCHEMA_NAME +SCHEMA_PRIVILEGES TABLE_SCHEMA +SESSION_STATUS VARIABLE_NAME +SESSION_VARIABLES VARIABLE_NAME +STATISTICS TABLE_SCHEMA +TABLES TABLE_SCHEMA +TABLE_CONSTRAINTS CONSTRAINT_SCHEMA +TABLE_PRIVILEGES TABLE_SCHEMA +TRIGGERS TRIGGER_SCHEMA +USER_PRIVILEGES GRANTEE +VIEWS TABLE_SCHEMA +SELECT t.table_name, c1.column_name +FROM information_schema.tables t +INNER JOIN +information_schema.columns c1 +ON t.table_schema = c1.table_schema AND +t.table_name = c1.table_name +WHERE t.table_schema = 'information_schema' AND +c1.ordinal_position = +( SELECT COALESCE(MIN(c2.ordinal_position),1) +FROM information_schema.columns c2 +WHERE c2.table_schema = 'information_schema' AND +c2.table_name = t.table_name AND +c2.column_name LIKE '%SCHEMA%' + ) +AND t.table_name NOT LIKE 'innodb%'; +table_name column_name +CHARACTER_SETS CHARACTER_SET_NAME +COLLATIONS COLLATION_NAME +COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME +COLUMNS TABLE_SCHEMA +COLUMN_PRIVILEGES TABLE_SCHEMA +ENGINES ENGINE +EVENTS EVENT_SCHEMA +FILES TABLE_SCHEMA +GLOBAL_STATUS VARIABLE_NAME +GLOBAL_VARIABLES VARIABLE_NAME +KEY_COLUMN_USAGE CONSTRAINT_SCHEMA +PARTITIONS TABLE_SCHEMA +PLUGINS PLUGIN_NAME +PROCESSLIST ID +PROFILING QUERY_ID +REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA +ROUTINES ROUTINE_SCHEMA +SCHEMATA SCHEMA_NAME +SCHEMA_PRIVILEGES TABLE_SCHEMA +SESSION_STATUS VARIABLE_NAME +SESSION_VARIABLES VARIABLE_NAME +STATISTICS TABLE_SCHEMA +TABLES TABLE_SCHEMA +TABLE_CONSTRAINTS CONSTRAINT_SCHEMA +TABLE_PRIVILEGES TABLE_SCHEMA +TRIGGERS TRIGGER_SCHEMA +USER_PRIVILEGES GRANTEE +VIEWS TABLE_SCHEMA diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index ffa9b596d2f..a4ea6aa229b 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -592,7 +592,7 @@ proc definer char(77) proc created timestamp proc modified timestamp proc sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') -proc comment char(64) +proc comment text proc character_set_client char(32) proc collation_connection char(32) proc db_collation char(32) @@ -771,6 +771,7 @@ information_schema PARTITIONS PARTITION_DESCRIPTION information_schema PLUGINS PLUGIN_DESCRIPTION information_schema PROCESSLIST INFO information_schema ROUTINES ROUTINE_DEFINITION +information_schema ROUTINES ROUTINE_COMMENT information_schema TRIGGERS ACTION_CONDITION information_schema TRIGGERS ACTION_STATEMENT information_schema VIEWS VIEW_DEFINITION @@ -1226,94 +1227,6 @@ f1() DROP FUNCTION f1; DROP PROCEDURE p1; DROP USER mysql_bug20230@localhost; -SELECT t.table_name, c1.column_name -FROM information_schema.tables t -INNER JOIN -information_schema.columns c1 -ON t.table_schema = c1.table_schema AND -t.table_name = c1.table_name -WHERE t.table_schema = 'information_schema' AND -c1.ordinal_position = -( SELECT COALESCE(MIN(c2.ordinal_position),1) -FROM information_schema.columns c2 -WHERE c2.table_schema = t.table_schema AND -c2.table_name = t.table_name AND -c2.column_name LIKE '%SCHEMA%' - ) -AND t.table_name not like 'innodb_%'; -table_name column_name -CHARACTER_SETS CHARACTER_SET_NAME -COLLATIONS COLLATION_NAME -COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME -COLUMNS TABLE_SCHEMA -COLUMN_PRIVILEGES TABLE_SCHEMA -ENGINES ENGINE -EVENTS EVENT_SCHEMA -FILES TABLE_SCHEMA -GLOBAL_STATUS VARIABLE_NAME -GLOBAL_VARIABLES VARIABLE_NAME -KEY_COLUMN_USAGE CONSTRAINT_SCHEMA -PARTITIONS TABLE_SCHEMA -PLUGINS PLUGIN_NAME -PROCESSLIST ID -PROFILING QUERY_ID -REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA -ROUTINES ROUTINE_SCHEMA -SCHEMATA SCHEMA_NAME -SCHEMA_PRIVILEGES TABLE_SCHEMA -SESSION_STATUS VARIABLE_NAME -SESSION_VARIABLES VARIABLE_NAME -STATISTICS TABLE_SCHEMA -TABLES TABLE_SCHEMA -TABLE_CONSTRAINTS CONSTRAINT_SCHEMA -TABLE_PRIVILEGES TABLE_SCHEMA -TRIGGERS TRIGGER_SCHEMA -USER_PRIVILEGES GRANTEE -VIEWS TABLE_SCHEMA -SELECT t.table_name, c1.column_name -FROM information_schema.tables t -INNER JOIN -information_schema.columns c1 -ON t.table_schema = c1.table_schema AND -t.table_name = c1.table_name -WHERE t.table_schema = 'information_schema' AND -c1.ordinal_position = -( SELECT COALESCE(MIN(c2.ordinal_position),1) -FROM information_schema.columns c2 -WHERE c2.table_schema = 'information_schema' AND -c2.table_name = t.table_name AND -c2.column_name LIKE '%SCHEMA%' - ) -AND t.table_name not like 'innodb_%'; -table_name column_name -CHARACTER_SETS CHARACTER_SET_NAME -COLLATIONS COLLATION_NAME -COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME -COLUMNS TABLE_SCHEMA -COLUMN_PRIVILEGES TABLE_SCHEMA -ENGINES ENGINE -EVENTS EVENT_SCHEMA -FILES TABLE_SCHEMA -GLOBAL_STATUS VARIABLE_NAME -GLOBAL_VARIABLES VARIABLE_NAME -KEY_COLUMN_USAGE CONSTRAINT_SCHEMA -PARTITIONS TABLE_SCHEMA -PLUGINS PLUGIN_NAME -PROCESSLIST ID -PROFILING QUERY_ID -REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA -ROUTINES ROUTINE_SCHEMA -SCHEMATA SCHEMA_NAME -SCHEMA_PRIVILEGES TABLE_SCHEMA -SESSION_STATUS VARIABLE_NAME -SESSION_VARIABLES VARIABLE_NAME -STATISTICS TABLE_SCHEMA -TABLES TABLE_SCHEMA -TABLE_CONSTRAINTS CONSTRAINT_SCHEMA -TABLE_PRIVILEGES TABLE_SCHEMA -TRIGGERS TRIGGER_SCHEMA -USER_PRIVILEGES GRANTEE -VIEWS TABLE_SCHEMA SELECT MAX(table_name) FROM information_schema.tables WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test'); MAX(table_name) VIEWS diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result index 3ff5f04b6c6..6283c03ed91 100644 --- a/mysql-test/r/innodb_mysql.result +++ b/mysql-test/r/innodb_mysql.result @@ -2209,3 +2209,23 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL PRIMARY 4 NULL 128 Using where DROP TABLE t1; End of 5.1 tests +# +# Test for bug #39932 "create table fails if column for FK is in different +# case than in corr index". +# +drop tables if exists t1, t2; +create table t1 (pk int primary key) engine=InnoDB; +# Even although the below statement uses uppercased field names in +# foreign key definition it still should be able to find explicitly +# created supporting index. So it should succeed and should not +# create any additional supporting indexes. +create table t2 (fk int, key x (fk), +constraint x foreign key (FK) references t1 (PK)) engine=InnoDB; +show create table t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `fk` int(11) DEFAULT NULL, + KEY `x` (`fk`), + CONSTRAINT `x` FOREIGN KEY (`fk`) REFERENCES `t1` (`pk`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +drop table t2, t1; diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result index 3f91039d592..f5ad7aee4a9 100644 --- a/mysql-test/r/insert.result +++ b/mysql-test/r/insert.result @@ -639,3 +639,43 @@ CREATE TABLE t2(f1 CHAR(1)); INSERT INTO t2 SELECT f1 FROM t1; DROP TABLE t1, t2; End of 5.0 tests. +# +# Bug#34898 "mysql_info() reports 0 warnings while +# mysql_warning_count() reports 1" +# Check that the number of warnings reported by +# mysql_info() is correct. +# +drop table if exists t1; +create table t1 (data varchar(4) not null); +set sql_mode='error_for_division_by_zero'; +# +# Demonstrate that the number of warnings matches +# the information in mysql_info(). +# +insert t1 (data) values ('letter'), (1/0); +affected rows: 2 +info: Records: 2 Duplicates: 0 Warnings: 3 +Warnings: +Warning 1265 Data truncated for column 'data' at row 1 +Warning 1365 Division by 0 +Warning 1048 Column 'data' cannot be null +update t1 set data='envelope' where 1/0 or 1; +affected rows: 2 +info: Rows matched: 2 Changed: 2 Warnings: 3 +Warnings: +Warning 1365 Division by 0 +Warning 1265 Data truncated for column 'data' at row 1 +Warning 1265 Data truncated for column 'data' at row 2 +insert t1 (data) values (default), (1/0), ('dead beef'); +affected rows: 3 +info: Records: 3 Duplicates: 0 Warnings: 4 +Warnings: +Warning 1364 Field 'data' doesn't have a default value +Warning 1365 Division by 0 +Warning 1048 Column 'data' cannot be null +Warning 1265 Data truncated for column 'data' at row 3 +set sql_mode=default; +drop table t1; +# +# End of 5.4 tests +# diff --git a/mysql-test/r/log_state.result b/mysql-test/r/log_state.result index 5c3e3d789a1..56e30ac59f8 100644 --- a/mysql-test/r/log_state.result +++ b/mysql-test/r/log_state.result @@ -309,6 +309,30 @@ SET @@global.general_log_file = @old_general_log_file; SET @@global.slow_query_log = @old_slow_query_log; SET @@global.slow_query_log_file = @old_slow_query_log_file; End of 5.1 tests + +# -- +# -- Bug#38124: "general_log_file" variable silently unset when +# -- using expression +# -- +SET GLOBAL general_log_file = DEFAULT; +SELECT @@general_log_file INTO @my_glf; +SET GLOBAL general_log_file = 'BUG38124.LOG'; +SELECT @@general_log_file; +@@general_log_file +BUG38124.LOG +SET GLOBAL general_log_file = concat('BUG38124-2.LOG'); +SELECT @@general_log_file; +@@general_log_file +BUG38124-2.LOG +SET GLOBAL general_log_file = substr('BUG38124-2.LOG',3,6); +SELECT @@general_log_file; +@@general_log_file +G38124 +SET GLOBAL general_log_file = DEFAULT; +SELECT @@general_log_file = @my_glf; +@@general_log_file = @my_glf +1 +SET GLOBAL general_log_file = @old_general_log_file; # Close connection con1 SET global general_log = @old_general_log; SET global general_log_file = @old_general_log_file; diff --git a/mysql-test/r/log_state_bug33693.result b/mysql-test/r/log_state_bug33693.result new file mode 100644 index 00000000000..abf20fc7aa7 --- /dev/null +++ b/mysql-test/r/log_state_bug33693.result @@ -0,0 +1,3 @@ +SELECT INSTR(@@general_log_file, 'MYSQLTEST_VARDIR/run');; +INSTR(@@general_log_file, 'MYSQLTEST_VARDIR/run') +0 diff --git a/mysql-test/r/lowercase_table2.result b/mysql-test/r/lowercase_table2.result index 51c2ac0faf5..cf87fd1b5a4 100644 --- a/mysql-test/r/lowercase_table2.result +++ b/mysql-test/r/lowercase_table2.result @@ -174,3 +174,74 @@ TABLE_SCHEMA TABLE_NAME mysqltest_LC2 myUC use test; drop database mysqltest_LC2; +# End of 5.1 tests +# +# Test for bug #44738 "fill_schema_table_from_frm() opens tables without +# lowercasing table name". Due to not properly normalizing table names +# in lower_case_table_names modes in this function queries to I_S which +# were executed through it left entries with incorrect key in table +# definition cache. As result further queries to I_S that used this +# function produced stale results in cases when table definition was +# changed by a DDL statement. Also combination of this issue and a +# similar problem in CREATE TABLE (it also has peeked into table +# definition cache using non-normalized key) led to spurious +# ER_TABLE_EXISTS_ERROR errors when one tried to create table with the +# same name as a previously existing but dropped table. +# +drop database if exists mysqltest_UPPERCASE; +drop table if exists t_bug44738_UPPERCASE; +create database mysqltest_UPPERCASE; +use mysqltest_UPPERCASE; +create table t_bug44738_UPPERCASE (i int) comment='Old comment'; +create table t_bug44738_lowercase (i int) comment='Old comment'; +select table_schema, table_name, table_comment from information_schema.tables +where table_schema like 'mysqltest_%' and table_name like 't_bug44738_%' + order by table_name; +table_schema table_name table_comment +mysqltest_UPPERCASE t_bug44738_lowercase Old comment +mysqltest_UPPERCASE t_bug44738_UPPERCASE Old comment +alter table t_bug44738_UPPERCASE comment='New comment'; +alter table t_bug44738_lowercase comment='New comment'; +# There should be no stale entries in TDC for our tables after the +# above ALTER TABLE statements so new version of comments should be +# returned by the below query to I_S. +select table_schema, table_name, table_comment from information_schema.tables +where table_schema like 'mysqltest_%' and table_name like 't_bug44738_%' + order by table_name; +table_schema table_name table_comment +mysqltest_UPPERCASE t_bug44738_lowercase New comment +mysqltest_UPPERCASE t_bug44738_UPPERCASE New comment +drop database mysqltest_UPPERCASE; +use test; +# Let us check that the original test case which led to discovery +# of this problem also works. +create table t_bug44738_UPPERCASE (i int); +select table_schema, table_name, table_comment from information_schema.tables +where table_schema = 'test' and table_name like 't_bug44738_%'; +table_schema table_name table_comment +test t_bug44738_UPPERCASE +drop table t_bug44738_UPPERCASE; +# After the above DROP TABLE there are no entries in TDC which correspond +# to our table and therefore the below statement should succeed. +create table t_bug44738_UPPERCASE (i int); +drop table t_bug44738_UPPERCASE; +# Finally, let us check that another issue which was exposed by +# the original test case is solved. I.e. that fuse in CREATE TABLE +# which ensures that table is not created if there is an entry for +# it in TDC even though it was removed from disk uses normalized +# version of the table name. +create table t_bug44738_UPPERCASE (i int) engine = myisam; +# Load table definition in TDC. +select table_schema, table_name, table_comment from information_schema.tables +where table_schema = 'test' and table_name like 't_bug44738_%'; +table_schema table_name table_comment +test t_bug44738_UPPERCASE +# Simulate manual removal of the table. +# After manual removal of table still there should be an entry for table +# in TDC so attempt to create table with the same name should fail. +create table t_bug44738_UPPERCASE (i int); +ERROR 42S01: Table 't_bug44738_uppercase' already exists +# And should succeed after FLUSH TABLES. +flush tables; +create table t_bug44738_UPPERCASE (i int); +drop table t_bug44738_UPPERCASE; diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index a2248d3d878..b205e2a4c35 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -2220,3 +2220,39 @@ tr1 CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER INSERT ON t3 FOR EACH R DROP TRIGGER tr1; DROP TABLE t1, t2, t3; End of 5.1 tests +# +# An additional test case for Bug#27430 Crash in subquery code +# when in PS and table DDL changed after PREPARE +# +# Test merge table with too many merge children. +# +drop table if exists t_parent; +set @save_table_definition_cache=@@global.table_definition_cache; +# +# Set @@global.table_definition_cache to minimum +# +set @@global.table_definition_cache=400; +set @a=null; +# +# Create 400 merge children +# +set @a=concat("create table t_parent (a int) union(", @a, +") insert_method=first engine=mrg_myisam"); +prepare stmt from @a; +execute stmt; +prepare stmt from "select * from t_parent"; +execute stmt; +ERROR HY000: Prepared statement needs to be re-prepared +execute stmt; +ERROR HY000: Prepared statement needs to be re-prepared +execute stmt; +ERROR HY000: Prepared statement needs to be re-prepared +deallocate prepare stmt; +# +# Create merge parent +# +# +# Cleanup +# +drop table t_parent; +set @@global.table_definition_cache=@save_table_definition_cache; diff --git a/mysql-test/r/metadata.result b/mysql-test/r/metadata.result index 6b498e55d85..58dd97ee9f3 100644 --- a/mysql-test/r/metadata.result +++ b/mysql-test/r/metadata.result @@ -2,7 +2,7 @@ drop table if exists t1,t2; select 1, 1.0, -1, "hello", NULL; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def 1 8 1 1 N 32897 0 63 -def 1.0 246 4 3 N 129 1 63 +def 1.0 246 4 3 N 32897 1 63 def -1 8 2 2 N 32897 0 63 def hello 253 5 5 N 1 31 8 def NULL 6 0 0 Y 32896 0 63 @@ -18,7 +18,7 @@ def test t1 t1 d d 3 11 0 Y 32768 0 63 def test t1 t1 e e 8 20 0 Y 32768 0 63 def test t1 t1 f f 4 3 0 Y 32768 2 63 def test t1 t1 g g 5 4 0 Y 32768 3 63 -def test t1 t1 h h 246 7 0 Y 0 4 63 +def test t1 t1 h h 246 7 0 Y 32768 4 63 def test t1 t1 i i 13 4 0 Y 32864 0 63 def test t1 t1 j j 10 10 0 Y 128 0 63 def test t1 t1 k k 7 19 0 N 9441 0 63 @@ -199,3 +199,95 @@ def IFNULL(d, d) IFNULL(d, d) 10 10 10 Y 128 0 63 def LEAST(d, d) LEAST(d, d) 10 10 10 Y 128 0 63 DROP TABLE t1; End of 5.0 tests +create table t1( +# numeric types +bool_col bool, +boolean_col boolean, +bit_col bit(5), +tiny tinyint, +tiny_uns tinyint unsigned, +small smallint, +small_uns smallint unsigned, +medium mediumint, +medium_uns mediumint unsigned, +int_col int, +int_col_uns int unsigned, +big bigint, +big_uns bigint unsigned, +decimal_col decimal(10,5), +# synonyms of DECIMAL +numeric_col numeric(10), +fixed_col fixed(10), +dec_col dec(10), +decimal_col_uns decimal(10,5) unsigned, +fcol float, +fcol_uns float unsigned, +dcol double, +double_precision_col double precision, +dcol_uns double unsigned, +# date/time types +date_col date, +time_col time, +timestamp_col timestamp, +year_col year, +datetime_col datetime, +# string types +char_col char(5), +varchar_col varchar(10), +binary_col binary(10), +varbinary_col varbinary(10), +tinyblob_col tinyblob, +blob_col blob, +mediumblob_col mediumblob, +longblob_col longblob, +text_col text, +mediumtext_col mediumtext, +longtext_col longtext, +enum_col enum("A","B","C"), +set_col set("F","E","D") +); +select * from t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 bool_col bool_col 1 1 0 Y 32768 0 63 +def test t1 t1 boolean_col boolean_col 1 1 0 Y 32768 0 63 +def test t1 t1 bit_col bit_col 16 5 0 Y 32 0 63 +def test t1 t1 tiny tiny 1 4 0 Y 32768 0 63 +def test t1 t1 tiny_uns tiny_uns 1 3 0 Y 32800 0 63 +def test t1 t1 small small 2 6 0 Y 32768 0 63 +def test t1 t1 small_uns small_uns 2 5 0 Y 32800 0 63 +def test t1 t1 medium medium 9 9 0 Y 32768 0 63 +def test t1 t1 medium_uns medium_uns 9 8 0 Y 32800 0 63 +def test t1 t1 int_col int_col 3 11 0 Y 32768 0 63 +def test t1 t1 int_col_uns int_col_uns 3 10 0 Y 32800 0 63 +def test t1 t1 big big 8 20 0 Y 32768 0 63 +def test t1 t1 big_uns big_uns 8 20 0 Y 32800 0 63 +def test t1 t1 decimal_col decimal_col 246 12 0 Y 32768 5 63 +def test t1 t1 numeric_col numeric_col 246 11 0 Y 32768 0 63 +def test t1 t1 fixed_col fixed_col 246 11 0 Y 32768 0 63 +def test t1 t1 dec_col dec_col 246 11 0 Y 32768 0 63 +def test t1 t1 decimal_col_uns decimal_col_uns 246 11 0 Y 32800 5 63 +def test t1 t1 fcol fcol 4 12 0 Y 32768 31 63 +def test t1 t1 fcol_uns fcol_uns 4 12 0 Y 32800 31 63 +def test t1 t1 dcol dcol 5 22 0 Y 32768 31 63 +def test t1 t1 double_precision_col double_precision_col 5 22 0 Y 32768 31 63 +def test t1 t1 dcol_uns dcol_uns 5 22 0 Y 32800 31 63 +def test t1 t1 date_col date_col 10 10 0 Y 128 0 63 +def test t1 t1 time_col time_col 11 8 0 Y 128 0 63 +def test t1 t1 timestamp_col timestamp_col 7 19 0 N 9441 0 63 +def test t1 t1 year_col year_col 13 4 0 Y 32864 0 63 +def test t1 t1 datetime_col datetime_col 12 19 0 Y 128 0 63 +def test t1 t1 char_col char_col 254 5 0 Y 0 0 8 +def test t1 t1 varchar_col varchar_col 253 10 0 Y 0 0 8 +def test t1 t1 binary_col binary_col 254 10 0 Y 128 0 63 +def test t1 t1 varbinary_col varbinary_col 253 10 0 Y 128 0 63 +def test t1 t1 tinyblob_col tinyblob_col 252 255 0 Y 144 0 63 +def test t1 t1 blob_col blob_col 252 65535 0 Y 144 0 63 +def test t1 t1 mediumblob_col mediumblob_col 252 16777215 0 Y 144 0 63 +def test t1 t1 longblob_col longblob_col 252 4294967295 0 Y 144 0 63 +def test t1 t1 text_col text_col 252 65535 0 Y 16 0 8 +def test t1 t1 mediumtext_col mediumtext_col 252 16777215 0 Y 16 0 8 +def test t1 t1 longtext_col longtext_col 252 4294967295 0 Y 16 0 8 +def test t1 t1 enum_col enum_col 254 1 0 Y 256 0 8 +def test t1 t1 set_col set_col 254 5 0 Y 2048 0 8 +bool_col boolean_col bit_col tiny tiny_uns small small_uns medium medium_uns int_col int_col_uns big big_uns decimal_col numeric_col fixed_col dec_col decimal_col_uns fcol fcol_uns dcol double_precision_col dcol_uns date_col time_col timestamp_col year_col datetime_col char_col varchar_col binary_col varbinary_col tinyblob_col blob_col mediumblob_col longblob_col text_col mediumtext_col longtext_col enum_col set_col +drop table t1; diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 8162e1aca05..7c030e4a038 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -40,7 +40,7 @@ CREATE TABLE `t1` ( `a` decimal(64,20) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -INSERT INTO `t1` VALUES ('1234567890123456789012345678901234567890.00000000000000000000'),('987654321098765432109876543210987654321.00000000000000000000'); +INSERT INTO `t1` VALUES (1234567890123456789012345678901234567890.00000000000000000000),(987654321098765432109876543210987654321.00000000000000000000); DROP TABLE t1; # # Bug#2055 mysqldump should replace "-inf" numeric field values with "NULL" @@ -77,7 +77,7 @@ CREATE TABLE `t1` ( `b` float DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456); +INSERT INTO `t1` VALUES (1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456); /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `t1` ( @@ -85,7 +85,7 @@ CREATE TABLE `t1` ( `b` float DEFAULT NULL ); /*!40101 SET character_set_client = @saved_cs_client */; -INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456); +INSERT INTO `t1` VALUES (1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456); /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -108,7 +108,7 @@ CREATE TABLE `t1` ( LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; -INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456); +INSERT INTO `t1` VALUES (1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456); /*!40000 ALTER TABLE `t1` ENABLE KEYS */; UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -135,7 +135,7 @@ CREATE TABLE `t1` ( ); /*!40101 SET character_set_client = @saved_cs_client */; -INSERT INTO `t1` VALUES ('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456),('1.23450',2.3456); +INSERT INTO `t1` VALUES (1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456); /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -2391,7 +2391,7 @@ trg3 UPDATE t1 begin if new.a = -1 then set @fired:= "Yes"; end if; -end AFTER 0000-00-00 00:00:00 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +end AFTER 0000-00-00 00:00:00 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci INSERT INTO t1 (a) VALUES (1),(2),(3),(22); update t1 set a = 4 where a=3; @@ -2468,7 +2468,7 @@ DELIMITER ; /*!50003 SET character_set_results = latin1 */ ; /*!50003 SET collation_connection = latin1_swedish_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER' */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 trigger trg3 after update on t1 for each row begin @@ -2500,7 +2500,7 @@ UNLOCK TABLES; /*!50003 SET character_set_results = latin1 */ ; /*!50003 SET collation_connection = latin1_swedish_ci */ ; /*!50003 SET @saved_sql_mode = @@sql_mode */ ; -/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER' */ ; +/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 trigger trg4 before insert on t2 for each row begin @@ -2594,12 +2594,12 @@ trg3 UPDATE t1 begin if new.a = -1 then set @fired:= "Yes"; end if; -end AFTER # STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +end AFTER # STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci trg4 INSERT t2 begin if new.a > 10 then set @fired:= "No"; end if; -end BEFORE # STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +end BEFORE # STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION root@localhost latin1 latin1_swedish_ci latin1_swedish_ci DROP TABLE t1, t2; # # Bug#9136 my_print_defaults changed behaviour between 4.1.7 and 4.1.10a @@ -4223,7 +4223,7 @@ Db Name Definer Time zone Type Execute at Interval value Interval field Starts E first ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci show create event ee1; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ee1 UTC CREATE EVENT `ee1` ON SCHEDULE AT '2035-12-31 20:01:23' ON COMPLETION NOT PRESERVE ENABLE DO set @a=5 latin1 latin1_swedish_ci latin1_swedish_ci +ee1 UTC CREATE DEFINER=`root`@`localhost` EVENT `ee1` ON SCHEDULE AT '2035-12-31 20:01:23' ON COMPLETION NOT PRESERVE ENABLE DO set @a=5 latin1 latin1_swedish_ci latin1_swedish_ci drop database first; create database second; use second; @@ -4232,7 +4232,7 @@ Db Name Definer Time zone Type Execute at Interval value Interval field Starts E second ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci show create event ee1; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ee1 UTC CREATE EVENT `ee1` ON SCHEDULE AT '2035-12-31 20:01:23' ON COMPLETION NOT PRESERVE ENABLE DO set @a=5 latin1 latin1_swedish_ci latin1_swedish_ci +ee1 UTC CREATE DEFINER=`root`@`localhost` EVENT `ee1` ON SCHEDULE AT '2035-12-31 20:01:23' ON COMPLETION NOT PRESERVE ENABLE DO set @a=5 latin1 latin1_swedish_ci latin1_swedish_ci create event ee2 on schedule at '2018-12-31 21:01:23' do set @a=5; create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5; show events; diff --git a/mysql-test/r/partition_hash.result b/mysql-test/r/partition_hash.result index 19da70db5a0..dcefd70ff43 100644 --- a/mysql-test/r/partition_hash.result +++ b/mysql-test/r/partition_hash.result @@ -93,7 +93,7 @@ id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 Using where explain partitions select * from t1 where a >= 1 and a <= 5; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 p0,p1,p2,p3 ALL NULL NULL NULL NULL 9 Using where +1 SIMPLE t1 p0,p1,p2 ALL NULL NULL NULL NULL 9 Using where drop table t1; CREATE TABLE t1 ( a int not null, diff --git a/mysql-test/r/partition_pruning.result b/mysql-test/r/partition_pruning.result index 769d499fc0a..d8bff2cbe01 100644 --- a/mysql-test/r/partition_pruning.result +++ b/mysql-test/r/partition_pruning.result @@ -2229,3 +2229,22 @@ explain partitions select * from t1 where recdate < '2006-01-01 00:00:00'; id select_type table partitions type possible_keys key key_len ref rows Extra 1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 2 Using where drop table t1; +# +# BUG#33730 Full table scan instead selected partitions for query more than 10 partitions +# +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 (a int) +partition by range(a+0) ( +partition p0 values less than (64), +partition p1 values less than (128), +partition p2 values less than (255) +); +insert into t1 select A.a + 10*B.a from t0 A, t0 B; +explain partitions select * from t1 where a between 10 and 13; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0 ALL NULL NULL NULL NULL 64 Using where +explain partitions select * from t1 where a between 10 and 10+33; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0,p1,p2 ALL NULL NULL NULL NULL 100 Using where +drop table t0, t1; diff --git a/mysql-test/r/profiling.result b/mysql-test/r/profiling.result index c96074eb830..f20c459d7dc 100644 --- a/mysql-test/r/profiling.result +++ b/mysql-test/r/profiling.result @@ -298,6 +298,13 @@ id 1 2 3 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'hello' +Warning 1292 Truncated incorrect DOUBLE value: 'hello' +Warning 1292 Truncated incorrect DOUBLE value: 'hello' +Warning 1292 Truncated incorrect DOUBLE value: 'hello' +Warning 1292 Truncated incorrect DOUBLE value: 'hello' +Warning 1292 Truncated incorrect DOUBLE value: 'hello' select @@profiling; @@profiling 1 diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 06e6b8167fd..0e28d34441d 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -1194,13 +1194,13 @@ SET @aux= "SELECT COUNT(*) prepare my_stmt from @aux; execute my_stmt; COUNT(*) -39 +40 execute my_stmt; COUNT(*) -39 +40 execute my_stmt; COUNT(*) -39 +40 deallocate prepare my_stmt; drop procedure if exists p1| drop table if exists t1| diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result index 1b2a0cc50b2..3ab65c24040 100644 --- a/mysql-test/r/ps_1general.result +++ b/mysql-test/r/ps_1general.result @@ -279,6 +279,9 @@ b char(10) YES NULL SET @arg00=1; execute stmt4 using @arg00; Field Type Null Key Default Extra +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'a' +Warning 1292 Truncated incorrect DOUBLE value: 'b' prepare stmt4 from ' show columns from t2 from test like ''a%'' '; execute stmt4; Field Type Null Key Default Extra diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result index a91d13d11a1..c51863b73f7 100644 --- a/mysql-test/r/ps_2myisam.result +++ b/mysql-test/r/ps_2myisam.result @@ -59,8 +59,8 @@ def test t9 t9 c7 c7 4 12 1 Y 32768 31 63 def test t9 t9 c8 c8 5 22 1 Y 32768 31 63 def test t9 t9 c9 c9 5 22 1 Y 32768 31 63 def test t9 t9 c10 c10 5 22 1 Y 32768 31 63 -def test t9 t9 c11 c11 246 9 6 Y 0 4 63 -def test t9 t9 c12 c12 246 10 6 Y 0 4 63 +def test t9 t9 c11 c11 246 9 6 Y 32768 4 63 +def test t9 t9 c12 c12 246 10 6 Y 32768 4 63 def test t9 t9 c13 c13 10 10 10 Y 128 0 63 def test t9 t9 c14 c14 12 19 19 Y 128 0 63 def test t9 t9 c15 c15 7 19 19 N 9441 0 63 @@ -1807,8 +1807,8 @@ select * from t5 ; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def test t5 t5 const01 const01 3 1 1 N 32769 0 63 def test t5 t5 param01 param01 8 20 1 Y 32768 0 63 -def test t5 t5 const02 const02 246 4 3 N 1 1 63 -def test t5 t5 param02 param02 246 67 32 Y 0 30 63 +def test t5 t5 const02 const02 246 4 3 N 32769 1 63 +def test t5 t5 param02 param02 246 67 32 Y 32768 30 63 def test t5 t5 const03 const03 5 17 1 N 32769 31 63 def test t5 t5 param03 param03 5 23 1 Y 32768 31 63 def test t5 t5 const04 const04 253 3 3 N 1 0 8 @@ -1829,7 +1829,7 @@ def test t5 t5 const11 const11 3 4 4 Y 32768 0 63 def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 def test t5 t5 const12 const12 254 0 0 Y 128 0 63 def test t5 t5 param12 param12 8 20 0 Y 32768 0 63 -def test t5 t5 param13 param13 246 67 0 Y 0 30 63 +def test t5 t5 param13 param13 246 67 0 Y 32768 30 63 def test t5 t5 param14 param14 252 4294967295 0 Y 16 0 8 def test t5 t5 param15 param15 252 4294967295 0 Y 144 0 63 const01 8 @@ -1927,8 +1927,8 @@ def @arg07 5 23 1 Y 32896 31 63 def @arg08 5 23 1 Y 32896 31 63 def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 -def @arg11 246 83 6 Y 128 30 63 -def @arg12 246 83 6 Y 128 30 63 +def @arg11 246 83 6 Y 32896 30 63 +def @arg12 246 83 6 Y 32896 30 63 def @arg13 251 16777216 10 Y 128 31 63 def @arg14 251 16777216 19 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -1974,8 +1974,8 @@ def @arg07 5 23 0 Y 32896 31 63 def @arg08 5 23 0 Y 32896 31 63 def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 -def @arg11 246 83 0 Y 128 30 63 -def @arg12 246 83 0 Y 128 30 63 +def @arg11 246 83 0 Y 32896 30 63 +def @arg12 246 83 0 Y 32896 30 63 def @arg13 251 16777216 0 Y 128 31 63 def @arg14 251 16777216 0 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -2024,8 +2024,8 @@ def @arg07 5 23 1 Y 32896 31 63 def @arg08 5 23 1 Y 32896 31 63 def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 -def @arg11 246 83 6 Y 128 30 63 -def @arg12 246 83 6 Y 128 30 63 +def @arg11 246 83 6 Y 32896 30 63 +def @arg12 246 83 6 Y 32896 30 63 def @arg13 251 16777216 10 Y 128 31 63 def @arg14 251 16777216 19 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -2064,8 +2064,8 @@ def @arg07 5 23 0 Y 32896 31 63 def @arg08 5 23 0 Y 32896 31 63 def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 -def @arg11 246 83 0 Y 128 30 63 -def @arg12 246 83 0 Y 128 30 63 +def @arg11 246 83 0 Y 32896 30 63 +def @arg12 246 83 0 Y 32896 30 63 def @arg13 251 16777216 0 Y 128 31 63 def @arg14 251 16777216 0 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -2112,8 +2112,8 @@ def @arg07 5 23 1 Y 32896 31 63 def @arg08 5 23 1 Y 32896 31 63 def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 -def @arg11 246 83 6 Y 128 30 63 -def @arg12 246 83 6 Y 128 30 63 +def @arg11 246 83 6 Y 32896 30 63 +def @arg12 246 83 6 Y 32896 30 63 def @arg13 251 16777216 10 Y 128 31 63 def @arg14 251 16777216 19 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -2156,8 +2156,8 @@ def @arg07 5 23 0 Y 32896 31 63 def @arg08 5 23 0 Y 32896 31 63 def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 -def @arg11 246 83 0 Y 128 30 63 -def @arg12 246 83 0 Y 128 30 63 +def @arg11 246 83 0 Y 32896 30 63 +def @arg12 246 83 0 Y 32896 30 63 def @arg13 251 16777216 0 Y 128 31 63 def @arg14 251 16777216 0 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -2202,8 +2202,8 @@ def @arg07 5 23 1 Y 32896 31 63 def @arg08 5 23 1 Y 32896 31 63 def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 -def @arg11 246 83 6 Y 128 30 63 -def @arg12 246 83 6 Y 128 30 63 +def @arg11 246 83 6 Y 32896 30 63 +def @arg12 246 83 6 Y 32896 30 63 def @arg13 251 16777216 10 Y 128 31 63 def @arg14 251 16777216 19 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -2240,8 +2240,8 @@ def @arg07 5 23 0 Y 32896 31 63 def @arg08 5 23 0 Y 32896 31 63 def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 -def @arg11 246 83 0 Y 128 30 63 -def @arg12 246 83 0 Y 128 30 63 +def @arg11 246 83 0 Y 32896 30 63 +def @arg12 246 83 0 Y 32896 30 63 def @arg13 251 16777216 0 Y 128 31 63 def @arg14 251 16777216 0 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result index 50c94d6cc4e..2670451f24e 100644 --- a/mysql-test/r/ps_3innodb.result +++ b/mysql-test/r/ps_3innodb.result @@ -59,8 +59,8 @@ def test t9 t9 c7 c7 4 12 1 Y 32768 31 63 def test t9 t9 c8 c8 5 22 1 Y 32768 31 63 def test t9 t9 c9 c9 5 22 1 Y 32768 31 63 def test t9 t9 c10 c10 5 22 1 Y 32768 31 63 -def test t9 t9 c11 c11 246 9 6 Y 0 4 63 -def test t9 t9 c12 c12 246 10 6 Y 0 4 63 +def test t9 t9 c11 c11 246 9 6 Y 32768 4 63 +def test t9 t9 c12 c12 246 10 6 Y 32768 4 63 def test t9 t9 c13 c13 10 10 10 Y 128 0 63 def test t9 t9 c14 c14 12 19 19 Y 128 0 63 def test t9 t9 c15 c15 7 19 19 N 9441 0 63 @@ -1790,8 +1790,8 @@ select * from t5 ; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def test t5 t5 const01 const01 3 1 1 N 32769 0 63 def test t5 t5 param01 param01 8 20 1 Y 32768 0 63 -def test t5 t5 const02 const02 246 4 3 N 1 1 63 -def test t5 t5 param02 param02 246 67 32 Y 0 30 63 +def test t5 t5 const02 const02 246 4 3 N 32769 1 63 +def test t5 t5 param02 param02 246 67 32 Y 32768 30 63 def test t5 t5 const03 const03 5 17 1 N 32769 31 63 def test t5 t5 param03 param03 5 23 1 Y 32768 31 63 def test t5 t5 const04 const04 253 3 3 N 1 0 8 @@ -1812,7 +1812,7 @@ def test t5 t5 const11 const11 3 4 4 Y 32768 0 63 def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 def test t5 t5 const12 const12 254 0 0 Y 128 0 63 def test t5 t5 param12 param12 8 20 0 Y 32768 0 63 -def test t5 t5 param13 param13 246 67 0 Y 0 30 63 +def test t5 t5 param13 param13 246 67 0 Y 32768 30 63 def test t5 t5 param14 param14 252 4294967295 0 Y 16 0 8 def test t5 t5 param15 param15 252 4294967295 0 Y 144 0 63 const01 8 @@ -1910,8 +1910,8 @@ def @arg07 5 23 1 Y 32896 31 63 def @arg08 5 23 1 Y 32896 31 63 def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 -def @arg11 246 83 6 Y 128 30 63 -def @arg12 246 83 6 Y 128 30 63 +def @arg11 246 83 6 Y 32896 30 63 +def @arg12 246 83 6 Y 32896 30 63 def @arg13 251 16777216 10 Y 128 31 63 def @arg14 251 16777216 19 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -1957,8 +1957,8 @@ def @arg07 5 23 0 Y 32896 31 63 def @arg08 5 23 0 Y 32896 31 63 def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 -def @arg11 246 83 0 Y 128 30 63 -def @arg12 246 83 0 Y 128 30 63 +def @arg11 246 83 0 Y 32896 30 63 +def @arg12 246 83 0 Y 32896 30 63 def @arg13 251 16777216 0 Y 128 31 63 def @arg14 251 16777216 0 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -2007,8 +2007,8 @@ def @arg07 5 23 1 Y 32896 31 63 def @arg08 5 23 1 Y 32896 31 63 def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 -def @arg11 246 83 6 Y 128 30 63 -def @arg12 246 83 6 Y 128 30 63 +def @arg11 246 83 6 Y 32896 30 63 +def @arg12 246 83 6 Y 32896 30 63 def @arg13 251 16777216 10 Y 128 31 63 def @arg14 251 16777216 19 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -2047,8 +2047,8 @@ def @arg07 5 23 0 Y 32896 31 63 def @arg08 5 23 0 Y 32896 31 63 def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 -def @arg11 246 83 0 Y 128 30 63 -def @arg12 246 83 0 Y 128 30 63 +def @arg11 246 83 0 Y 32896 30 63 +def @arg12 246 83 0 Y 32896 30 63 def @arg13 251 16777216 0 Y 128 31 63 def @arg14 251 16777216 0 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -2095,8 +2095,8 @@ def @arg07 5 23 1 Y 32896 31 63 def @arg08 5 23 1 Y 32896 31 63 def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 -def @arg11 246 83 6 Y 128 30 63 -def @arg12 246 83 6 Y 128 30 63 +def @arg11 246 83 6 Y 32896 30 63 +def @arg12 246 83 6 Y 32896 30 63 def @arg13 251 16777216 10 Y 128 31 63 def @arg14 251 16777216 19 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -2139,8 +2139,8 @@ def @arg07 5 23 0 Y 32896 31 63 def @arg08 5 23 0 Y 32896 31 63 def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 -def @arg11 246 83 0 Y 128 30 63 -def @arg12 246 83 0 Y 128 30 63 +def @arg11 246 83 0 Y 32896 30 63 +def @arg12 246 83 0 Y 32896 30 63 def @arg13 251 16777216 0 Y 128 31 63 def @arg14 251 16777216 0 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -2185,8 +2185,8 @@ def @arg07 5 23 1 Y 32896 31 63 def @arg08 5 23 1 Y 32896 31 63 def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 -def @arg11 246 83 6 Y 128 30 63 -def @arg12 246 83 6 Y 128 30 63 +def @arg11 246 83 6 Y 32896 30 63 +def @arg12 246 83 6 Y 32896 30 63 def @arg13 251 16777216 10 Y 128 31 63 def @arg14 251 16777216 19 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -2223,8 +2223,8 @@ def @arg07 5 23 0 Y 32896 31 63 def @arg08 5 23 0 Y 32896 31 63 def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 -def @arg11 246 83 0 Y 128 30 63 -def @arg12 246 83 0 Y 128 30 63 +def @arg11 246 83 0 Y 32896 30 63 +def @arg12 246 83 0 Y 32896 30 63 def @arg13 251 16777216 0 Y 128 31 63 def @arg14 251 16777216 0 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result index a85809d3800..4372c470b2d 100644 --- a/mysql-test/r/ps_4heap.result +++ b/mysql-test/r/ps_4heap.result @@ -60,8 +60,8 @@ def test t9 t9 c7 c7 4 12 1 Y 32768 31 63 def test t9 t9 c8 c8 5 22 1 Y 32768 31 63 def test t9 t9 c9 c9 5 22 1 Y 32768 31 63 def test t9 t9 c10 c10 5 22 1 Y 32768 31 63 -def test t9 t9 c11 c11 246 9 6 Y 0 4 63 -def test t9 t9 c12 c12 246 10 6 Y 0 4 63 +def test t9 t9 c11 c11 246 9 6 Y 32768 4 63 +def test t9 t9 c12 c12 246 10 6 Y 32768 4 63 def test t9 t9 c13 c13 10 10 10 Y 128 0 63 def test t9 t9 c14 c14 12 19 19 Y 128 0 63 def test t9 t9 c15 c15 7 19 19 N 9441 0 63 @@ -1791,8 +1791,8 @@ select * from t5 ; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def test t5 t5 const01 const01 3 1 1 N 32769 0 63 def test t5 t5 param01 param01 8 20 1 Y 32768 0 63 -def test t5 t5 const02 const02 246 4 3 N 1 1 63 -def test t5 t5 param02 param02 246 67 32 Y 0 30 63 +def test t5 t5 const02 const02 246 4 3 N 32769 1 63 +def test t5 t5 param02 param02 246 67 32 Y 32768 30 63 def test t5 t5 const03 const03 5 17 1 N 32769 31 63 def test t5 t5 param03 param03 5 23 1 Y 32768 31 63 def test t5 t5 const04 const04 253 3 3 N 1 0 8 @@ -1813,7 +1813,7 @@ def test t5 t5 const11 const11 3 4 4 Y 32768 0 63 def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 def test t5 t5 const12 const12 254 0 0 Y 128 0 63 def test t5 t5 param12 param12 8 20 0 Y 32768 0 63 -def test t5 t5 param13 param13 246 67 0 Y 0 30 63 +def test t5 t5 param13 param13 246 67 0 Y 32768 30 63 def test t5 t5 param14 param14 252 4294967295 0 Y 16 0 8 def test t5 t5 param15 param15 252 4294967295 0 Y 144 0 63 const01 8 @@ -1911,8 +1911,8 @@ def @arg07 5 23 1 Y 32896 31 63 def @arg08 5 23 1 Y 32896 31 63 def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 -def @arg11 246 83 6 Y 128 30 63 -def @arg12 246 83 6 Y 128 30 63 +def @arg11 246 83 6 Y 32896 30 63 +def @arg12 246 83 6 Y 32896 30 63 def @arg13 251 16777216 10 Y 128 31 63 def @arg14 251 16777216 19 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -1958,8 +1958,8 @@ def @arg07 5 23 0 Y 32896 31 63 def @arg08 5 23 0 Y 32896 31 63 def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 -def @arg11 246 83 0 Y 128 30 63 -def @arg12 246 83 0 Y 128 30 63 +def @arg11 246 83 0 Y 32896 30 63 +def @arg12 246 83 0 Y 32896 30 63 def @arg13 251 16777216 0 Y 128 31 63 def @arg14 251 16777216 0 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -2008,8 +2008,8 @@ def @arg07 5 23 1 Y 32896 31 63 def @arg08 5 23 1 Y 32896 31 63 def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 -def @arg11 246 83 6 Y 128 30 63 -def @arg12 246 83 6 Y 128 30 63 +def @arg11 246 83 6 Y 32896 30 63 +def @arg12 246 83 6 Y 32896 30 63 def @arg13 251 16777216 10 Y 128 31 63 def @arg14 251 16777216 19 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -2048,8 +2048,8 @@ def @arg07 5 23 0 Y 32896 31 63 def @arg08 5 23 0 Y 32896 31 63 def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 -def @arg11 246 83 0 Y 128 30 63 -def @arg12 246 83 0 Y 128 30 63 +def @arg11 246 83 0 Y 32896 30 63 +def @arg12 246 83 0 Y 32896 30 63 def @arg13 251 16777216 0 Y 128 31 63 def @arg14 251 16777216 0 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -2096,8 +2096,8 @@ def @arg07 5 23 1 Y 32896 31 63 def @arg08 5 23 1 Y 32896 31 63 def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 -def @arg11 246 83 6 Y 128 30 63 -def @arg12 246 83 6 Y 128 30 63 +def @arg11 246 83 6 Y 32896 30 63 +def @arg12 246 83 6 Y 32896 30 63 def @arg13 251 16777216 10 Y 128 31 63 def @arg14 251 16777216 19 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -2140,8 +2140,8 @@ def @arg07 5 23 0 Y 32896 31 63 def @arg08 5 23 0 Y 32896 31 63 def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 -def @arg11 246 83 0 Y 128 30 63 -def @arg12 246 83 0 Y 128 30 63 +def @arg11 246 83 0 Y 32896 30 63 +def @arg12 246 83 0 Y 32896 30 63 def @arg13 251 16777216 0 Y 128 31 63 def @arg14 251 16777216 0 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -2186,8 +2186,8 @@ def @arg07 5 23 1 Y 32896 31 63 def @arg08 5 23 1 Y 32896 31 63 def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 -def @arg11 246 83 6 Y 128 30 63 -def @arg12 246 83 6 Y 128 30 63 +def @arg11 246 83 6 Y 32896 30 63 +def @arg12 246 83 6 Y 32896 30 63 def @arg13 251 16777216 10 Y 128 31 63 def @arg14 251 16777216 19 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -2224,8 +2224,8 @@ def @arg07 5 23 0 Y 32896 31 63 def @arg08 5 23 0 Y 32896 31 63 def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 -def @arg11 246 83 0 Y 128 30 63 -def @arg12 246 83 0 Y 128 30 63 +def @arg11 246 83 0 Y 32896 30 63 +def @arg12 246 83 0 Y 32896 30 63 def @arg13 251 16777216 0 Y 128 31 63 def @arg14 251 16777216 0 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result index fd1b69c0ffd..35a43f7c032 100644 --- a/mysql-test/r/ps_5merge.result +++ b/mysql-test/r/ps_5merge.result @@ -102,8 +102,8 @@ def test t9 t9 c7 c7 4 12 1 Y 32768 31 63 def test t9 t9 c8 c8 5 22 1 Y 32768 31 63 def test t9 t9 c9 c9 5 22 1 Y 32768 31 63 def test t9 t9 c10 c10 5 22 1 Y 32768 31 63 -def test t9 t9 c11 c11 246 9 6 Y 0 4 63 -def test t9 t9 c12 c12 246 10 6 Y 0 4 63 +def test t9 t9 c11 c11 246 9 6 Y 32768 4 63 +def test t9 t9 c12 c12 246 10 6 Y 32768 4 63 def test t9 t9 c13 c13 10 10 10 Y 128 0 63 def test t9 t9 c14 c14 12 19 19 Y 128 0 63 def test t9 t9 c15 c15 7 19 19 N 9441 0 63 @@ -1727,8 +1727,8 @@ select * from t5 ; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def test t5 t5 const01 const01 3 1 1 N 32769 0 63 def test t5 t5 param01 param01 8 20 1 Y 32768 0 63 -def test t5 t5 const02 const02 246 4 3 N 1 1 63 -def test t5 t5 param02 param02 246 67 32 Y 0 30 63 +def test t5 t5 const02 const02 246 4 3 N 32769 1 63 +def test t5 t5 param02 param02 246 67 32 Y 32768 30 63 def test t5 t5 const03 const03 5 17 1 N 32769 31 63 def test t5 t5 param03 param03 5 23 1 Y 32768 31 63 def test t5 t5 const04 const04 253 3 3 N 1 0 8 @@ -1749,7 +1749,7 @@ def test t5 t5 const11 const11 3 4 4 Y 32768 0 63 def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 def test t5 t5 const12 const12 254 0 0 Y 128 0 63 def test t5 t5 param12 param12 8 20 0 Y 32768 0 63 -def test t5 t5 param13 param13 246 67 0 Y 0 30 63 +def test t5 t5 param13 param13 246 67 0 Y 32768 30 63 def test t5 t5 param14 param14 252 4294967295 0 Y 16 0 8 def test t5 t5 param15 param15 252 4294967295 0 Y 144 0 63 const01 8 @@ -1847,8 +1847,8 @@ def @arg07 5 23 1 Y 32896 31 63 def @arg08 5 23 1 Y 32896 31 63 def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 -def @arg11 246 83 6 Y 128 30 63 -def @arg12 246 83 6 Y 128 30 63 +def @arg11 246 83 6 Y 32896 30 63 +def @arg12 246 83 6 Y 32896 30 63 def @arg13 251 16777216 10 Y 128 31 63 def @arg14 251 16777216 19 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -1894,8 +1894,8 @@ def @arg07 5 23 0 Y 32896 31 63 def @arg08 5 23 0 Y 32896 31 63 def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 -def @arg11 246 83 0 Y 128 30 63 -def @arg12 246 83 0 Y 128 30 63 +def @arg11 246 83 0 Y 32896 30 63 +def @arg12 246 83 0 Y 32896 30 63 def @arg13 251 16777216 0 Y 128 31 63 def @arg14 251 16777216 0 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -1944,8 +1944,8 @@ def @arg07 5 23 1 Y 32896 31 63 def @arg08 5 23 1 Y 32896 31 63 def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 -def @arg11 246 83 6 Y 128 30 63 -def @arg12 246 83 6 Y 128 30 63 +def @arg11 246 83 6 Y 32896 30 63 +def @arg12 246 83 6 Y 32896 30 63 def @arg13 251 16777216 10 Y 128 31 63 def @arg14 251 16777216 19 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -1984,8 +1984,8 @@ def @arg07 5 23 0 Y 32896 31 63 def @arg08 5 23 0 Y 32896 31 63 def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 -def @arg11 246 83 0 Y 128 30 63 -def @arg12 246 83 0 Y 128 30 63 +def @arg11 246 83 0 Y 32896 30 63 +def @arg12 246 83 0 Y 32896 30 63 def @arg13 251 16777216 0 Y 128 31 63 def @arg14 251 16777216 0 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -2032,8 +2032,8 @@ def @arg07 5 23 1 Y 32896 31 63 def @arg08 5 23 1 Y 32896 31 63 def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 -def @arg11 246 83 6 Y 128 30 63 -def @arg12 246 83 6 Y 128 30 63 +def @arg11 246 83 6 Y 32896 30 63 +def @arg12 246 83 6 Y 32896 30 63 def @arg13 251 16777216 10 Y 128 31 63 def @arg14 251 16777216 19 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -2076,8 +2076,8 @@ def @arg07 5 23 0 Y 32896 31 63 def @arg08 5 23 0 Y 32896 31 63 def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 -def @arg11 246 83 0 Y 128 30 63 -def @arg12 246 83 0 Y 128 30 63 +def @arg11 246 83 0 Y 32896 30 63 +def @arg12 246 83 0 Y 32896 30 63 def @arg13 251 16777216 0 Y 128 31 63 def @arg14 251 16777216 0 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -2122,8 +2122,8 @@ def @arg07 5 23 1 Y 32896 31 63 def @arg08 5 23 1 Y 32896 31 63 def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 -def @arg11 246 83 6 Y 128 30 63 -def @arg12 246 83 6 Y 128 30 63 +def @arg11 246 83 6 Y 32896 30 63 +def @arg12 246 83 6 Y 32896 30 63 def @arg13 251 16777216 10 Y 128 31 63 def @arg14 251 16777216 19 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -2160,8 +2160,8 @@ def @arg07 5 23 0 Y 32896 31 63 def @arg08 5 23 0 Y 32896 31 63 def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 -def @arg11 246 83 0 Y 128 30 63 -def @arg12 246 83 0 Y 128 30 63 +def @arg11 246 83 0 Y 32896 30 63 +def @arg12 246 83 0 Y 32896 30 63 def @arg13 251 16777216 0 Y 128 31 63 def @arg14 251 16777216 0 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -3124,8 +3124,8 @@ def test t9 t9 c7 c7 4 12 1 Y 32768 31 63 def test t9 t9 c8 c8 5 22 1 Y 32768 31 63 def test t9 t9 c9 c9 5 22 1 Y 32768 31 63 def test t9 t9 c10 c10 5 22 1 Y 32768 31 63 -def test t9 t9 c11 c11 246 9 6 Y 0 4 63 -def test t9 t9 c12 c12 246 10 6 Y 0 4 63 +def test t9 t9 c11 c11 246 9 6 Y 32768 4 63 +def test t9 t9 c12 c12 246 10 6 Y 32768 4 63 def test t9 t9 c13 c13 10 10 10 Y 128 0 63 def test t9 t9 c14 c14 12 19 19 Y 128 0 63 def test t9 t9 c15 c15 7 19 19 N 9441 0 63 @@ -4749,8 +4749,8 @@ select * from t5 ; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def test t5 t5 const01 const01 3 1 1 N 32769 0 63 def test t5 t5 param01 param01 8 20 1 Y 32768 0 63 -def test t5 t5 const02 const02 246 4 3 N 1 1 63 -def test t5 t5 param02 param02 246 67 32 Y 0 30 63 +def test t5 t5 const02 const02 246 4 3 N 32769 1 63 +def test t5 t5 param02 param02 246 67 32 Y 32768 30 63 def test t5 t5 const03 const03 5 17 1 N 32769 31 63 def test t5 t5 param03 param03 5 23 1 Y 32768 31 63 def test t5 t5 const04 const04 253 3 3 N 1 0 8 @@ -4771,7 +4771,7 @@ def test t5 t5 const11 const11 3 4 4 Y 32768 0 63 def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 def test t5 t5 const12 const12 254 0 0 Y 128 0 63 def test t5 t5 param12 param12 8 20 0 Y 32768 0 63 -def test t5 t5 param13 param13 246 67 0 Y 0 30 63 +def test t5 t5 param13 param13 246 67 0 Y 32768 30 63 def test t5 t5 param14 param14 252 4294967295 0 Y 16 0 8 def test t5 t5 param15 param15 252 4294967295 0 Y 144 0 63 const01 8 @@ -4869,8 +4869,8 @@ def @arg07 5 23 1 Y 32896 31 63 def @arg08 5 23 1 Y 32896 31 63 def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 -def @arg11 246 83 6 Y 128 30 63 -def @arg12 246 83 6 Y 128 30 63 +def @arg11 246 83 6 Y 32896 30 63 +def @arg12 246 83 6 Y 32896 30 63 def @arg13 251 16777216 10 Y 128 31 63 def @arg14 251 16777216 19 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -4916,8 +4916,8 @@ def @arg07 5 23 0 Y 32896 31 63 def @arg08 5 23 0 Y 32896 31 63 def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 -def @arg11 246 83 0 Y 128 30 63 -def @arg12 246 83 0 Y 128 30 63 +def @arg11 246 83 0 Y 32896 30 63 +def @arg12 246 83 0 Y 32896 30 63 def @arg13 251 16777216 0 Y 128 31 63 def @arg14 251 16777216 0 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -4966,8 +4966,8 @@ def @arg07 5 23 1 Y 32896 31 63 def @arg08 5 23 1 Y 32896 31 63 def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 -def @arg11 246 83 6 Y 128 30 63 -def @arg12 246 83 6 Y 128 30 63 +def @arg11 246 83 6 Y 32896 30 63 +def @arg12 246 83 6 Y 32896 30 63 def @arg13 251 16777216 10 Y 128 31 63 def @arg14 251 16777216 19 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -5006,8 +5006,8 @@ def @arg07 5 23 0 Y 32896 31 63 def @arg08 5 23 0 Y 32896 31 63 def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 -def @arg11 246 83 0 Y 128 30 63 -def @arg12 246 83 0 Y 128 30 63 +def @arg11 246 83 0 Y 32896 30 63 +def @arg12 246 83 0 Y 32896 30 63 def @arg13 251 16777216 0 Y 128 31 63 def @arg14 251 16777216 0 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -5054,8 +5054,8 @@ def @arg07 5 23 1 Y 32896 31 63 def @arg08 5 23 1 Y 32896 31 63 def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 -def @arg11 246 83 6 Y 128 30 63 -def @arg12 246 83 6 Y 128 30 63 +def @arg11 246 83 6 Y 32896 30 63 +def @arg12 246 83 6 Y 32896 30 63 def @arg13 251 16777216 10 Y 128 31 63 def @arg14 251 16777216 19 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -5098,8 +5098,8 @@ def @arg07 5 23 0 Y 32896 31 63 def @arg08 5 23 0 Y 32896 31 63 def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 -def @arg11 246 83 0 Y 128 30 63 -def @arg12 246 83 0 Y 128 30 63 +def @arg11 246 83 0 Y 32896 30 63 +def @arg12 246 83 0 Y 32896 30 63 def @arg13 251 16777216 0 Y 128 31 63 def @arg14 251 16777216 0 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -5144,8 +5144,8 @@ def @arg07 5 23 1 Y 32896 31 63 def @arg08 5 23 1 Y 32896 31 63 def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 -def @arg11 246 83 6 Y 128 30 63 -def @arg12 246 83 6 Y 128 30 63 +def @arg11 246 83 6 Y 32896 30 63 +def @arg12 246 83 6 Y 32896 30 63 def @arg13 251 16777216 10 Y 128 31 63 def @arg14 251 16777216 19 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -5182,8 +5182,8 @@ def @arg07 5 23 0 Y 32896 31 63 def @arg08 5 23 0 Y 32896 31 63 def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 -def @arg11 246 83 0 Y 128 30 63 -def @arg12 246 83 0 Y 128 30 63 +def @arg11 246 83 0 Y 32896 30 63 +def @arg12 246 83 0 Y 32896 30 63 def @arg13 251 16777216 0 Y 128 31 63 def @arg14 251 16777216 0 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 diff --git a/mysql-test/r/query_cache_ps_no_prot.result b/mysql-test/r/query_cache_ps_no_prot.result index 0efb2540c64..f686e876a60 100644 --- a/mysql-test/r/query_cache_ps_no_prot.result +++ b/mysql-test/r/query_cache_ps_no_prot.result @@ -529,5 +529,46 @@ DROP DATABASE mysqltest1; use test; ######################################################################## +# +# Bug#27430 Crash in subquery code when in PS and table DDL changed +# after PREPARE +# Check the effect of automatic reprepare on query cache +# +######################################################################## +drop table if exists t1; +create table t1 (a varchar(255)); +insert into t1 (a) values ("Pack my box with five dozen liquor jugs."); +flush status; +prepare stmt from "select a from t1"; +execute stmt; +a +Pack my box with five dozen liquor jugs. +set @@global.query_cache_size=0; +alter table t1 add column b int; +execute stmt; +a +Pack my box with five dozen liquor jugs. +set @@global.query_cache_size=100000; +execute stmt; +a +Pack my box with five dozen liquor jugs. +execute stmt; +a +Pack my box with five dozen liquor jugs. +# +# Sic: ALTER TABLE caused an automatic reprepare +# of the prepared statement. Since the query cache was disabled +# at the time of reprepare, the new prepared statement doesn't +# work with it. +# +show status like 'Qcache_hits'; +Variable_name Value +Qcache_hits 0 +show status like 'Qcache_queries_in_cache'; +Variable_name Value +Qcache_queries_in_cache 0 +# Cleanup +deallocate prepare stmt; +drop table t1; set @@global.query_cache_size=@initial_query_cache_size; flush status; diff --git a/mysql-test/r/query_cache_ps_ps_prot.result b/mysql-test/r/query_cache_ps_ps_prot.result index dc0c4a0193a..e594161f2e9 100644 --- a/mysql-test/r/query_cache_ps_ps_prot.result +++ b/mysql-test/r/query_cache_ps_ps_prot.result @@ -529,5 +529,46 @@ DROP DATABASE mysqltest1; use test; ######################################################################## +# +# Bug#27430 Crash in subquery code when in PS and table DDL changed +# after PREPARE +# Check the effect of automatic reprepare on query cache +# +######################################################################## +drop table if exists t1; +create table t1 (a varchar(255)); +insert into t1 (a) values ("Pack my box with five dozen liquor jugs."); +flush status; +prepare stmt from "select a from t1"; +execute stmt; +a +Pack my box with five dozen liquor jugs. +set @@global.query_cache_size=0; +alter table t1 add column b int; +execute stmt; +a +Pack my box with five dozen liquor jugs. +set @@global.query_cache_size=100000; +execute stmt; +a +Pack my box with five dozen liquor jugs. +execute stmt; +a +Pack my box with five dozen liquor jugs. +# +# Sic: ALTER TABLE caused an automatic reprepare +# of the prepared statement. Since the query cache was disabled +# at the time of reprepare, the new prepared statement doesn't +# work with it. +# +show status like 'Qcache_hits'; +Variable_name Value +Qcache_hits 0 +show status like 'Qcache_queries_in_cache'; +Variable_name Value +Qcache_queries_in_cache 0 +# Cleanup +deallocate prepare stmt; +drop table t1; set @@global.query_cache_size=@initial_query_cache_size; flush status; diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index e6550bee954..8c026d93c67 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -1127,7 +1127,7 @@ def ROUTINES SQL_DATA_ACCESS SQL_DATA_ACCESS 253 192 12 N 1 0 33 def ROUTINES SQL_PATH SQL_PATH 253 192 0 Y 0 0 33 def ROUTINES SECURITY_TYPE SECURITY_TYPE 253 21 7 N 1 0 33 def ROUTINES SQL_MODE SQL_MODE 253 24576 0 N 1 0 33 -def ROUTINES ROUTINE_COMMENT ROUTINE_COMMENT 253 192 0 N 1 0 33 +def ROUTINES ROUTINE_COMMENT ROUTINE_COMMENT 252 589815 0 N 17 0 33 def ROUTINES DEFINER DEFINER 253 231 14 N 1 0 33 SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE SQL_MODE ROUTINE_COMMENT DEFINER p1 NULL test p1 PROCEDURE NULL SQL SELECT 1 NULL NULL SQL NO CONTAINS SQL NULL DEFINER root@localhost @@ -1182,7 +1182,7 @@ def ROUTINES SQL_DATA_ACCESS SQL_DATA_ACCESS 253 192 12 N 1 0 33 def ROUTINES SQL_PATH SQL_PATH 253 192 0 Y 0 0 33 def ROUTINES SECURITY_TYPE SECURITY_TYPE 253 21 7 N 1 0 33 def ROUTINES SQL_MODE SQL_MODE 253 24576 0 N 1 0 33 -def ROUTINES ROUTINE_COMMENT ROUTINE_COMMENT 253 192 0 N 1 0 33 +def ROUTINES ROUTINE_COMMENT ROUTINE_COMMENT 252 589815 0 N 17 0 33 def ROUTINES DEFINER DEFINER 253 231 14 N 1 0 33 SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE SQL_MODE ROUTINE_COMMENT DEFINER f1 NULL test f1 FUNCTION int(11) SQL RETURN 1 NULL NULL SQL NO CONTAINS SQL NULL DEFINER root@localhost @@ -1442,7 +1442,7 @@ FOR EACH ROW SET NEW.c1 = 'теÑÑ‚' koi8r koi8r_general_ci latin1_swedish_ci SHOW CREATE EVENT ev1; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -ev1 SYSTEM CREATE EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO SELECT 'теÑÑ‚' AS test koi8r koi8r_general_ci latin1_swedish_ci +ev1 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `ev1` ON SCHEDULE AT '2030-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO SELECT 'теÑÑ‚' AS test koi8r koi8r_general_ci latin1_swedish_ci DROP VIEW v1; DROP PROCEDURE p1; DROP FUNCTION f1; diff --git a/mysql-test/r/sp-vars.result b/mysql-test/r/sp-vars.result index f532a5284a9..f167986e82c 100644 --- a/mysql-test/r/sp-vars.result +++ b/mysql-test/r/sp-vars.result @@ -1158,3 +1158,30 @@ f1() @b 0 abc drop function f1; drop table t1; + +--------------------------------------------------------------- +BUG#28299 +--------------------------------------------------------------- + +CREATE PROCEDURE ctest() +BEGIN +DECLARE i CHAR(16); +DECLARE j INT; +SET i= 'string'; +SET j= 1 + i; +END| +CALL ctest(); +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'string ' +DROP PROCEDURE ctest; +CREATE PROCEDURE vctest() +BEGIN +DECLARE i VARCHAR(16); +DECLARE j INT; +SET i= 'string'; +SET j= 1 + i; +END| +CALL vctest(); +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'string' +DROP PROCEDURE vctest; diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index d8389c78845..2105c5ce725 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -6933,3 +6933,35 @@ DROP TABLE t1, t2; # ------------------------------------------------------------------ # -- End of 5.1 tests # ------------------------------------------------------------------ +DROP FUNCTION IF EXISTS f1; +DROP TABLE IF EXISTS t_non_existing; +DROP TABLE IF EXISTS t1; +CREATE FUNCTION f1() RETURNS INT +BEGIN +DECLARE v INT; +SELECT a INTO v FROM t_non_existing; +RETURN 1; +END| +CREATE TABLE t1 (a INT) ENGINE = myisam; +INSERT INTO t1 VALUES (1); +SELECT * FROM t1 WHERE a = f1(); +ERROR 42S02: Table 'test.t_non_existing' doesn't exist +DROP FUNCTION f1; +DROP TABLE t1; +# +# Bug#34197: CREATE PROCEDURE fails when COMMENT truncated in non +# strict SQL mode +# +DROP PROCEDURE IF EXISTS p1; +CREATE PROCEDURE p1 () +COMMENT +'12345678901234567890123456789012345678901234567890123456789012345678901234567890' +BEGIN +END; +SELECT comment FROM mysql.proc WHERE name = "p1"; +comment +12345678901234567890123456789012345678901234567890123456789012345678901234567890 +SELECT routine_comment FROM information_schema.routines WHERE routine_name = "p1"; +routine_comment +12345678901234567890123456789012345678901234567890123456789012345678901234567890 +DROP PROCEDURE p1; diff --git a/mysql-test/r/sp_trans.result b/mysql-test/r/sp_trans.result index 3cc251bc0a6..be45e5ff5d7 100644 --- a/mysql-test/r/sp_trans.result +++ b/mysql-test/r/sp_trans.result @@ -556,3 +556,30 @@ f1 bug13575(f1) 3 ccc drop function bug13575| drop table t3| +# +# End of 5.1 tests +# +# +# Bug #35877 Update .. WHERE with function, constraint violation, crash +# +DROP TABLE IF EXISTS t1_aux| +DROP TABLE IF EXISTS t1_not_null| +DROP FUNCTION IF EXISTS f1_two_inserts| +# MyISAM test +CREATE TABLE t1_not_null (f1 BIGINT, f2 BIGINT NOT NULL)| +CREATE TABLE t1_aux (f1 BIGINT, f2 BIGINT)| +INSERT INTO t1_aux VALUES (1,1)| +CREATE FUNCTION f1_two_inserts() returns INTEGER +BEGIN +INSERT INTO t1_not_null SET f1 = 10, f2 = NULL; +RETURN 1; +END| +UPDATE t1_aux SET f2 = 2 WHERE f1 = f1_two_inserts()| +ERROR 23000: Column 'f2' cannot be null +# InnoDB test +ALTER TABLE t1_not_null ENGINE = InnoDB| +ALTER TABLE t1_aux ENGINE = InnoDB| +UPDATE t1_aux SET f2 = 2 WHERE f1 = f1_two_inserts()| +ERROR 23000: Column 'f2' cannot be null +DROP TABLE t1_aux, t1_not_null| +DROP FUNCTION f1_two_inserts| diff --git a/mysql-test/r/sql_mode.result b/mysql-test/r/sql_mode.result index 0b0d5a38d0b..e83879274a1 100644 --- a/mysql-test/r/sql_mode.result +++ b/mysql-test/r/sql_mode.result @@ -506,6 +506,12 @@ mysqltest_32753@localhost set session sql_mode=@OLD_SQL_MODE; flush privileges; drop user mysqltest_32753@localhost; +SET @org_mode=@@sql_mode; +SET @@sql_mode='traditional'; +SELECT @@sql_mode LIKE '%NO_ENGINE_SUBSTITUTION%'; +@@sql_mode LIKE '%NO_ENGINE_SUBSTITUTION%' +1 +SET sql_mode=@org_mode; DROP TABLE IF EXISTS t1,t2; CREATE USER 'user_PCTFL'@'localhost' identified by 'PWD'; CREATE USER 'user_no_PCTFL'@'localhost' identified by 'PWD'; diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result index a9e0d7f457d..897c9072203 100644 --- a/mysql-test/r/strict.result +++ b/mysql-test/r/strict.result @@ -2,7 +2,7 @@ set @org_mode=@@sql_mode; set @@sql_mode='ansi,traditional'; select @@sql_mode; @@sql_mode -REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER +REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION DROP TABLE IF EXISTS t1, t2; CREATE TABLE t1 (col1 date); INSERT INTO t1 VALUES('2004-01-01'),('2004-02-29'); diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result index e252331cd1a..5aae1901839 100644 --- a/mysql-test/r/system_mysql_db.result +++ b/mysql-test/r/system_mysql_db.result @@ -110,6 +110,7 @@ user CREATE TABLE `user` ( `Create_user_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', `Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', `Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', + `Create_tablespace_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', `ssl_type` enum('','ANY','X509','SPECIFIED') CHARACTER SET utf8 NOT NULL DEFAULT '', `ssl_cipher` blob NOT NULL, `x509_issuer` blob NOT NULL, @@ -201,7 +202,7 @@ proc CREATE TABLE `proc` ( `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '', - `comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', + `comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, `character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, `collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, `db_collation` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result index 000b08113c1..1a6494e03ad 100644 --- a/mysql-test/r/trigger.result +++ b/mysql-test/r/trigger.result @@ -2088,3 +2088,30 @@ SELECT * FROM t2; a b DROP TABLE t1, t2; End of 5.1 tests. +# +# Bug#34453 Can't change size of file (Errcode: 1224) +# +DROP TRIGGER IF EXISTS t1_bi; +DROP TRIGGER IF EXISTS t1_bd; +DROP TABLE IF EXISTS t1; +DROP TEMPORARY TABLE IF EXISTS t2; +CREATE TABLE t1 (s1 INT); +CREATE TEMPORARY TABLE t2 (s1 INT); +CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (0); +CREATE TRIGGER t1_bd BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t2; +INSERT INTO t1 VALUES (0); +INSERT INTO t1 VALUES (0); +SELECT * FROM t1; +s1 +0 +0 +SELECT * FROM t2; +s1 +0 +0 +# Reported to give ERROR 14 (HY000): +# Can't change size of file (Errcode: 1224) +# on Windows +DELETE FROM t1; +DROP TABLE t1; +DROP TEMPORARY TABLE t2; diff --git a/mysql-test/r/type_varchar.result b/mysql-test/r/type_varchar.result index 96042a91bae..6b614960422 100644 --- a/mysql-test/r/type_varchar.result +++ b/mysql-test/r/type_varchar.result @@ -489,3 +489,23 @@ Warnings: Warning 1292 Truncated incorrect INTEGER value: '1a' Warning 1292 Truncated incorrect INTEGER value: 't' DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(16)); +INSERT INTO t1 VALUES ('5'), ('s'), (''); +SELECT 5 = a FROM t1; +5 = a +1 +0 +0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 's' +DROP TABLE t1; +CREATE TABLE t1 (a CHAR(16)); +INSERT INTO t1 VALUES ('5'), ('s'), (''); +SELECT 5 = a FROM t1; +5 = a +1 +0 +0 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 's ' +DROP TABLE t1; diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index c1cd1840df8..b907411924e 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -1488,3 +1488,168 @@ SELECT @@GLOBAL.max_binlog_cache_size; 5368709120 SET GLOBAL max_binlog_cache_size = @old_max_binlog_cache_size; End of 5.1 tests + +# +# Bug#34828: OF is taken as OFF and a value of 0 is set for variable SQL_notes. +# + +# Checking sql_notes... +SET @sql_notes_saved = @@sql_notes; + +SET @@sql_notes = ON; +SELECT @@sql_notes; +@@sql_notes +1 + +SET @@sql_notes = OF; +ERROR 42000: Variable 'sql_notes' can't be set to the value of 'OF' +SELECT @@sql_notes; +@@sql_notes +1 + +SET @@sql_notes = OFF; +SELECT @@sql_notes; +@@sql_notes +0 + +SET @@sql_notes = @sql_notes_saved; + +# Checking delay_key_write... +SET @delay_key_write_saved = @@delay_key_write; + +SET GLOBAL delay_key_write = ON; +SELECT @@delay_key_write; +@@delay_key_write +ON + +SET GLOBAL delay_key_write = OF; +ERROR 42000: Variable 'delay_key_write' can't be set to the value of 'OF' +SELECT @@delay_key_write; +@@delay_key_write +ON + +SET GLOBAL delay_key_write = AL; +ERROR 42000: Variable 'delay_key_write' can't be set to the value of 'AL' +SELECT @@delay_key_write; +@@delay_key_write +ON + +SET GLOBAL delay_key_write = OFF; +SELECT @@delay_key_write; +@@delay_key_write +OFF + +SET GLOBAL delay_key_write = ALL; +SELECT @@delay_key_write; +@@delay_key_write +ALL + +SET GLOBAL delay_key_write = @delay_key_write_saved; + +# Checking sql_safe_updates... +SET @sql_safe_updates_saved = @@sql_safe_updates; + +SET @@sql_safe_updates = ON; +SELECT @@sql_safe_updates; +@@sql_safe_updates +1 + +SET @@sql_safe_updates = OF; +ERROR 42000: Variable 'sql_safe_updates' can't be set to the value of 'OF' +SELECT @@sql_safe_updates; +@@sql_safe_updates +1 + +SET @@sql_safe_updates = OFF; +SELECT @@sql_safe_updates; +@@sql_safe_updates +0 + +SET @@sql_safe_updates = @sql_safe_updates_saved; + +# Checking foreign_key_checks... +SET @foreign_key_checks_saved = @@foreign_key_checks; + +SET @@foreign_key_checks = ON; +SELECT @@foreign_key_checks; +@@foreign_key_checks +1 + +SET @@foreign_key_checks = OF; +ERROR 42000: Variable 'foreign_key_checks' can't be set to the value of 'OF' +SELECT @@foreign_key_checks; +@@foreign_key_checks +1 + +SET @@foreign_key_checks = OFF; +SELECT @@foreign_key_checks; +@@foreign_key_checks +0 + +SET @@foreign_key_checks = @foreign_key_checks_saved; + +# Checking unique_checks... +SET @unique_checks_saved = @@unique_checks; + +SET @@unique_checks = ON; +SELECT @@unique_checks; +@@unique_checks +1 + +SET @@unique_checks = OF; +ERROR 42000: Variable 'unique_checks' can't be set to the value of 'OF' +SELECT @@unique_checks; +@@unique_checks +1 + +SET @@unique_checks = OFF; +SELECT @@unique_checks; +@@unique_checks +0 + +SET @@unique_checks = @unique_checks_saved; + +# Checking sql_buffer_result... +SET @sql_buffer_result_saved = @@sql_buffer_result; + +SET @@sql_buffer_result = ON; +SELECT @@sql_buffer_result; +@@sql_buffer_result +1 + +SET @@sql_buffer_result = OF; +ERROR 42000: Variable 'sql_buffer_result' can't be set to the value of 'OF' +SELECT @@sql_buffer_result; +@@sql_buffer_result +1 + +SET @@sql_buffer_result = OFF; +SELECT @@sql_buffer_result; +@@sql_buffer_result +0 + +SET @@sql_buffer_result = @sql_buffer_result_saved; + +# Checking sql_quote_show_create... +SET @sql_quote_show_create_saved = @@sql_quote_show_create; + +SET @@sql_quote_show_create = ON; +SELECT @@sql_quote_show_create; +@@sql_quote_show_create +1 + +SET @@sql_quote_show_create = OF; +ERROR 42000: Variable 'sql_quote_show_create' can't be set to the value of 'OF' +SELECT @@sql_quote_show_create; +@@sql_quote_show_create +1 + +SET @@sql_quote_show_create = OFF; +SELECT @@sql_quote_show_create; +@@sql_quote_show_create +0 + +SET @@sql_quote_show_create = @sql_quote_show_create_saved; + +# End of Bug#34828. + diff --git a/mysql-test/suite/funcs_1/r/innodb_func_view.result b/mysql-test/suite/funcs_1/r/innodb_func_view.result index 172f410b949..0347dc0e2e8 100644 --- a/mysql-test/suite/funcs_1/r/innodb_func_view.result +++ b/mysql-test/suite/funcs_1/r/innodb_func_view.result @@ -2096,6 +2096,9 @@ IS NOT TRUE 2 IS NOT TRUE <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' +Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varbinary_1000`,'IS TRUE','IS NOT TRUE') AS `IF(my_varbinary_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -2108,6 +2111,9 @@ IS NOT TRUE 2 IS NOT TRUE <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' +Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' DROP VIEW v1; @@ -2158,6 +2164,9 @@ IS NOT TRUE 2 IS NOT TRUE <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' +Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varchar_1000`,'IS TRUE','IS NOT TRUE') AS `IF(my_varchar_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -2170,6 +2179,9 @@ IS NOT TRUE 2 IS NOT TRUE <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' +Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' DROP VIEW v1; @@ -3373,8 +3385,11 @@ NULL NULL 1 -3333.33 -3333.3333 29 Warnings: Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -3390,8 +3405,11 @@ NULL NULL 1 -3333.33 -3333.3333 29 Warnings: Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' DROP VIEW v1; @@ -3455,8 +3473,11 @@ NULL NULL 1 -3333.33 -3333.3333 27 Warnings: Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -3472,8 +3493,11 @@ NULL NULL 1 -3333.33 -3333.3333 27 Warnings: Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' DROP VIEW v1; diff --git a/mysql-test/suite/funcs_1/r/innodb_storedproc_07.result b/mysql-test/suite/funcs_1/r/innodb_storedproc_07.result index 5a2c0bb6bdf..a520bdfac36 100644 --- a/mysql-test/suite/funcs_1/r/innodb_storedproc_07.result +++ b/mysql-test/suite/funcs_1/r/innodb_storedproc_07.result @@ -80,7 +80,7 @@ CREATE TABLE result (f1 text(200), f2 char(20)); set @@sql_mode='traditional'; SHOW VARIABLES LIKE 'sql_mode'; Variable_name Value -sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER +sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE PROCEDURE sp1() BEGIN declare a tinyint; @@ -97,7 +97,7 @@ END if; END// SHOW CREATE PROCEDURE sp1; Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -sp1 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`() +sp1 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`() BEGIN declare a tinyint; declare count_ int default 1; @@ -117,10 +117,10 @@ Variable_name Value sql_mode CALL sp1(); Variable_name Value -sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER +sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION SELECT * from result; f1 f2 -STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER value restored +STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION value restored SHOW VARIABLES LIKE 'sql_mode'; Variable_name Value sql_mode @@ -142,7 +142,7 @@ DROP PROCEDURE IF EXISTS sp2; ... show initial value SHOW VARIABLES LIKE 'sql_mode'; Variable_name Value -sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER +sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE PROCEDURE sp2() BEGIN SET @@sql_mode='MAXDB'; @@ -150,7 +150,7 @@ SHOW VARIABLES LIKE 'sql_mode'; END// SHOW CREATE PROCEDURE sp2; Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -sp2 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER CREATE DEFINER=`root`@`localhost` PROCEDURE `sp2`() +sp2 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `sp2`() BEGIN SET @@sql_mode='MAXDB'; SHOW VARIABLES LIKE 'sql_mode'; @@ -158,7 +158,7 @@ END latin1 latin1_swedish_ci latin1_swedish_ci ... show value prior calling procedure SHOW VARIABLES LIKE 'sql_mode'; Variable_name Value -sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER +sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION ... call procedure that changes sql_mode CALL sp2(); Variable_name Value @@ -166,7 +166,7 @@ sql_mode PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,MAXDB,NO_KEY_OPTIONS,NO_TABLE_ ... check whether old value is re-set SHOW VARIABLES LIKE 'sql_mode'; Variable_name Value -sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER +sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION DROP PROCEDURE sp2; --source suite/funcs_1/storedproc/cleanup_sp_tb.inc diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_03.result b/mysql-test/suite/funcs_1/r/innodb_trig_03.result index b02fba0f38d..012977ae4a3 100644 --- a/mysql-test/suite/funcs_1/r/innodb_trig_03.result +++ b/mysql-test/suite/funcs_1/r/innodb_trig_03.result @@ -77,7 +77,7 @@ grant ALL on *.* to test_noprivs@localhost; revoke TRIGGER on *.* from test_noprivs@localhost; show grants for test_noprivs@localhost; Grants for test_noprivs@localhost -GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; grant TRIGGER on *.* to test_yesprivs@localhost; grant SELECT on priv_db.t1 to test_yesprivs@localhost; @@ -155,7 +155,7 @@ grant ALL on *.* to test_noprivs@localhost; revoke UPDATE on *.* from test_noprivs@localhost; show grants for test_noprivs@localhost; Grants for test_noprivs@localhost -GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; grant TRIGGER, UPDATE on *.* to test_yesprivs@localhost; show grants for test_yesprivs@localhost; @@ -169,7 +169,7 @@ test_noprivs@localhost use priv_db; show grants; Grants for test_noprivs@localhost -GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' select f1 from t1 order by f1; f1 insert 3.5.3.2-no @@ -401,7 +401,7 @@ grant ALL on *.* to test_noprivs@localhost; revoke SELECT on *.* from test_noprivs@localhost; show grants for test_noprivs@localhost; Grants for test_noprivs@localhost -GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; grant TRIGGER, SELECT on *.* to test_yesprivs@localhost; show grants for test_yesprivs@localhost; @@ -415,7 +415,7 @@ test_noprivs@localhost use priv_db; show grants; Grants for test_noprivs@localhost -GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' create trigger trg5a_1 before INSERT on t1 for each row set @test_var = new.f1; set @test_var = 'before trig 3.5.3.8-1a'; diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_03e.result b/mysql-test/suite/funcs_1/r/innodb_trig_03e.result index 476ccc6ebd8..dc7ca744e27 100644 --- a/mysql-test/suite/funcs_1/r/innodb_trig_03e.result +++ b/mysql-test/suite/funcs_1/r/innodb_trig_03e.result @@ -562,7 +562,7 @@ trig 1_1-yes revoke TRIGGER on *.* from test_yesprivs@localhost; show grants for test_yesprivs@localhost; Grants for test_yesprivs@localhost -GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK); select current_user; current_user @@ -609,7 +609,7 @@ root@localhost grant TRIGGER on priv_db.* to test_yesprivs@localhost; show grants for test_yesprivs@localhost; Grants for test_yesprivs@localhost -GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT TRIGGER ON `priv_db`.* TO 'test_yesprivs'@'localhost' trigger privilege on db level for create: diff --git a/mysql-test/suite/funcs_1/r/innodb_views.result b/mysql-test/suite/funcs_1/r/innodb_views.result index a335e135a4f..eb9713e4bdd 100644 --- a/mysql-test/suite/funcs_1/r/innodb_views.result +++ b/mysql-test/suite/funcs_1/r/innodb_views.result @@ -22843,6 +22843,9 @@ SELECT * FROM v1 order by 2; f1 my_sqrt ABC 0 ABC 1.73205080756888 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'DEF' +Warning 1292 Truncated incorrect DOUBLE value: 'DEF' SELECT SQRT('DEF'); SQRT('DEF') 0 @@ -22863,7 +22866,12 @@ SELECT * FROM v2 order by 2; f1 my_sqrt ABC 0 ABC 1.73205080756888 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'DEF' +Warning 1292 Truncated incorrect DOUBLE value: 'DEF' CREATE TABLE t2 AS SELECT f1, SQRT(f2) my_sqrt FROM t1; +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'DEF' SELECT * FROM t2 order by 2; f1 ABC my_sqrt 0 @@ -22871,6 +22879,8 @@ f1 ABC my_sqrt 1.73205080756888 DROP TABLE t2; CREATE TABLE t2 AS SELECT * FROM v1; +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'DEF' SELECT * FROM t2 order by 2; f1 ABC my_sqrt 0 @@ -22878,6 +22888,8 @@ f1 ABC my_sqrt 1.73205080756888 DROP TABLE t2; CREATE TABLE t2 AS SELECT * FROM v2; +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'DEF' SELECT * FROM t2 order by 2; f1 ABC my_sqrt 0 diff --git a/mysql-test/suite/funcs_1/r/is_columns_is.result b/mysql-test/suite/funcs_1/r/is_columns_is.result index fe2d5e7e5e5..893f3705cd7 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_is.result +++ b/mysql-test/suite/funcs_1/r/is_columns_is.result @@ -192,7 +192,7 @@ NULL information_schema ROUTINES LAST_ALTERED 17 0000-00-00 00:00:00 NO datetime NULL information_schema ROUTINES PARAMETER_STYLE 11 NO varchar 8 24 NULL NULL utf8 utf8_general_ci varchar(8) select NULL information_schema ROUTINES ROUTINE_BODY 7 NO varchar 8 24 NULL NULL utf8 utf8_general_ci varchar(8) select NULL information_schema ROUTINES ROUTINE_CATALOG 2 NULL YES varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select -NULL information_schema ROUTINES ROUTINE_COMMENT 19 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select +NULL information_schema ROUTINES ROUTINE_COMMENT 19 NULL NO longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema ROUTINES ROUTINE_DEFINITION 8 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select NULL information_schema ROUTINES ROUTINE_NAME 4 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select NULL information_schema ROUTINES ROUTINE_SCHEMA 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select @@ -552,7 +552,7 @@ NULL information_schema PROCESSLIST TIME int NULL NULL NULL NULL int(7) NULL information_schema ROUTINES CREATED datetime NULL NULL NULL NULL datetime NULL information_schema ROUTINES LAST_ALTERED datetime NULL NULL NULL NULL datetime 3.0000 information_schema ROUTINES SQL_MODE varchar 8192 24576 utf8 utf8_general_ci varchar(8192) -3.0000 information_schema ROUTINES ROUTINE_COMMENT varchar 64 192 utf8 utf8_general_ci varchar(64) +1.0000 information_schema ROUTINES ROUTINE_COMMENT longtext 4294967295 4294967295 utf8 utf8_general_ci longtext 3.0000 information_schema ROUTINES DEFINER varchar 77 231 utf8 utf8_general_ci varchar(77) 3.0000 information_schema ROUTINES CHARACTER_SET_CLIENT varchar 32 96 utf8 utf8_general_ci varchar(32) 3.0000 information_schema ROUTINES COLLATION_CONNECTION varchar 32 96 utf8 utf8_general_ci varchar(32) diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql.result b/mysql-test/suite/funcs_1/r/is_columns_mysql.result index 2f1f61c0525..706847300f0 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result @@ -110,7 +110,7 @@ NULL mysql proc body 11 NULL NO longblob 4294967295 4294967295 NULL NULL NULL NU NULL mysql proc body_utf8 20 NULL YES longblob 4294967295 4294967295 NULL NULL NULL NULL longblob select,insert,update,references NULL mysql proc character_set_client 17 NULL YES char 32 96 NULL NULL utf8 utf8_bin char(32) select,insert,update,references NULL mysql proc collation_connection 18 NULL YES char 32 96 NULL NULL utf8 utf8_bin char(32) select,insert,update,references -NULL mysql proc comment 16 NO char 64 192 NULL NULL utf8 utf8_bin char(64) select,insert,update,references +NULL mysql proc comment 16 NULL NO text 65535 65535 NULL NULL utf8 utf8_bin text select,insert,update,references NULL mysql proc created 13 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references NULL mysql proc db 1 NO char 64 192 NULL NULL utf8 utf8_bin char(64) PRI select,insert,update,references NULL mysql proc db_collation 19 NULL YES char 32 96 NULL NULL utf8 utf8_bin char(32) select,insert,update,references @@ -180,6 +180,7 @@ NULL mysql user Alter_priv 17 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum( NULL mysql user Alter_routine_priv 28 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NULL mysql user Create_priv 8 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NULL mysql user Create_routine_priv 27 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references +NULL mysql user Create_tablespace_priv 32 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NULL mysql user Create_tmp_table_priv 20 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NULL mysql user Create_user_priv 29 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NULL mysql user Create_view_priv 25 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references @@ -193,10 +194,10 @@ NULL mysql user Host 1 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI sel NULL mysql user Index_priv 16 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NULL mysql user Insert_priv 5 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NULL mysql user Lock_tables_priv 21 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references -NULL mysql user max_connections 38 0 NO int NULL NULL 10 0 NULL NULL int(11) unsigned select,insert,update,references -NULL mysql user max_questions 36 0 NO int NULL NULL 10 0 NULL NULL int(11) unsigned select,insert,update,references -NULL mysql user max_updates 37 0 NO int NULL NULL 10 0 NULL NULL int(11) unsigned select,insert,update,references -NULL mysql user max_user_connections 39 0 NO int NULL NULL 10 0 NULL NULL int(11) unsigned select,insert,update,references +NULL mysql user max_connections 39 0 NO int NULL NULL 10 0 NULL NULL int(11) unsigned select,insert,update,references +NULL mysql user max_questions 37 0 NO int NULL NULL 10 0 NULL NULL int(11) unsigned select,insert,update,references +NULL mysql user max_updates 38 0 NO int NULL NULL 10 0 NULL NULL int(11) unsigned select,insert,update,references +NULL mysql user max_user_connections 40 0 NO int NULL NULL 10 0 NULL NULL int(11) unsigned select,insert,update,references NULL mysql user Password 3 NO char 41 41 NULL NULL latin1 latin1_bin char(41) select,insert,update,references NULL mysql user Process_priv 12 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NULL mysql user References_priv 15 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references @@ -207,14 +208,14 @@ NULL mysql user Select_priv 4 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum( NULL mysql user Show_db_priv 18 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NULL mysql user Show_view_priv 26 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NULL mysql user Shutdown_priv 11 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references -NULL mysql user ssl_cipher 33 NULL NO blob 65535 65535 NULL NULL NULL NULL blob select,insert,update,references -NULL mysql user ssl_type 32 NO enum 9 27 NULL NULL utf8 utf8_general_ci enum('','ANY','X509','SPECIFIED') select,insert,update,references +NULL mysql user ssl_cipher 34 NULL NO blob 65535 65535 NULL NULL NULL NULL blob select,insert,update,references +NULL mysql user ssl_type 33 NO enum 9 27 NULL NULL utf8 utf8_general_ci enum('','ANY','X509','SPECIFIED') select,insert,update,references NULL mysql user Super_priv 19 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NULL mysql user Trigger_priv 31 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NULL mysql user Update_priv 6 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NULL mysql user User 2 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references -NULL mysql user x509_issuer 34 NULL NO blob 65535 65535 NULL NULL NULL NULL blob select,insert,update,references -NULL mysql user x509_subject 35 NULL NO blob 65535 65535 NULL NULL NULL NULL blob select,insert,update,references +NULL mysql user x509_issuer 35 NULL NO blob 65535 65535 NULL NULL NULL NULL blob select,insert,update,references +NULL mysql user x509_subject 36 NULL NO blob 65535 65535 NULL NULL NULL NULL blob select,insert,update,references ########################################################################## # Show the quotient of CHARACTER_OCTET_LENGTH and CHARACTER_MAXIMUM_LENGTH ########################################################################## @@ -233,6 +234,7 @@ COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME 1.0000 char latin1 latin1_bin 1.0000 char latin1 latin1_swedish_ci 1.0000 varchar latin1 latin1_swedish_ci +1.0000 text utf8 utf8_bin 1.0000 mediumtext utf8 utf8_general_ci 1.0000 text utf8 utf8_general_ci SELECT DISTINCT @@ -403,7 +405,7 @@ NULL mysql ndb_binlog_index schemaops bigint NULL NULL NULL NULL bigint(20) unsi NULL mysql proc created timestamp NULL NULL NULL NULL timestamp NULL mysql proc modified timestamp NULL NULL NULL NULL timestamp 3.0000 mysql proc sql_mode set 478 1434 utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') -3.0000 mysql proc comment char 64 192 utf8 utf8_bin char(64) +1.0000 mysql proc comment text 65535 65535 utf8 utf8_bin text 3.0000 mysql proc character_set_client char 32 96 utf8 utf8_bin char(32) 3.0000 mysql proc collation_connection char 32 96 utf8 utf8_bin char(32) 3.0000 mysql proc db_collation char 32 96 utf8 utf8_bin char(32) @@ -489,6 +491,7 @@ NULL mysql time_zone_transition_type Is_DST tinyint NULL NULL NULL NULL tinyint( 3.0000 mysql user Create_user_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') 3.0000 mysql user Event_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') 3.0000 mysql user Trigger_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') +3.0000 mysql user Create_tablespace_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') 3.0000 mysql user ssl_type enum 9 27 utf8 utf8_general_ci enum('','ANY','X509','SPECIFIED') 1.0000 mysql user ssl_cipher blob 65535 65535 NULL NULL blob 1.0000 mysql user x509_issuer blob 65535 65535 NULL NULL blob diff --git a/mysql-test/suite/funcs_1/r/is_routines.result b/mysql-test/suite/funcs_1/r/is_routines.result index 14a7107778c..bfcaa7e0b45 100644 --- a/mysql-test/suite/funcs_1/r/is_routines.result +++ b/mysql-test/suite/funcs_1/r/is_routines.result @@ -46,7 +46,7 @@ SECURITY_TYPE varchar(7) NO CREATED datetime NO 0000-00-00 00:00:00 LAST_ALTERED datetime NO 0000-00-00 00:00:00 SQL_MODE varchar(8192) NO -ROUTINE_COMMENT varchar(64) NO +ROUTINE_COMMENT longtext NO NULL DEFINER varchar(77) NO CHARACTER_SET_CLIENT varchar(32) NO COLLATION_CONNECTION varchar(32) NO @@ -72,7 +72,7 @@ ROUTINES CREATE TEMPORARY TABLE `ROUTINES` ( `CREATED` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `LAST_ALTERED` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `SQL_MODE` varchar(8192) NOT NULL DEFAULT '', - `ROUTINE_COMMENT` varchar(64) NOT NULL DEFAULT '', + `ROUTINE_COMMENT` longtext NOT NULL, `DEFINER` varchar(77) NOT NULL DEFAULT '', `CHARACTER_SET_CLIENT` varchar(32) NOT NULL DEFAULT '', `COLLATION_CONNECTION` varchar(32) NOT NULL DEFAULT '', @@ -98,7 +98,7 @@ SECURITY_TYPE varchar(7) NO CREATED datetime NO 0000-00-00 00:00:00 LAST_ALTERED datetime NO 0000-00-00 00:00:00 SQL_MODE varchar(8192) NO -ROUTINE_COMMENT varchar(64) NO +ROUTINE_COMMENT longtext NO NULL DEFINER varchar(77) NO CHARACTER_SET_CLIENT varchar(32) NO COLLATION_CONNECTION varchar(32) NO diff --git a/mysql-test/suite/funcs_1/r/is_user_privileges.result b/mysql-test/suite/funcs_1/r/is_user_privileges.result index 03865f59c2c..8f9544bbc79 100644 --- a/mysql-test/suite/funcs_1/r/is_user_privileges.result +++ b/mysql-test/suite/funcs_1/r/is_user_privileges.result @@ -76,10 +76,10 @@ GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE 'testuser3'@'localhost' NULL USAGE NO SELECT * FROM mysql.user WHERE user LIKE 'testuser%' ORDER BY host, user; -Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections -localhost testuser1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 -localhost testuser2 N Y Y N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 -localhost testuser3 N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 +Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections +localhost testuser1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 +localhost testuser2 N Y Y N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 +localhost testuser3 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 # # Add GRANT OPTION db_datadict.* to testuser1; GRANT UPDATE ON db_datadict.* TO 'testuser1'@'localhost' WITH GRANT OPTION; @@ -93,10 +93,10 @@ GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE 'testuser3'@'localhost' NULL USAGE NO SELECT * FROM mysql.user WHERE user LIKE 'testuser%' ORDER BY host, user; -Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections -localhost testuser1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 -localhost testuser2 N Y Y N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 -localhost testuser3 N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 +Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections +localhost testuser1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 +localhost testuser2 N Y Y N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 +localhost testuser3 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 # Establish connection testuser1 (user=testuser1) SELECT * FROM information_schema.user_privileges WHERE grantee LIKE '''testuser%''' @@ -105,10 +105,10 @@ GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE 'testuser1'@'localhost' NULL USAGE NO SELECT * FROM mysql.user WHERE user LIKE 'testuser%' ORDER BY host, user; -Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections -localhost testuser1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 -localhost testuser2 N Y Y N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 -localhost testuser3 N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 +Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections +localhost testuser1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 +localhost testuser2 N Y Y N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 +localhost testuser3 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 SHOW GRANTS; Grants for testuser1@localhost GRANT USAGE ON *.* TO 'testuser1'@'localhost' @@ -130,10 +130,10 @@ GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE 'testuser3'@'localhost' NULL USAGE NO SELECT * FROM mysql.user WHERE user LIKE 'testuser%' ORDER BY host, user; -Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections -localhost testuser1 Y N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 -localhost testuser2 N Y Y N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 -localhost testuser3 N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 +Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections +localhost testuser1 Y N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 +localhost testuser2 N Y Y N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 +localhost testuser3 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 GRANT SELECT ON *.* TO 'testuser1'@'localhost' WITH GRANT OPTION; # # Here <SELECT YES> is shown correctly for testuser1; @@ -147,10 +147,10 @@ GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE 'testuser3'@'localhost' NULL USAGE NO SELECT * FROM mysql.user WHERE user LIKE 'testuser%' ORDER BY host, user; -Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections -localhost testuser1 Y N N N N N N N N N Y N N N N N N N N N N N N N N N N N 0 0 0 0 -localhost testuser2 N Y Y N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 -localhost testuser3 N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 +Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections +localhost testuser1 Y N N N N N N N N N Y N N N N N N N N N N N N N N N N N N 0 0 0 0 +localhost testuser2 N Y Y N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 +localhost testuser3 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 # Switch to connection testuser1 SELECT * FROM information_schema.user_privileges WHERE grantee LIKE '''testuser%''' @@ -159,10 +159,10 @@ GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE 'testuser1'@'localhost' NULL SELECT YES SELECT * FROM mysql.user WHERE user LIKE 'testuser%' ORDER BY host, user; -Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections -localhost testuser1 Y N N N N N N N N N Y N N N N N N N N N N N N N N N N N 0 0 0 0 -localhost testuser2 N Y Y N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 -localhost testuser3 N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 +Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections +localhost testuser1 Y N N N N N N N N N Y N N N N N N N N N N N N N N N N N N 0 0 0 0 +localhost testuser2 N Y Y N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 +localhost testuser3 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 SHOW GRANTS; Grants for testuser1@localhost GRANT SELECT ON *.* TO 'testuser1'@'localhost' WITH GRANT OPTION @@ -207,10 +207,10 @@ GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE 'testuser3'@'localhost' NULL USAGE NO SELECT * FROM mysql.user WHERE user LIKE 'testuser%' ORDER BY host, user; -Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections -localhost testuser1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 -localhost testuser2 N Y Y N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 -localhost testuser3 N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 +Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections +localhost testuser1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 +localhost testuser2 N Y Y N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 +localhost testuser3 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 # Switch to connection testuser1 SELECT * FROM information_schema.user_privileges WHERE grantee LIKE '''testuser%''' @@ -253,10 +253,10 @@ GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE 'testuser3'@'localhost' NULL USAGE NO SELECT * FROM mysql.user WHERE user LIKE 'testuser%' ORDER BY host, user; -Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections -localhost testuser1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 -localhost testuser2 N Y Y N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 -localhost testuser3 N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 +Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections +localhost testuser1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 +localhost testuser2 N Y Y N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 +localhost testuser3 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 # Switch to connection testuser1 SELECT * FROM information_schema.user_privileges WHERE grantee LIKE '''testuser%''' @@ -265,10 +265,10 @@ GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE 'testuser1'@'localhost' NULL USAGE NO SELECT * FROM mysql.user WHERE user LIKE 'testuser%' ORDER BY host, user; -Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections -localhost testuser1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 -localhost testuser2 N Y Y N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 -localhost testuser3 N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 +Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections +localhost testuser1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 +localhost testuser2 N Y Y N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 +localhost testuser3 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 SHOW GRANTS; Grants for testuser1@localhost GRANT USAGE ON *.* TO 'testuser1'@'localhost' @@ -284,10 +284,10 @@ GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE 'testuser1'@'localhost' NULL USAGE NO SELECT * FROM mysql.user WHERE user LIKE 'testuser%' ORDER BY host, user; -Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections -localhost testuser1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 -localhost testuser2 N Y Y N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 -localhost testuser3 N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 +Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections +localhost testuser1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 +localhost testuser2 N Y Y N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 +localhost testuser3 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 SHOW GRANTS; Grants for testuser1@localhost GRANT USAGE ON *.* TO 'testuser1'@'localhost' @@ -309,10 +309,10 @@ GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE 'testuser3'@'localhost' NULL USAGE NO SELECT * FROM mysql.user WHERE user LIKE 'testuser%' ORDER BY host, user; -Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections -localhost testuser1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 -localhost testuser2 N Y Y N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 -localhost testuser3 N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 +Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections +localhost testuser1 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 +localhost testuser2 N Y Y N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 +localhost testuser3 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 # Switch to connection testuser1 SELECT * FROM information_schema.user_privileges WHERE grantee LIKE '''testuser%''' diff --git a/mysql-test/suite/funcs_1/r/memory_func_view.result b/mysql-test/suite/funcs_1/r/memory_func_view.result index a386272b8ab..c61b98d3428 100644 --- a/mysql-test/suite/funcs_1/r/memory_func_view.result +++ b/mysql-test/suite/funcs_1/r/memory_func_view.result @@ -2097,6 +2097,9 @@ IS NOT TRUE 2 IS NOT TRUE <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' +Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varbinary_1000`,'IS TRUE','IS NOT TRUE') AS `IF(my_varbinary_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -2109,6 +2112,9 @@ IS NOT TRUE 2 IS NOT TRUE <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' +Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' DROP VIEW v1; @@ -2159,6 +2165,9 @@ IS NOT TRUE 2 IS NOT TRUE <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' +Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varchar_1000`,'IS TRUE','IS NOT TRUE') AS `IF(my_varchar_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -2171,6 +2180,9 @@ IS NOT TRUE 2 IS NOT TRUE <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' +Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' DROP VIEW v1; @@ -3374,8 +3386,11 @@ NULL NULL 1 -3333.33 -3333.3333 29 Warnings: Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -3391,8 +3406,11 @@ NULL NULL 1 -3333.33 -3333.3333 29 Warnings: Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' DROP VIEW v1; @@ -3456,8 +3474,11 @@ NULL NULL 1 -3333.33 -3333.3333 27 Warnings: Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -3473,8 +3494,11 @@ NULL NULL 1 -3333.33 -3333.3333 27 Warnings: Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' DROP VIEW v1; diff --git a/mysql-test/suite/funcs_1/r/memory_storedproc_07.result b/mysql-test/suite/funcs_1/r/memory_storedproc_07.result index 596b63316ce..2b8d41f963e 100644 --- a/mysql-test/suite/funcs_1/r/memory_storedproc_07.result +++ b/mysql-test/suite/funcs_1/r/memory_storedproc_07.result @@ -81,7 +81,7 @@ CREATE TABLE result (f1 text(200), f2 char(20)); set @@sql_mode='traditional'; SHOW VARIABLES LIKE 'sql_mode'; Variable_name Value -sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER +sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE PROCEDURE sp1() BEGIN declare a tinyint; @@ -98,7 +98,7 @@ END if; END// SHOW CREATE PROCEDURE sp1; Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -sp1 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`() +sp1 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`() BEGIN declare a tinyint; declare count_ int default 1; @@ -118,10 +118,10 @@ Variable_name Value sql_mode CALL sp1(); Variable_name Value -sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER +sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION SELECT * from result; f1 f2 -STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER value restored +STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION value restored SHOW VARIABLES LIKE 'sql_mode'; Variable_name Value sql_mode @@ -143,7 +143,7 @@ DROP PROCEDURE IF EXISTS sp2; ... show initial value SHOW VARIABLES LIKE 'sql_mode'; Variable_name Value -sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER +sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE PROCEDURE sp2() BEGIN SET @@sql_mode='MAXDB'; @@ -151,7 +151,7 @@ SHOW VARIABLES LIKE 'sql_mode'; END// SHOW CREATE PROCEDURE sp2; Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -sp2 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER CREATE DEFINER=`root`@`localhost` PROCEDURE `sp2`() +sp2 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `sp2`() BEGIN SET @@sql_mode='MAXDB'; SHOW VARIABLES LIKE 'sql_mode'; @@ -159,7 +159,7 @@ END latin1 latin1_swedish_ci latin1_swedish_ci ... show value prior calling procedure SHOW VARIABLES LIKE 'sql_mode'; Variable_name Value -sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER +sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION ... call procedure that changes sql_mode CALL sp2(); Variable_name Value @@ -167,7 +167,7 @@ sql_mode PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,MAXDB,NO_KEY_OPTIONS,NO_TABLE_ ... check whether old value is re-set SHOW VARIABLES LIKE 'sql_mode'; Variable_name Value -sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER +sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION DROP PROCEDURE sp2; --source suite/funcs_1/storedproc/cleanup_sp_tb.inc diff --git a/mysql-test/suite/funcs_1/r/memory_trig_03.result b/mysql-test/suite/funcs_1/r/memory_trig_03.result index 7f38fd1f182..65bc7deef8c 100644 --- a/mysql-test/suite/funcs_1/r/memory_trig_03.result +++ b/mysql-test/suite/funcs_1/r/memory_trig_03.result @@ -78,7 +78,7 @@ grant ALL on *.* to test_noprivs@localhost; revoke TRIGGER on *.* from test_noprivs@localhost; show grants for test_noprivs@localhost; Grants for test_noprivs@localhost -GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; grant TRIGGER on *.* to test_yesprivs@localhost; grant SELECT on priv_db.t1 to test_yesprivs@localhost; @@ -156,7 +156,7 @@ grant ALL on *.* to test_noprivs@localhost; revoke UPDATE on *.* from test_noprivs@localhost; show grants for test_noprivs@localhost; Grants for test_noprivs@localhost -GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; grant TRIGGER, UPDATE on *.* to test_yesprivs@localhost; show grants for test_yesprivs@localhost; @@ -170,7 +170,7 @@ test_noprivs@localhost use priv_db; show grants; Grants for test_noprivs@localhost -GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' select f1 from t1 order by f1; f1 insert 3.5.3.2-no @@ -402,7 +402,7 @@ grant ALL on *.* to test_noprivs@localhost; revoke SELECT on *.* from test_noprivs@localhost; show grants for test_noprivs@localhost; Grants for test_noprivs@localhost -GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; grant TRIGGER, SELECT on *.* to test_yesprivs@localhost; show grants for test_yesprivs@localhost; @@ -416,7 +416,7 @@ test_noprivs@localhost use priv_db; show grants; Grants for test_noprivs@localhost -GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' create trigger trg5a_1 before INSERT on t1 for each row set @test_var = new.f1; set @test_var = 'before trig 3.5.3.8-1a'; diff --git a/mysql-test/suite/funcs_1/r/memory_trig_03e.result b/mysql-test/suite/funcs_1/r/memory_trig_03e.result index bbee7d47e7e..1418bf82b12 100644 --- a/mysql-test/suite/funcs_1/r/memory_trig_03e.result +++ b/mysql-test/suite/funcs_1/r/memory_trig_03e.result @@ -563,7 +563,7 @@ trig 1_1-yes revoke TRIGGER on *.* from test_yesprivs@localhost; show grants for test_yesprivs@localhost; Grants for test_yesprivs@localhost -GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK); select current_user; current_user @@ -610,7 +610,7 @@ root@localhost grant TRIGGER on priv_db.* to test_yesprivs@localhost; show grants for test_yesprivs@localhost; Grants for test_yesprivs@localhost -GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT TRIGGER ON `priv_db`.* TO 'test_yesprivs'@'localhost' trigger privilege on db level for create: diff --git a/mysql-test/suite/funcs_1/r/memory_views.result b/mysql-test/suite/funcs_1/r/memory_views.result index ccbd086b71f..b018a5ad863 100644 --- a/mysql-test/suite/funcs_1/r/memory_views.result +++ b/mysql-test/suite/funcs_1/r/memory_views.result @@ -22845,6 +22845,9 @@ SELECT * FROM v1 order by 2; f1 my_sqrt ABC 0 ABC 1.73205080756888 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'DEF' +Warning 1292 Truncated incorrect DOUBLE value: 'DEF' SELECT SQRT('DEF'); SQRT('DEF') 0 @@ -22865,7 +22868,12 @@ SELECT * FROM v2 order by 2; f1 my_sqrt ABC 0 ABC 1.73205080756888 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'DEF' +Warning 1292 Truncated incorrect DOUBLE value: 'DEF' CREATE TABLE t2 AS SELECT f1, SQRT(f2) my_sqrt FROM t1; +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'DEF' SELECT * FROM t2 order by 2; f1 ABC my_sqrt 0 @@ -22873,6 +22881,8 @@ f1 ABC my_sqrt 1.73205080756888 DROP TABLE t2; CREATE TABLE t2 AS SELECT * FROM v1; +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'DEF' SELECT * FROM t2 order by 2; f1 ABC my_sqrt 0 @@ -22880,6 +22890,8 @@ f1 ABC my_sqrt 1.73205080756888 DROP TABLE t2; CREATE TABLE t2 AS SELECT * FROM v2; +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'DEF' SELECT * FROM t2 order by 2; f1 ABC my_sqrt 0 diff --git a/mysql-test/suite/funcs_1/r/myisam_func_view.result b/mysql-test/suite/funcs_1/r/myisam_func_view.result index a386272b8ab..c61b98d3428 100644 --- a/mysql-test/suite/funcs_1/r/myisam_func_view.result +++ b/mysql-test/suite/funcs_1/r/myisam_func_view.result @@ -2097,6 +2097,9 @@ IS NOT TRUE 2 IS NOT TRUE <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' +Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varbinary_1000`,'IS TRUE','IS NOT TRUE') AS `IF(my_varbinary_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -2109,6 +2112,9 @@ IS NOT TRUE 2 IS NOT TRUE <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' +Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' DROP VIEW v1; @@ -2159,6 +2165,9 @@ IS NOT TRUE 2 IS NOT TRUE <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' +Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varchar_1000`,'IS TRUE','IS NOT TRUE') AS `IF(my_varchar_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -2171,6 +2180,9 @@ IS NOT TRUE 2 IS NOT TRUE <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' +Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' DROP VIEW v1; @@ -3374,8 +3386,11 @@ NULL NULL 1 -3333.33 -3333.3333 29 Warnings: Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -3391,8 +3406,11 @@ NULL NULL 1 -3333.33 -3333.3333 29 Warnings: Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' DROP VIEW v1; @@ -3456,8 +3474,11 @@ NULL NULL 1 -3333.33 -3333.3333 27 Warnings: Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -3473,8 +3494,11 @@ NULL NULL 1 -3333.33 -3333.3333 27 Warnings: Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' DROP VIEW v1; diff --git a/mysql-test/suite/funcs_1/r/myisam_storedproc_07.result b/mysql-test/suite/funcs_1/r/myisam_storedproc_07.result index 596b63316ce..2b8d41f963e 100644 --- a/mysql-test/suite/funcs_1/r/myisam_storedproc_07.result +++ b/mysql-test/suite/funcs_1/r/myisam_storedproc_07.result @@ -81,7 +81,7 @@ CREATE TABLE result (f1 text(200), f2 char(20)); set @@sql_mode='traditional'; SHOW VARIABLES LIKE 'sql_mode'; Variable_name Value -sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER +sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE PROCEDURE sp1() BEGIN declare a tinyint; @@ -98,7 +98,7 @@ END if; END// SHOW CREATE PROCEDURE sp1; Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -sp1 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`() +sp1 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`() BEGIN declare a tinyint; declare count_ int default 1; @@ -118,10 +118,10 @@ Variable_name Value sql_mode CALL sp1(); Variable_name Value -sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER +sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION SELECT * from result; f1 f2 -STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER value restored +STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION value restored SHOW VARIABLES LIKE 'sql_mode'; Variable_name Value sql_mode @@ -143,7 +143,7 @@ DROP PROCEDURE IF EXISTS sp2; ... show initial value SHOW VARIABLES LIKE 'sql_mode'; Variable_name Value -sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER +sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE PROCEDURE sp2() BEGIN SET @@sql_mode='MAXDB'; @@ -151,7 +151,7 @@ SHOW VARIABLES LIKE 'sql_mode'; END// SHOW CREATE PROCEDURE sp2; Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -sp2 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER CREATE DEFINER=`root`@`localhost` PROCEDURE `sp2`() +sp2 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `sp2`() BEGIN SET @@sql_mode='MAXDB'; SHOW VARIABLES LIKE 'sql_mode'; @@ -159,7 +159,7 @@ END latin1 latin1_swedish_ci latin1_swedish_ci ... show value prior calling procedure SHOW VARIABLES LIKE 'sql_mode'; Variable_name Value -sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER +sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION ... call procedure that changes sql_mode CALL sp2(); Variable_name Value @@ -167,7 +167,7 @@ sql_mode PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,MAXDB,NO_KEY_OPTIONS,NO_TABLE_ ... check whether old value is re-set SHOW VARIABLES LIKE 'sql_mode'; Variable_name Value -sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER +sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION DROP PROCEDURE sp2; --source suite/funcs_1/storedproc/cleanup_sp_tb.inc diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_03.result b/mysql-test/suite/funcs_1/r/myisam_trig_03.result index 7f38fd1f182..65bc7deef8c 100644 --- a/mysql-test/suite/funcs_1/r/myisam_trig_03.result +++ b/mysql-test/suite/funcs_1/r/myisam_trig_03.result @@ -78,7 +78,7 @@ grant ALL on *.* to test_noprivs@localhost; revoke TRIGGER on *.* from test_noprivs@localhost; show grants for test_noprivs@localhost; Grants for test_noprivs@localhost -GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; grant TRIGGER on *.* to test_yesprivs@localhost; grant SELECT on priv_db.t1 to test_yesprivs@localhost; @@ -156,7 +156,7 @@ grant ALL on *.* to test_noprivs@localhost; revoke UPDATE on *.* from test_noprivs@localhost; show grants for test_noprivs@localhost; Grants for test_noprivs@localhost -GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; grant TRIGGER, UPDATE on *.* to test_yesprivs@localhost; show grants for test_yesprivs@localhost; @@ -170,7 +170,7 @@ test_noprivs@localhost use priv_db; show grants; Grants for test_noprivs@localhost -GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' select f1 from t1 order by f1; f1 insert 3.5.3.2-no @@ -402,7 +402,7 @@ grant ALL on *.* to test_noprivs@localhost; revoke SELECT on *.* from test_noprivs@localhost; show grants for test_noprivs@localhost; Grants for test_noprivs@localhost -GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; grant TRIGGER, SELECT on *.* to test_yesprivs@localhost; show grants for test_yesprivs@localhost; @@ -416,7 +416,7 @@ test_noprivs@localhost use priv_db; show grants; Grants for test_noprivs@localhost -GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' create trigger trg5a_1 before INSERT on t1 for each row set @test_var = new.f1; set @test_var = 'before trig 3.5.3.8-1a'; diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_03e.result b/mysql-test/suite/funcs_1/r/myisam_trig_03e.result index e4dc67098ad..3b38eb36f37 100644 --- a/mysql-test/suite/funcs_1/r/myisam_trig_03e.result +++ b/mysql-test/suite/funcs_1/r/myisam_trig_03e.result @@ -563,7 +563,7 @@ trig 1_1-yes revoke TRIGGER on *.* from test_yesprivs@localhost; show grants for test_yesprivs@localhost; Grants for test_yesprivs@localhost -GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK); select current_user; current_user @@ -610,7 +610,7 @@ root@localhost grant TRIGGER on priv_db.* to test_yesprivs@localhost; show grants for test_yesprivs@localhost; Grants for test_yesprivs@localhost -GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT TRIGGER ON `priv_db`.* TO 'test_yesprivs'@'localhost' trigger privilege on db level for create: diff --git a/mysql-test/suite/funcs_1/r/myisam_views.result b/mysql-test/suite/funcs_1/r/myisam_views.result index 9b07a0ae45b..a228245483e 100644 --- a/mysql-test/suite/funcs_1/r/myisam_views.result +++ b/mysql-test/suite/funcs_1/r/myisam_views.result @@ -24547,6 +24547,9 @@ SELECT * FROM v1 order by 2; f1 my_sqrt ABC 0 ABC 1.73205080756888 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'DEF' +Warning 1292 Truncated incorrect DOUBLE value: 'DEF' SELECT SQRT('DEF'); SQRT('DEF') 0 @@ -24567,7 +24570,12 @@ SELECT * FROM v2 order by 2; f1 my_sqrt ABC 0 ABC 1.73205080756888 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'DEF' +Warning 1292 Truncated incorrect DOUBLE value: 'DEF' CREATE TABLE t2 AS SELECT f1, SQRT(f2) my_sqrt FROM t1; +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'DEF' SELECT * FROM t2 order by 2; f1 ABC my_sqrt 0 @@ -24575,6 +24583,8 @@ f1 ABC my_sqrt 1.73205080756888 DROP TABLE t2; CREATE TABLE t2 AS SELECT * FROM v1; +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'DEF' SELECT * FROM t2 order by 2; f1 ABC my_sqrt 0 @@ -24582,6 +24592,8 @@ f1 ABC my_sqrt 1.73205080756888 DROP TABLE t2; CREATE TABLE t2 AS SELECT * FROM v2; +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'DEF' SELECT * FROM t2 order by 2; f1 ABC my_sqrt 0 diff --git a/mysql-test/suite/funcs_1/r/ndb_func_view.result b/mysql-test/suite/funcs_1/r/ndb_func_view.result index 172f410b949..0347dc0e2e8 100644 --- a/mysql-test/suite/funcs_1/r/ndb_func_view.result +++ b/mysql-test/suite/funcs_1/r/ndb_func_view.result @@ -2096,6 +2096,9 @@ IS NOT TRUE 2 IS NOT TRUE <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' +Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varbinary_1000`,'IS TRUE','IS NOT TRUE') AS `IF(my_varbinary_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -2108,6 +2111,9 @@ IS NOT TRUE 2 IS NOT TRUE <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' +Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' DROP VIEW v1; @@ -2158,6 +2164,9 @@ IS NOT TRUE 2 IS NOT TRUE <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' +Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_varchar_1000`,'IS TRUE','IS NOT TRUE') AS `IF(my_varchar_1000, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -2170,6 +2179,9 @@ IS NOT TRUE 2 IS NOT TRUE <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 IS NOT TRUE ---äÖüß@µ*$-- 4 IS TRUE -1 5 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' +Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' DROP VIEW v1; @@ -3373,8 +3385,11 @@ NULL NULL 1 -3333.33 -3333.3333 29 Warnings: Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as decimal(37,2)) AS `CAST(my_varbinary_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -3390,8 +3405,11 @@ NULL NULL 1 -3333.33 -3333.3333 29 Warnings: Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' DROP VIEW v1; @@ -3455,8 +3473,11 @@ NULL NULL 1 -3333.33 -3333.3333 27 Warnings: Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as decimal(37,2)) AS `CAST(my_varchar_1000 AS DECIMAL(37,2))`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -3472,8 +3493,11 @@ NULL NULL 1 -3333.33 -3333.3333 27 Warnings: Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' Warning 1366 Incorrect decimal value: '' for column '' at row -1 +Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' DROP VIEW v1; diff --git a/mysql-test/suite/funcs_1/r/ndb_storedproc_07.result b/mysql-test/suite/funcs_1/r/ndb_storedproc_07.result index 5a2c0bb6bdf..a520bdfac36 100644 --- a/mysql-test/suite/funcs_1/r/ndb_storedproc_07.result +++ b/mysql-test/suite/funcs_1/r/ndb_storedproc_07.result @@ -80,7 +80,7 @@ CREATE TABLE result (f1 text(200), f2 char(20)); set @@sql_mode='traditional'; SHOW VARIABLES LIKE 'sql_mode'; Variable_name Value -sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER +sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE PROCEDURE sp1() BEGIN declare a tinyint; @@ -97,7 +97,7 @@ END if; END// SHOW CREATE PROCEDURE sp1; Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -sp1 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`() +sp1 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`() BEGIN declare a tinyint; declare count_ int default 1; @@ -117,10 +117,10 @@ Variable_name Value sql_mode CALL sp1(); Variable_name Value -sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER +sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION SELECT * from result; f1 f2 -STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER value restored +STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION value restored SHOW VARIABLES LIKE 'sql_mode'; Variable_name Value sql_mode @@ -142,7 +142,7 @@ DROP PROCEDURE IF EXISTS sp2; ... show initial value SHOW VARIABLES LIKE 'sql_mode'; Variable_name Value -sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER +sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE PROCEDURE sp2() BEGIN SET @@sql_mode='MAXDB'; @@ -150,7 +150,7 @@ SHOW VARIABLES LIKE 'sql_mode'; END// SHOW CREATE PROCEDURE sp2; Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -sp2 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER CREATE DEFINER=`root`@`localhost` PROCEDURE `sp2`() +sp2 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `sp2`() BEGIN SET @@sql_mode='MAXDB'; SHOW VARIABLES LIKE 'sql_mode'; @@ -158,7 +158,7 @@ END latin1 latin1_swedish_ci latin1_swedish_ci ... show value prior calling procedure SHOW VARIABLES LIKE 'sql_mode'; Variable_name Value -sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER +sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION ... call procedure that changes sql_mode CALL sp2(); Variable_name Value @@ -166,7 +166,7 @@ sql_mode PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,MAXDB,NO_KEY_OPTIONS,NO_TABLE_ ... check whether old value is re-set SHOW VARIABLES LIKE 'sql_mode'; Variable_name Value -sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER +sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION DROP PROCEDURE sp2; --source suite/funcs_1/storedproc/cleanup_sp_tb.inc diff --git a/mysql-test/suite/funcs_1/r/ndb_trig_03.result b/mysql-test/suite/funcs_1/r/ndb_trig_03.result index b02fba0f38d..012977ae4a3 100644 --- a/mysql-test/suite/funcs_1/r/ndb_trig_03.result +++ b/mysql-test/suite/funcs_1/r/ndb_trig_03.result @@ -77,7 +77,7 @@ grant ALL on *.* to test_noprivs@localhost; revoke TRIGGER on *.* from test_noprivs@localhost; show grants for test_noprivs@localhost; Grants for test_noprivs@localhost -GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; grant TRIGGER on *.* to test_yesprivs@localhost; grant SELECT on priv_db.t1 to test_yesprivs@localhost; @@ -155,7 +155,7 @@ grant ALL on *.* to test_noprivs@localhost; revoke UPDATE on *.* from test_noprivs@localhost; show grants for test_noprivs@localhost; Grants for test_noprivs@localhost -GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; grant TRIGGER, UPDATE on *.* to test_yesprivs@localhost; show grants for test_yesprivs@localhost; @@ -169,7 +169,7 @@ test_noprivs@localhost use priv_db; show grants; Grants for test_noprivs@localhost -GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' select f1 from t1 order by f1; f1 insert 3.5.3.2-no @@ -401,7 +401,7 @@ grant ALL on *.* to test_noprivs@localhost; revoke SELECT on *.* from test_noprivs@localhost; show grants for test_noprivs@localhost; Grants for test_noprivs@localhost -GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost; grant TRIGGER, SELECT on *.* to test_yesprivs@localhost; show grants for test_yesprivs@localhost; @@ -415,7 +415,7 @@ test_noprivs@localhost use priv_db; show grants; Grants for test_noprivs@localhost -GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' create trigger trg5a_1 before INSERT on t1 for each row set @test_var = new.f1; set @test_var = 'before trig 3.5.3.8-1a'; diff --git a/mysql-test/suite/funcs_1/r/ndb_trig_03e.result b/mysql-test/suite/funcs_1/r/ndb_trig_03e.result index 84260822edf..991fddb19de 100644 --- a/mysql-test/suite/funcs_1/r/ndb_trig_03e.result +++ b/mysql-test/suite/funcs_1/r/ndb_trig_03e.result @@ -562,7 +562,7 @@ trig 1_1-yes revoke TRIGGER on *.* from test_yesprivs@localhost; show grants for test_yesprivs@localhost; Grants for test_yesprivs@localhost -GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' connect(localhost,test_yesprivs,PWD,test,MASTER_MYPORT,MASTER_MYSOCK); select current_user; current_user @@ -609,7 +609,7 @@ root@localhost grant TRIGGER on priv_db.* to test_yesprivs@localhost; show grants for test_yesprivs@localhost; Grants for test_yesprivs@localhost -GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' +GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576' GRANT TRIGGER ON `priv_db`.* TO 'test_yesprivs'@'localhost' trigger privilege on db level for create: diff --git a/mysql-test/suite/funcs_1/r/ndb_views.result b/mysql-test/suite/funcs_1/r/ndb_views.result index b75f4955986..0f35649b393 100644 --- a/mysql-test/suite/funcs_1/r/ndb_views.result +++ b/mysql-test/suite/funcs_1/r/ndb_views.result @@ -22843,6 +22843,9 @@ SELECT * FROM v1 order by 2; f1 my_sqrt ABC 0 ABC 1.73205080756888 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'DEF' +Warning 1292 Truncated incorrect DOUBLE value: 'DEF' SELECT SQRT('DEF'); SQRT('DEF') 0 @@ -22863,7 +22866,12 @@ SELECT * FROM v2 order by 2; f1 my_sqrt ABC 0 ABC 1.73205080756888 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'DEF' +Warning 1292 Truncated incorrect DOUBLE value: 'DEF' CREATE TABLE t2 AS SELECT f1, SQRT(f2) my_sqrt FROM t1; +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'DEF' SELECT * FROM t2 order by 2; f1 ABC my_sqrt 0 @@ -22871,6 +22879,8 @@ f1 ABC my_sqrt 1.73205080756888 DROP TABLE t2; CREATE TABLE t2 AS SELECT * FROM v1; +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'DEF' SELECT * FROM t2 order by 2; f1 ABC my_sqrt 0 @@ -22878,6 +22888,8 @@ f1 ABC my_sqrt 1.73205080756888 DROP TABLE t2; CREATE TABLE t2 AS SELECT * FROM v2; +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'DEF' SELECT * FROM t2 order by 2; f1 ABC my_sqrt 0 diff --git a/mysql-test/suite/funcs_1/r/storedproc.result b/mysql-test/suite/funcs_1/r/storedproc.result index ab917fce339..fc05dbc889f 100644 --- a/mysql-test/suite/funcs_1/r/storedproc.result +++ b/mysql-test/suite/funcs_1/r/storedproc.result @@ -22115,7 +22115,7 @@ f1 2005-03-14 01:01:02 SELECT @@sql_mode; @@sql_mode -STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER +STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION DROP PROCEDURE sp2; drop table temp_table; diff --git a/mysql-test/suite/ndb/r/ndb_dd_ddl.result b/mysql-test/suite/ndb/r/ndb_dd_ddl.result index 2bf30f5c7fc..9714a89c2ab 100644 --- a/mysql-test/suite/ndb/r/ndb_dd_ddl.result +++ b/mysql-test/suite/ndb/r/ndb_dd_ddl.result @@ -236,3 +236,79 @@ engine ndb; ERROR HY000: Failed to drop TABLESPACE drop logfile group lg1 engine ndb; + +# ----------------------------------------------------------------- +# End 5.1 test +# ----------------------------------------------------------------- + +# -- +# -- WL#4300: Define privileges for tablespaces. +# -- +GRANT CREATE TABLESPACE ON *.* TO mysqltest_u1@localhost; + +DROP DATABASE IF EXISTS mysqltest2; +CREATE DATABASE mysqltest2; +GRANT ALL PRIVILEGES ON mysqltest2.* TO mysqltest_u2@localhost; + +# -- Connection: mysqltest_u1@localhost + +# -- Grants for mysqltest_u1@localhost: +SHOW GRANTS; +Grants for mysqltest_u1@localhost +GRANT CREATE TABLESPACE ON *.* TO 'mysqltest_u1'@'localhost' + +# -- Check CREATE LOGFILE GROUP... +CREATE LOGFILE GROUP lg1 +ADD UNDOFILE 'undofile.dat' +INITIAL_SIZE 1M +UNDO_BUFFER_SIZE = 1M +ENGINE = NDB; + +# -- Check ALTER LOGFILE GROUP... +ALTER LOGFILE GROUP lg1 +ADD UNDOFILE 'undofile02.dat' +INITIAL_SIZE 1M +ENGINE = NDB; + +# -- Check CREATE TABLESPACE... +CREATE TABLESPACE ts1 +ADD DATAFILE 'datafile.dat' +USE LOGFILE GROUP lg1 +INITIAL_SIZE 1M +ENGINE = NDB; + +# -- Check ALTER TABLESPACE... +ALTER TABLESPACE ts1 +DROP DATAFILE 'datafile.dat' +INITIAL_SIZE 1M +ENGINE = NDB; + +# -- Connection: mysqltest_u2@localhost + +# -- Grants for mysqltest_u2@localhost: +SHOW GRANTS; +Grants for mysqltest_u2@localhost +GRANT USAGE ON *.* TO 'mysqltest_u2'@'localhost' +GRANT ALL PRIVILEGES ON `mysqltest2`.* TO 'mysqltest_u2'@'localhost' +CREATE TABLE t1(c INT) TABLESPACE ts1; +DROP TABLE t1; + +# -- Connection: mysqltest_u1@localhost + + +# -- Check DROP TABLESPACE... +DROP TABLESPACE ts1 +ENGINE = NDB; + +# -- Check DROP LOGFILE GROUP... +DROP LOGFILE GROUP lg1 +ENGINE = NDB; + +# -- Connection: root@localhost + +DROP USER mysqltest_u1@localhost; +DROP USER mysqltest_u2@localhost; + +# ----------------------------------------------------------------- +# End 6.0 test +# ----------------------------------------------------------------- diff --git a/mysql-test/suite/ndb/r/ps_7ndb.result b/mysql-test/suite/ndb/r/ps_7ndb.result index 73a2e0c1dda..e57fdcb6df6 100644 --- a/mysql-test/suite/ndb/r/ps_7ndb.result +++ b/mysql-test/suite/ndb/r/ps_7ndb.result @@ -59,8 +59,8 @@ def test t9 t9 c7 c7 4 12 1 Y 32768 31 63 def test t9 t9 c8 c8 5 22 1 Y 32768 31 63 def test t9 t9 c9 c9 5 22 1 Y 32768 31 63 def test t9 t9 c10 c10 5 22 1 Y 32768 31 63 -def test t9 t9 c11 c11 246 9 6 Y 0 4 63 -def test t9 t9 c12 c12 246 10 6 Y 0 4 63 +def test t9 t9 c11 c11 246 9 6 Y 32768 4 63 +def test t9 t9 c12 c12 246 10 6 Y 32768 4 63 def test t9 t9 c13 c13 10 10 10 Y 128 0 63 def test t9 t9 c14 c14 12 19 19 Y 128 0 63 def test t9 t9 c15 c15 7 19 19 N 9441 0 63 @@ -1790,8 +1790,8 @@ select * from t5 ; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr def test t5 t5 const01 const01 3 1 1 N 32769 0 63 def test t5 t5 param01 param01 8 20 1 Y 32768 0 63 -def test t5 t5 const02 const02 246 4 3 N 1 1 63 -def test t5 t5 param02 param02 246 67 32 Y 0 30 63 +def test t5 t5 const02 const02 246 4 3 N 32769 1 63 +def test t5 t5 param02 param02 246 67 32 Y 32768 30 63 def test t5 t5 const03 const03 5 17 1 N 32769 31 63 def test t5 t5 param03 param03 5 23 1 Y 32768 31 63 def test t5 t5 const04 const04 253 3 3 N 1 0 8 @@ -1812,7 +1812,7 @@ def test t5 t5 const11 const11 3 4 4 Y 32768 0 63 def test t5 t5 param11 param11 8 20 4 Y 32768 0 63 def test t5 t5 const12 const12 254 0 0 Y 128 0 63 def test t5 t5 param12 param12 8 20 0 Y 32768 0 63 -def test t5 t5 param13 param13 246 67 0 Y 0 30 63 +def test t5 t5 param13 param13 246 67 0 Y 32768 30 63 def test t5 t5 param14 param14 252 4294967295 0 Y 16 0 8 def test t5 t5 param15 param15 252 4294967295 0 Y 144 0 63 const01 8 @@ -1910,8 +1910,8 @@ def @arg07 5 23 1 Y 32896 31 63 def @arg08 5 23 1 Y 32896 31 63 def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 -def @arg11 246 83 6 Y 128 30 63 -def @arg12 246 83 6 Y 128 30 63 +def @arg11 246 83 6 Y 32896 30 63 +def @arg12 246 83 6 Y 32896 30 63 def @arg13 251 16777216 10 Y 128 31 63 def @arg14 251 16777216 19 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -1957,8 +1957,8 @@ def @arg07 5 23 0 Y 32896 31 63 def @arg08 5 23 0 Y 32896 31 63 def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 -def @arg11 246 83 0 Y 128 30 63 -def @arg12 246 83 0 Y 128 30 63 +def @arg11 246 83 0 Y 32896 30 63 +def @arg12 246 83 0 Y 32896 30 63 def @arg13 251 16777216 0 Y 128 31 63 def @arg14 251 16777216 0 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -2007,8 +2007,8 @@ def @arg07 5 23 1 Y 32896 31 63 def @arg08 5 23 1 Y 32896 31 63 def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 -def @arg11 246 83 6 Y 128 30 63 -def @arg12 246 83 6 Y 128 30 63 +def @arg11 246 83 6 Y 32896 30 63 +def @arg12 246 83 6 Y 32896 30 63 def @arg13 251 16777216 10 Y 128 31 63 def @arg14 251 16777216 19 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -2047,8 +2047,8 @@ def @arg07 5 23 0 Y 32896 31 63 def @arg08 5 23 0 Y 32896 31 63 def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 -def @arg11 246 83 0 Y 128 30 63 -def @arg12 246 83 0 Y 128 30 63 +def @arg11 246 83 0 Y 32896 30 63 +def @arg12 246 83 0 Y 32896 30 63 def @arg13 251 16777216 0 Y 128 31 63 def @arg14 251 16777216 0 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -2095,8 +2095,8 @@ def @arg07 5 23 1 Y 32896 31 63 def @arg08 5 23 1 Y 32896 31 63 def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 -def @arg11 246 83 6 Y 128 30 63 -def @arg12 246 83 6 Y 128 30 63 +def @arg11 246 83 6 Y 32896 30 63 +def @arg12 246 83 6 Y 32896 30 63 def @arg13 251 16777216 10 Y 128 31 63 def @arg14 251 16777216 19 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -2139,8 +2139,8 @@ def @arg07 5 23 0 Y 32896 31 63 def @arg08 5 23 0 Y 32896 31 63 def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 -def @arg11 246 83 0 Y 128 30 63 -def @arg12 246 83 0 Y 128 30 63 +def @arg11 246 83 0 Y 32896 30 63 +def @arg12 246 83 0 Y 32896 30 63 def @arg13 251 16777216 0 Y 128 31 63 def @arg14 251 16777216 0 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -2185,8 +2185,8 @@ def @arg07 5 23 1 Y 32896 31 63 def @arg08 5 23 1 Y 32896 31 63 def @arg09 5 23 1 Y 32896 31 63 def @arg10 5 23 1 Y 32896 31 63 -def @arg11 246 83 6 Y 128 30 63 -def @arg12 246 83 6 Y 128 30 63 +def @arg11 246 83 6 Y 32896 30 63 +def @arg12 246 83 6 Y 32896 30 63 def @arg13 251 16777216 10 Y 128 31 63 def @arg14 251 16777216 19 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 @@ -2223,8 +2223,8 @@ def @arg07 5 23 0 Y 32896 31 63 def @arg08 5 23 0 Y 32896 31 63 def @arg09 5 23 0 Y 32896 31 63 def @arg10 5 23 0 Y 32896 31 63 -def @arg11 246 83 0 Y 128 30 63 -def @arg12 246 83 0 Y 128 30 63 +def @arg11 246 83 0 Y 32896 30 63 +def @arg12 246 83 0 Y 32896 30 63 def @arg13 251 16777216 0 Y 128 31 63 def @arg14 251 16777216 0 Y 128 31 63 def @arg15 251 16777216 19 Y 128 31 63 diff --git a/mysql-test/suite/ndb/t/ndb_dd_ddl.test b/mysql-test/suite/ndb/t/ndb_dd_ddl.test index d6de7c45326..e8db0730687 100644 --- a/mysql-test/suite/ndb/t/ndb_dd_ddl.test +++ b/mysql-test/suite/ndb/t/ndb_dd_ddl.test @@ -367,4 +367,103 @@ engine ndb; --exec rm $MYSQLTEST_VARDIR/tmp/t1.frm -# End 5.1 test +--echo +--echo # ----------------------------------------------------------------- +--echo # End 5.1 test +--echo # ----------------------------------------------------------------- + +--echo +--echo # -- +--echo # -- WL#4300: Define privileges for tablespaces. +--echo # -- + +GRANT CREATE TABLESPACE ON *.* TO mysqltest_u1@localhost; + +--echo + +--disable_warnings +DROP DATABASE IF EXISTS mysqltest2; +--enable_warnings + +CREATE DATABASE mysqltest2; + +GRANT ALL PRIVILEGES ON mysqltest2.* TO mysqltest_u2@localhost; + +--echo +--echo # -- Connection: mysqltest_u1@localhost +--echo +--connect(con1, localhost, mysqltest_u1,,) + +--echo # -- Grants for mysqltest_u1@localhost: +SHOW GRANTS; + +--echo +--echo # -- Check CREATE LOGFILE GROUP... +CREATE LOGFILE GROUP lg1 +ADD UNDOFILE 'undofile.dat' +INITIAL_SIZE 1M +UNDO_BUFFER_SIZE = 1M +ENGINE = NDB; + +--echo +--echo # -- Check ALTER LOGFILE GROUP... +ALTER LOGFILE GROUP lg1 +ADD UNDOFILE 'undofile02.dat' +INITIAL_SIZE 1M +ENGINE = NDB; + +--echo +--echo # -- Check CREATE TABLESPACE... +CREATE TABLESPACE ts1 +ADD DATAFILE 'datafile.dat' +USE LOGFILE GROUP lg1 +INITIAL_SIZE 1M +ENGINE = NDB; + +--echo +--echo # -- Check ALTER TABLESPACE... +ALTER TABLESPACE ts1 +DROP DATAFILE 'datafile.dat' +INITIAL_SIZE 1M +ENGINE = NDB; + +--echo +--echo # -- Connection: mysqltest_u2@localhost +--echo +--connect(con2, localhost, mysqltest_u2,,mysqltest2) + +--echo # -- Grants for mysqltest_u2@localhost: +SHOW GRANTS; + +CREATE TABLE t1(c INT) TABLESPACE ts1; + +DROP TABLE t1; + +--echo +--echo # -- Connection: mysqltest_u1@localhost +--echo +--connection con1 + +--echo +--echo # -- Check DROP TABLESPACE... +DROP TABLESPACE ts1 +ENGINE = NDB; + +--echo +--echo # -- Check DROP LOGFILE GROUP... +DROP LOGFILE GROUP lg1 +ENGINE = NDB; + +--echo +--echo # -- Connection: root@localhost +--echo +--connection default +--disconnect con1 + +DROP USER mysqltest_u1@localhost; +DROP USER mysqltest_u2@localhost; + +--echo +--echo # ----------------------------------------------------------------- +--echo # End 6.0 test +--echo # ----------------------------------------------------------------- diff --git a/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result b/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result index 99a0fd21f66..3321b9b4969 100644 --- a/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result +++ b/mysql-test/suite/rpl/r/rpl_get_master_version_and_clock.result @@ -18,7 +18,7 @@ start slave; SELECT RELEASE_LOCK("debug_lock.before_get_UNIX_TIMESTAMP"); RELEASE_LOCK("debug_lock.before_get_UNIX_TIMESTAMP") 1 -Slave_IO_Errno= 2013 +Slave_IO_Errno= 2003 SELECT IS_FREE_LOCK("debug_lock.before_get_SERVER_ID"); IS_FREE_LOCK("debug_lock.before_get_SERVER_ID") 1 @@ -31,7 +31,7 @@ start slave; SELECT RELEASE_LOCK("debug_lock.before_get_SERVER_ID"); RELEASE_LOCK("debug_lock.before_get_SERVER_ID") 1 -Slave_IO_Errno= 2013 +Slave_IO_Errno= 2003 set global debug= ''; reset master; include/stop_slave.inc diff --git a/mysql-test/suite/rpl/r/rpl_udf.result b/mysql-test/suite/rpl/r/rpl_udf.result index ccf16271d01..a6d23b04780 100644 --- a/mysql-test/suite/rpl/r/rpl_udf.result +++ b/mysql-test/suite/rpl/r/rpl_udf.result @@ -181,21 +181,21 @@ affected rows: 2 CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM; affected rows: 0 INSERT INTO t1 VALUES(myfunc_int(100), myfunc_double(50.00)); +affected rows: 1 Warnings: Note 1592 Statement may not be safe to log in statement format. -affected rows: 1 INSERT INTO t1 VALUES(myfunc_int(10), myfunc_double(5.00)); +affected rows: 1 Warnings: Note 1592 Statement may not be safe to log in statement format. -affected rows: 1 INSERT INTO t1 VALUES(myfunc_int(200), myfunc_double(25.00)); +affected rows: 1 Warnings: Note 1592 Statement may not be safe to log in statement format. -affected rows: 1 INSERT INTO t1 VALUES(myfunc_int(1), myfunc_double(500.00)); +affected rows: 1 Warnings: Note 1592 Statement may not be safe to log in statement format. -affected rows: 1 SELECT * FROM t1 ORDER BY sum; sum price 1 48.5 diff --git a/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test b/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test index e6c1d5256a0..0a031f1bff9 100644 --- a/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test +++ b/mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test @@ -145,7 +145,9 @@ create table t3 select 1 union select UUID(); create table t4 select * from t1 where 3 in (select 1 union select 2 union select UUID() union select 3); create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3); # what if UUID() is first: +--disable_warnings insert into t5 select UUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4); +--enable_warnings # inside a stored procedure diff --git a/mysql-test/suite/sys_vars/r/auto_commit_basic.result b/mysql-test/suite/sys_vars/r/auto_commit_basic.result index c3643aaa1db..96cfd3e7ee6 100644 --- a/mysql-test/suite/sys_vars/r/auto_commit_basic.result +++ b/mysql-test/suite/sys_vars/r/auto_commit_basic.result @@ -54,19 +54,19 @@ ERROR HY000: Variable 'autocommit' is a SESSION variable and can't be used with SELECT @@global.autocommit; ERROR HY000: Variable 'autocommit' is a SESSION variable '#----------------------FN_DYNVARS_003_06------------------------#' -SELECT @@session.autocommit = VARIABLE_VALUE +SELECT IF(@@session.autocommit, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='autocommit'; -@@session.autocommit = VARIABLE_VALUE -0 +IF(@@session.autocommit, "ON", "OFF") = VARIABLE_VALUE +1 Bug # 34839: Values in variable and information_schema do not match for autocommit '#----------------------FN_DYNVARS_003_07------------------------#' SET @@autocommit = 1; -SELECT @@autocommit = VARIABLE_VALUE +SELECT IF(@@autocommit, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='autocommit'; -@@autocommit = VARIABLE_VALUE -0 +IF(@@autocommit, "ON", "OFF") = VARIABLE_VALUE +1 '#---------------------FN_DYNVARS_003_08-------------------------#' SET @@autocommit = OFF; SELECT @@autocommit; diff --git a/mysql-test/suite/sys_vars/r/automatic_sp_privileges_basic.result b/mysql-test/suite/sys_vars/r/automatic_sp_privileges_basic.result index b9cf9b5ee80..26e33a384b9 100644 --- a/mysql-test/suite/sys_vars/r/automatic_sp_privileges_basic.result +++ b/mysql-test/suite/sys_vars/r/automatic_sp_privileges_basic.result @@ -53,11 +53,11 @@ ERROR HY000: Variable 'automatic_sp_privileges' is a GLOBAL variable and should SELECT @@session.automatic_sp_privileges; ERROR HY000: Variable 'automatic_sp_privileges' is a GLOBAL variable '#----------------------FN_DYNVARS_004_06------------------------#' -SELECT @@global.automatic_sp_privileges = VARIABLE_VALUE +SELECT IF(@@global.automatic_sp_privileges, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='automatic_sp_privileges'; -@@global.automatic_sp_privileges = VARIABLE_VALUE -0 +IF(@@global.automatic_sp_privileges, "ON", "OFF") = VARIABLE_VALUE +1 'Bug# 34839: Values in variable and information_schema donot match' '#---------------------FN_DYNVARS_004_07----------------------#' SET @@global.automatic_sp_privileges = OFF; diff --git a/mysql-test/suite/sys_vars/r/big_tables_basic.result b/mysql-test/suite/sys_vars/r/big_tables_basic.result index 937576a76d3..e88caae47cf 100644 --- a/mysql-test/suite/sys_vars/r/big_tables_basic.result +++ b/mysql-test/suite/sys_vars/r/big_tables_basic.result @@ -49,11 +49,11 @@ ERROR HY000: Variable 'big_tables' is a SESSION variable and can't be used with SELECT @@global.big_tables; ERROR HY000: Variable 'big_tables' is a SESSION variable '#----------------------FN_DYNVARS_005_05------------------------#' -SELECT @@big_tables = VARIABLE_VALUE +SELECT IF(@@big_tables, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='big_tables'; -@@big_tables = VARIABLE_VALUE -0 +IF(@@big_tables, "ON", "OFF") = VARIABLE_VALUE +1 Bug # 34839: Values in variable and information_schema do not match for autocommit '#---------------------FN_DYNVARS_005_06----------------------#' SET @@big_tables = OFF; diff --git a/mysql-test/suite/sys_vars/r/engine_condition_pushdown_basic.result b/mysql-test/suite/sys_vars/r/engine_condition_pushdown_basic.result index 7073066c2f1..93e3cd56c77 100644 --- a/mysql-test/suite/sys_vars/r/engine_condition_pushdown_basic.result +++ b/mysql-test/suite/sys_vars/r/engine_condition_pushdown_basic.result @@ -103,10 +103,10 @@ SELECT @@session.engine_condition_pushdown AS res_is_1; res_is_1 1 '#----------------------FN_DYNVARS_028_06------------------------#' -SELECT @@global.engine_condition_pushdown = VARIABLE_VALUE +SELECT IF(@@global.engine_condition_pushdown, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='engine_condition_pushdown'; -@@global.engine_condition_pushdown = VARIABLE_VALUE +IF(@@global.engine_condition_pushdown, "ON", "OFF") = VARIABLE_VALUE 1 SELECT @@global.engine_condition_pushdown; @@global.engine_condition_pushdown @@ -117,11 +117,11 @@ WHERE VARIABLE_NAME='engine_condition_pushdown'; VARIABLE_VALUE OFF '#----------------------FN_DYNVARS_028_07------------------------#' -SELECT @@session.engine_condition_pushdown = VARIABLE_VALUE +SELECT IF(@@session.engine_condition_pushdown, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='engine_condition_pushdown'; -@@session.engine_condition_pushdown = VARIABLE_VALUE -0 +IF(@@session.engine_condition_pushdown, "ON", "OFF") = VARIABLE_VALUE +1 SELECT @@session.engine_condition_pushdown; @@session.engine_condition_pushdown 1 diff --git a/mysql-test/suite/sys_vars/r/flush_basic.result b/mysql-test/suite/sys_vars/r/flush_basic.result index 259f8f929a1..e0584d46351 100644 --- a/mysql-test/suite/sys_vars/r/flush_basic.result +++ b/mysql-test/suite/sys_vars/r/flush_basic.result @@ -63,11 +63,11 @@ ERROR HY000: Variable 'flush' is a GLOBAL variable and should be set with SET GL SELECT @@session.flush; ERROR HY000: Variable 'flush' is a GLOBAL variable '#----------------------FN_DYNVARS_030_06------------------------#' -SELECT @@global.flush = VARIABLE_VALUE +SELECT IF(@@global.flush, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='flush'; -@@global.flush = VARIABLE_VALUE -0 +IF(@@global.flush, "ON", "OFF") = VARIABLE_VALUE +1 '#---------------------FN_DYNVARS_030_07----------------------#' SET @@global.flush = TRUE; SELECT @@global.flush; diff --git a/mysql-test/suite/sys_vars/r/foreign_key_checks_basic.result b/mysql-test/suite/sys_vars/r/foreign_key_checks_basic.result index e09e680fe99..8540467b9b2 100644 --- a/mysql-test/suite/sys_vars/r/foreign_key_checks_basic.result +++ b/mysql-test/suite/sys_vars/r/foreign_key_checks_basic.result @@ -65,10 +65,10 @@ SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARI count(VARIABLE_VALUE) 1 '#----------------------FN_DYNVARS_032_07------------------------#' -SELECT @@session.foreign_key_checks = VARIABLE_VALUE +SELECT IF(@@session.foreign_key_checks, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='foreign_key_checks'; -@@session.foreign_key_checks = VARIABLE_VALUE +IF(@@session.foreign_key_checks, "ON", "OFF") = VARIABLE_VALUE 1 SELECT @@session.foreign_key_checks; @@session.foreign_key_checks diff --git a/mysql-test/suite/sys_vars/r/general_log_basic.result b/mysql-test/suite/sys_vars/r/general_log_basic.result index 18a5fde45c0..df6ec9fb384 100644 --- a/mysql-test/suite/sys_vars/r/general_log_basic.result +++ b/mysql-test/suite/sys_vars/r/general_log_basic.result @@ -47,10 +47,10 @@ ERROR HY000: Variable 'general_log' is a GLOBAL variable and should be set with SELECT @@session.general_log; ERROR HY000: Variable 'general_log' is a GLOBAL variable '#----------------------FN_DYNVARS_004_05------------------------#' -SELECT @@global.general_log = VARIABLE_VALUE +SELECT IF(@@global.general_log, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='general_log'; -@@global.general_log = VARIABLE_VALUE +IF(@@global.general_log, "ON", "OFF") = VARIABLE_VALUE 1 '#---------------------FN_DYNVARS_004_06----------------------#' SET @@global.general_log = 0; diff --git a/mysql-test/suite/sys_vars/r/innodb_checksums_basic.result b/mysql-test/suite/sys_vars/r/innodb_checksums_basic.result index ac4bed60eb5..bb3cbac1863 100644 --- a/mysql-test/suite/sys_vars/r/innodb_checksums_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_checksums_basic.result @@ -12,11 +12,11 @@ COUNT(@@GLOBAL.innodb_checksums) 1 1 Expected '#---------------------BS_STVARS_023_03----------------------#' -SELECT @@GLOBAL.innodb_checksums = VARIABLE_VALUE +SELECT IF(@@GLOBAL.innodb_checksums, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_checksums'; -@@GLOBAL.innodb_checksums = VARIABLE_VALUE -0 +IF(@@GLOBAL.innodb_checksums, "ON", "OFF") = VARIABLE_VALUE +1 1 Expected SELECT COUNT(@@GLOBAL.innodb_checksums); COUNT(@@GLOBAL.innodb_checksums) diff --git a/mysql-test/suite/sys_vars/r/innodb_doublewrite_basic.result b/mysql-test/suite/sys_vars/r/innodb_doublewrite_basic.result index 6062399e8b8..4a5baf0aeda 100644 --- a/mysql-test/suite/sys_vars/r/innodb_doublewrite_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_doublewrite_basic.result @@ -12,11 +12,11 @@ COUNT(@@GLOBAL.innodb_doublewrite) 1 1 Expected '#---------------------BS_STVARS_026_03----------------------#' -SELECT @@GLOBAL.innodb_doublewrite = VARIABLE_VALUE +SELECT IF(@@GLOBAL.innodb_doublewrite, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_doublewrite'; -@@GLOBAL.innodb_doublewrite = VARIABLE_VALUE -0 +IF(@@GLOBAL.innodb_doublewrite, "ON", "OFF") = VARIABLE_VALUE +1 1 Expected SELECT COUNT(@@GLOBAL.innodb_doublewrite); COUNT(@@GLOBAL.innodb_doublewrite) diff --git a/mysql-test/suite/sys_vars/r/innodb_locks_unsafe_for_binlog_basic.result b/mysql-test/suite/sys_vars/r/innodb_locks_unsafe_for_binlog_basic.result index a5967d28913..c2229d54d02 100644 --- a/mysql-test/suite/sys_vars/r/innodb_locks_unsafe_for_binlog_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_locks_unsafe_for_binlog_basic.result @@ -12,10 +12,10 @@ COUNT(@@GLOBAL.innodb_locks_unsafe_for_binlog) 1 1 Expected '#---------------------BS_STVARS_031_03----------------------#' -SELECT @@GLOBAL.innodb_locks_unsafe_for_binlog = VARIABLE_VALUE +SELECT IF(@@GLOBAL.innodb_locks_unsafe_for_binlog, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_locks_unsafe_for_binlog'; -@@GLOBAL.innodb_locks_unsafe_for_binlog = VARIABLE_VALUE +IF(@@GLOBAL.innodb_locks_unsafe_for_binlog, "ON", "OFF") = VARIABLE_VALUE 1 1 Expected SELECT COUNT(@@GLOBAL.innodb_locks_unsafe_for_binlog); diff --git a/mysql-test/suite/sys_vars/r/innodb_rollback_on_timeout_basic.result b/mysql-test/suite/sys_vars/r/innodb_rollback_on_timeout_basic.result index 6887166fae6..0b7c71ce488 100644 --- a/mysql-test/suite/sys_vars/r/innodb_rollback_on_timeout_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_rollback_on_timeout_basic.result @@ -12,10 +12,10 @@ COUNT(@@GLOBAL.innodb_rollback_on_timeout) 1 1 Expected '#---------------------BS_STVARS_039_03----------------------#' -SELECT @@GLOBAL.innodb_rollback_on_timeout = VARIABLE_VALUE +SELECT IF(@@GLOBAL.innodb_rollback_on_timeout, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_rollback_on_timeout'; -@@GLOBAL.innodb_rollback_on_timeout = VARIABLE_VALUE +IF(@@GLOBAL.innodb_rollback_on_timeout, "ON", "OFF") = VARIABLE_VALUE 1 1 Expected SELECT COUNT(@@GLOBAL.innodb_rollback_on_timeout); diff --git a/mysql-test/suite/sys_vars/r/innodb_support_xa_basic.result b/mysql-test/suite/sys_vars/r/innodb_support_xa_basic.result index dcd6f498d56..96a48d7789f 100644 --- a/mysql-test/suite/sys_vars/r/innodb_support_xa_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_support_xa_basic.result @@ -105,10 +105,10 @@ SELECT @@session.innodb_support_xa AS res_is_1; res_is_1 1 '#----------------------FN_DYNVARS_046_06------------------------#' -SELECT @@global.innodb_support_xa = +SELECT IF(@@global.innodb_support_xa, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_support_xa'; -@@global.innodb_support_xa = +IF(@@global.innodb_support_xa, "ON", "OFF") = VARIABLE_VALUE 1 SELECT @@global.innodb_support_xa; @@ -119,12 +119,12 @@ WHERE VARIABLE_NAME='innodb_support_xa'; VARIABLE_VALUE OFF '#----------------------FN_DYNVARS_046_07------------------------#' -SELECT @@session.innodb_support_xa = +SELECT IF(@@session.innodb_support_xa, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='innodb_support_xa'; -@@session.innodb_support_xa = +IF(@@session.innodb_support_xa, "ON", "OFF") = VARIABLE_VALUE -0 +1 SELECT @@session.innodb_support_xa; @@session.innodb_support_xa 1 diff --git a/mysql-test/suite/sys_vars/r/innodb_table_locks_basic.result b/mysql-test/suite/sys_vars/r/innodb_table_locks_basic.result index 14aa995273b..f2424a3ea27 100644 --- a/mysql-test/suite/sys_vars/r/innodb_table_locks_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_table_locks_basic.result @@ -99,10 +99,10 @@ SELECT @@session.innodb_table_locks AS res_is_1; res_is_1 1 '#----------------------FN_DYNVARS_046_06------------------------#' -SELECT @@global.innodb_table_locks = +SELECT IF(@@global.innodb_table_locks, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_table_locks'; -@@global.innodb_table_locks = +IF(@@global.innodb_table_locks, "ON", "OFF") = VARIABLE_VALUE 1 SELECT @@global.innodb_table_locks; @@ -113,12 +113,12 @@ WHERE VARIABLE_NAME='innodb_table_locks'; VARIABLE_VALUE OFF '#----------------------FN_DYNVARS_046_07------------------------#' -SELECT @@session.innodb_table_locks = +SELECT IF(@@session.innodb_table_locks, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='innodb_table_locks'; -@@session.innodb_table_locks = +IF(@@session.innodb_table_locks, "ON", "OFF") = VARIABLE_VALUE -0 +1 SELECT @@session.innodb_table_locks; @@session.innodb_table_locks 1 diff --git a/mysql-test/suite/sys_vars/r/keep_files_on_create_basic.result b/mysql-test/suite/sys_vars/r/keep_files_on_create_basic.result index f782ee3b078..696ac5cc279 100644 --- a/mysql-test/suite/sys_vars/r/keep_files_on_create_basic.result +++ b/mysql-test/suite/sys_vars/r/keep_files_on_create_basic.result @@ -120,16 +120,16 @@ SELECT @@session.keep_files_on_create; @@session.keep_files_on_create 0 '#------------------FN_DYNVARS_054_06-----------------------#' -SELECT @@global.keep_files_on_create = VARIABLE_VALUE +SELECT IF(@@global.keep_files_on_create, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='keep_files_on_create'; -@@global.keep_files_on_create = VARIABLE_VALUE +IF(@@global.keep_files_on_create, "ON", "OFF") = VARIABLE_VALUE 1 '#------------------FN_DYNVARS_054_07-----------------------#' -SELECT @@session.keep_files_on_create = VARIABLE_VALUE +SELECT IF(@@session.keep_files_on_create, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='keep_files_on_create'; -@@session.keep_files_on_create = VARIABLE_VALUE +IF(@@session.keep_files_on_create, "ON", "OFF") = VARIABLE_VALUE 1 '#---------------------FN_DYNVARS_001_08----------------------#' SET @@keep_files_on_create = OFF; diff --git a/mysql-test/suite/sys_vars/r/local_infile_basic.result b/mysql-test/suite/sys_vars/r/local_infile_basic.result index 5f4c215719a..7afb367fde9 100644 --- a/mysql-test/suite/sys_vars/r/local_infile_basic.result +++ b/mysql-test/suite/sys_vars/r/local_infile_basic.result @@ -53,11 +53,11 @@ ERROR HY000: Variable 'local_infile' is a GLOBAL variable and should be set with SELECT @@session.local_infile = 1; ERROR HY000: Variable 'local_infile' is a GLOBAL variable '#----------------------FN_DYNVARS_018_06------------------------#' -SELECT @@global.local_infile = VARIABLE_VALUE +SELECT IF(@@global.local_infile, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='local_infile'; -@@global.local_infile = VARIABLE_VALUE -0 +IF(@@global.local_infile, "ON", "OFF") = VARIABLE_VALUE +1 '#---------------------FN_DYNVARS_018_07----------------------#' SET @@global.local_infile = OFF; SELECT @@global.local_infile; diff --git a/mysql-test/suite/sys_vars/r/log_bin_trust_function_creators_basic.result b/mysql-test/suite/sys_vars/r/log_bin_trust_function_creators_basic.result index 40dc0e217c4..72daac1edc1 100644 --- a/mysql-test/suite/sys_vars/r/log_bin_trust_function_creators_basic.result +++ b/mysql-test/suite/sys_vars/r/log_bin_trust_function_creators_basic.result @@ -69,12 +69,12 @@ ERROR 42000: Variable 'log_bin_trust_function_creators' can't be set to the valu SET @@global.log_bin_trust_function_creators = test; ERROR 42000: Variable 'log_bin_trust_function_creators' can't be set to the value of 'test' '#------------------FN_DYNVARS_063_06-----------------------#' -SELECT @@global.log_bin_trust_function_creators = VARIABLE_VALUE +SELECT IF(@@global.log_bin_trust_function_creators, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='log_bin_trust_function_creators'; -@@global.log_bin_trust_function_creators = VARIABLE_VALUE +IF(@@global.log_bin_trust_function_creators, "ON", "OFF") = VARIABLE_VALUE 1 -SELECT @@session.log_bin_trust_function_creators = VARIABLE_VALUE +SELECT IF(@@session.log_bin_trust_function_creators, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='log_bin_trust_function_creators'; ERROR HY000: Variable 'log_bin_trust_function_creators' is a GLOBAL variable diff --git a/mysql-test/suite/sys_vars/r/log_queries_not_using_indexes_basic.result b/mysql-test/suite/sys_vars/r/log_queries_not_using_indexes_basic.result index b19b11a4209..7c69655f109 100644 --- a/mysql-test/suite/sys_vars/r/log_queries_not_using_indexes_basic.result +++ b/mysql-test/suite/sys_vars/r/log_queries_not_using_indexes_basic.result @@ -102,3 +102,6 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp SET @@SESSION log_queries_not_using_indexes= TRUE; 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 'log_queries_not_using_indexes= TRUE' at line 1 SET @@global.log_queries_not_using_indexes= @start_value; +SELECT IF(@@GLOBAL.log_queries_not_using_indexes, "ON", "OFF") = VARIABLE_VALUE +IF(@@GLOBAL.log_queries_not_using_indexes, "ON", "OFF") = VARIABLE_VALUE +1 diff --git a/mysql-test/suite/sys_vars/r/low_priority_updates_basic.result b/mysql-test/suite/sys_vars/r/low_priority_updates_basic.result index 87b30814837..d41e4cfc56f 100644 --- a/mysql-test/suite/sys_vars/r/low_priority_updates_basic.result +++ b/mysql-test/suite/sys_vars/r/low_priority_updates_basic.result @@ -118,16 +118,16 @@ ERROR 42000: Variable 'low_priority_updates' can't be set to the value of '65550 SET @@session.low_priority_updates = test; ERROR 42000: Variable 'low_priority_updates' can't be set to the value of 'test' '#------------------FN_DYNVARS_069_06-----------------------#' -SELECT @@global.low_priority_updates = VARIABLE_VALUE +SELECT IF(@@global.low_priority_updates, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='low_priority_updates'; -@@global.low_priority_updates = VARIABLE_VALUE +IF(@@global.low_priority_updates, "ON", "OFF") = VARIABLE_VALUE 1 '#------------------FN_DYNVARS_069_07-----------------------#' -SELECT @@session.low_priority_updates = VARIABLE_VALUE +SELECT IF(@@session.low_priority_updates, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='low_priority_updates'; -@@session.low_priority_updates = VARIABLE_VALUE +IF(@@session.low_priority_updates, "ON", "OFF") = VARIABLE_VALUE 1 '#---------------------FN_DYNVARS_069_08----------------------#' SET @@low_priority_updates = FALSE; diff --git a/mysql-test/suite/sys_vars/r/myisam_use_mmap_basic.result b/mysql-test/suite/sys_vars/r/myisam_use_mmap_basic.result index c0f92acb983..4b0e4afa38e 100644 --- a/mysql-test/suite/sys_vars/r/myisam_use_mmap_basic.result +++ b/mysql-test/suite/sys_vars/r/myisam_use_mmap_basic.result @@ -11,10 +11,10 @@ COUNT(@@GLOBAL.myisam_use_mmap) 1 1 Expected '#---------------------BS_STVARS_042_03----------------------#' -SELECT @@GLOBAL.myisam_use_mmap = VARIABLE_VALUE +SELECT IF(@@GLOBAL.myisam_use_mmap, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='myisam_use_mmap'; -@@GLOBAL.myisam_use_mmap = VARIABLE_VALUE +IF(@@GLOBAL.myisam_use_mmap, "ON", "OFF") = VARIABLE_VALUE 1 1 Expected SELECT COUNT(@@GLOBAL.myisam_use_mmap); diff --git a/mysql-test/suite/sys_vars/r/new_basic.result b/mysql-test/suite/sys_vars/r/new_basic.result index b36e540ddd9..5854649e6b1 100644 --- a/mysql-test/suite/sys_vars/r/new_basic.result +++ b/mysql-test/suite/sys_vars/r/new_basic.result @@ -117,16 +117,16 @@ ERROR 42000: Variable 'new' can't be set to the value of '65550' SET @@session.new = test; ERROR 42000: Variable 'new' can't be set to the value of 'test' '#------------------FN_DYNVARS_113_06-----------------------#' -SELECT @@global.new = VARIABLE_VALUE +SELECT IF(@@global.new, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='new'; -@@global.new = VARIABLE_VALUE +IF(@@global.new, "ON", "OFF") = VARIABLE_VALUE 1 '#------------------FN_DYNVARS_113_07-----------------------#' -SELECT @@session.new = VARIABLE_VALUE +SELECT IF(@@session.new, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='new'; -@@session.new = VARIABLE_VALUE +IF(@@session.new, "ON", "OFF") = VARIABLE_VALUE 1 '#---------------------FN_DYNVARS_113_08----------------------#' SET @@new = OFF; diff --git a/mysql-test/suite/sys_vars/r/old_passwords_basic.result b/mysql-test/suite/sys_vars/r/old_passwords_basic.result index ecf23ab302b..f8600167801 100644 --- a/mysql-test/suite/sys_vars/r/old_passwords_basic.result +++ b/mysql-test/suite/sys_vars/r/old_passwords_basic.result @@ -113,16 +113,16 @@ ERROR 42000: Variable 'old_passwords' can't be set to the value of '65550' SET @@session.old_passwords = test; ERROR 42000: Variable 'old_passwords' can't be set to the value of 'test' '#------------------FN_DYNVARS_114_06-----------------------#' -SELECT @@global.old_passwords = VARIABLE_VALUE +SELECT IF(@@global.old_passwords, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='old_passwords'; -@@global.old_passwords = VARIABLE_VALUE +IF(@@global.old_passwords, "ON", "OFF") = VARIABLE_VALUE 1 '#------------------FN_DYNVARS_114_07-----------------------#' -SELECT @@session.old_passwords = VARIABLE_VALUE +SELECT IF(@@session.old_passwords, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='old_passwords'; -@@session.old_passwords = VARIABLE_VALUE +IF(@@session.old_passwords, "ON", "OFF") = VARIABLE_VALUE 1 '#---------------------FN_DYNVARS_114_08----------------------#' SET @@old_passwords = OFF; diff --git a/mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_basic.result b/mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_basic.result index bff07741656..bfbebab7ed1 100644 --- a/mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_basic.result +++ b/mysql-test/suite/sys_vars/r/query_cache_wlock_invalidate_basic.result @@ -103,10 +103,10 @@ SELECT @@session.query_cache_wlock_invalidate AS res_is_1; res_is_1 1 '#----------------------FN_DYNVARS_135_06------------------------#' -SELECT @@global.query_cache_wlock_invalidate = VARIABLE_VALUE +SELECT IF(@@global.query_cache_wlock_invalidate, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='query_cache_wlock_invalidate'; -@@global.query_cache_wlock_invalidate = VARIABLE_VALUE +IF(@@global.query_cache_wlock_invalidate, "ON", "OFF") = VARIABLE_VALUE 1 SELECT @@global.query_cache_wlock_invalidate; @@global.query_cache_wlock_invalidate @@ -117,11 +117,11 @@ WHERE VARIABLE_NAME='query_cache_wlock_invalidate'; VARIABLE_VALUE OFF '#----------------------FN_DYNVARS_135_07------------------------#' -SELECT @@session.query_cache_wlock_invalidate = VARIABLE_VALUE +SELECT IF(@@session.query_cache_wlock_invalidate, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='query_cache_wlock_invalidate'; -@@session.query_cache_wlock_invalidate = VARIABLE_VALUE -0 +IF(@@session.query_cache_wlock_invalidate, "ON", "OFF") = VARIABLE_VALUE +1 SELECT @@session.query_cache_wlock_invalidate; @@session.query_cache_wlock_invalidate 1 diff --git a/mysql-test/suite/sys_vars/r/read_only_basic.result b/mysql-test/suite/sys_vars/r/read_only_basic.result index ac153fa337c..4ea316a41f1 100644 --- a/mysql-test/suite/sys_vars/r/read_only_basic.result +++ b/mysql-test/suite/sys_vars/r/read_only_basic.result @@ -82,15 +82,15 @@ SELECT @@read_only; @@read_only 0 '#----------------------FN_DYNVARS_139_06------------------------#' -SELECT @@global.read_only = VARIABLE_VALUE +SELECT IF(@@global.read_only, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='read_only'; -@@global.read_only = VARIABLE_VALUE +IF(@@global.read_only, "ON", "OFF") = VARIABLE_VALUE 1 -SELECT @@read_only = VARIABLE_VALUE +SELECT IF(@@read_only, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='read_only'; -@@read_only = VARIABLE_VALUE +IF(@@read_only, "ON", "OFF") = VARIABLE_VALUE 1 '#---------------------FN_DYNVARS_139_07----------------------#' SET @@global.read_only = 1; diff --git a/mysql-test/suite/sys_vars/r/relay_log_purge_basic.result b/mysql-test/suite/sys_vars/r/relay_log_purge_basic.result index 6f938c5265f..660550639cc 100644 --- a/mysql-test/suite/sys_vars/r/relay_log_purge_basic.result +++ b/mysql-test/suite/sys_vars/r/relay_log_purge_basic.result @@ -69,10 +69,10 @@ ERROR HY000: Variable 'relay_log_purge' is a GLOBAL variable and should be set w SELECT @@session.relay_log_purge; ERROR HY000: Variable 'relay_log_purge' is a GLOBAL variable '#----------------------FN_DYNVARS_141_06------------------------#' -SELECT @@global.relay_log_purge = VARIABLE_VALUE +SELECT IF(@@global.relay_log_purge, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='relay_log_purge'; -@@global.relay_log_purge = VARIABLE_VALUE +IF(@@global.relay_log_purge, "ON", "OFF") = VARIABLE_VALUE 1 '#---------------------FN_DYNVARS_141_07----------------------#' SET @@global.relay_log_purge = 1; diff --git a/mysql-test/suite/sys_vars/r/secure_auth_basic.result b/mysql-test/suite/sys_vars/r/secure_auth_basic.result index b8a903ba420..9f12a1760a4 100644 --- a/mysql-test/suite/sys_vars/r/secure_auth_basic.result +++ b/mysql-test/suite/sys_vars/r/secure_auth_basic.result @@ -68,11 +68,11 @@ WHERE VARIABLE_NAME='secure_auth'; count(VARIABLE_VALUE) 1 '#----------------------FN_DYNVARS_143_07------------------------#' -SELECT @@global.secure_auth = VARIABLE_VALUE +SELECT IF(@@global.secure_auth, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='secure_auth'; -@@global.secure_auth = VARIABLE_VALUE -0 +IF(@@global.secure_auth, "ON", "OFF") = VARIABLE_VALUE +1 SELECT @@global.secure_auth; @@global.secure_auth 1 diff --git a/mysql-test/suite/sys_vars/r/slave_allow_batching_basic.result b/mysql-test/suite/sys_vars/r/slave_allow_batching_basic.result index 186cfbc8f0f..36f0978d3af 100644 --- a/mysql-test/suite/sys_vars/r/slave_allow_batching_basic.result +++ b/mysql-test/suite/sys_vars/r/slave_allow_batching_basic.result @@ -8,5 +8,8 @@ ERROR HY000: Unknown system variable 'slave_allow_batching' '#-------------------FN_DYNVARS_145_05----------------------------#' '#----------------------FN_DYNVARS_145_06------------------------#' '#----------------------FN_DYNVARS_145_07------------------------#' +SELECT IF(@@global.slave_allow_batching, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='slave_allow_batching'; +IF(@@global.slave_allow_batching, "ON", "OFF") = VARIABLE_VALUE +1 '#---------------------FN_DYNVARS_145_08-------------------------#' '#---------------------FN_DYNVARS_145_09----------------------#' diff --git a/mysql-test/suite/sys_vars/r/slave_compressed_protocol_basic.result b/mysql-test/suite/sys_vars/r/slave_compressed_protocol_basic.result index 3f2d9d2fb3f..039cce257e5 100644 --- a/mysql-test/suite/sys_vars/r/slave_compressed_protocol_basic.result +++ b/mysql-test/suite/sys_vars/r/slave_compressed_protocol_basic.result @@ -66,11 +66,11 @@ WHERE VARIABLE_NAME='slave_compressed_protocol'; count(VARIABLE_VALUE) 1 '#----------------------FN_DYNVARS_147_07------------------------#' -SELECT @@global.slave_compressed_protocol = VARIABLE_VALUE +SELECT IF(@@global.slave_compressed_protocol, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='slave_compressed_protocol'; -@@global.slave_compressed_protocol = VARIABLE_VALUE -0 +IF(@@global.slave_compressed_protocol, "ON", "OFF") = VARIABLE_VALUE +1 SELECT @@global.slave_compressed_protocol; @@global.slave_compressed_protocol 1 diff --git a/mysql-test/suite/sys_vars/r/slow_query_log_basic.result b/mysql-test/suite/sys_vars/r/slow_query_log_basic.result index 716309aeaff..aece80cdada 100644 --- a/mysql-test/suite/sys_vars/r/slow_query_log_basic.result +++ b/mysql-test/suite/sys_vars/r/slow_query_log_basic.result @@ -47,10 +47,10 @@ ERROR HY000: Variable 'slow_query_log' is a GLOBAL variable and should be set wi SELECT @@session.slow_query_log; ERROR HY000: Variable 'slow_query_log' is a GLOBAL variable '#----------------------FN_DYNVARS_004_05------------------------#' -SELECT @@global.slow_query_log = VARIABLE_VALUE +SELECT IF(@@global.slow_query_log, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='slow_query_log'; -@@global.slow_query_log = VARIABLE_VALUE +IF(@@global.slow_query_log, "ON", "OFF") = VARIABLE_VALUE 1 '#---------------------FN_DYNVARS_004_06----------------------#' SET @@global.slow_query_log = 0; diff --git a/mysql-test/suite/sys_vars/r/sql_auto_is_null_basic.result b/mysql-test/suite/sys_vars/r/sql_auto_is_null_basic.result index b3a3eecd93a..0d8247ae1ef 100644 --- a/mysql-test/suite/sys_vars/r/sql_auto_is_null_basic.result +++ b/mysql-test/suite/sys_vars/r/sql_auto_is_null_basic.result @@ -12,11 +12,11 @@ COUNT(@@SESSION.sql_auto_is_null) 1 1 Expected '#---------------------BS_STVARS_044_03----------------------#' -SELECT @@SESSION.sql_auto_is_null = VARIABLE_VALUE +SELECT IF(@@SESSION.sql_auto_is_null, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sql_auto_is_null'; -@@SESSION.sql_auto_is_null = VARIABLE_VALUE -0 +IF(@@SESSION.sql_auto_is_null, "ON", "OFF") = VARIABLE_VALUE +1 1 Expected SELECT COUNT(@@SESSION.sql_auto_is_null); COUNT(@@SESSION.sql_auto_is_null) diff --git a/mysql-test/suite/sys_vars/r/sql_big_selects_basic.result b/mysql-test/suite/sys_vars/r/sql_big_selects_basic.result index 1171382380d..cf071b5b417 100644 --- a/mysql-test/suite/sys_vars/r/sql_big_selects_basic.result +++ b/mysql-test/suite/sys_vars/r/sql_big_selects_basic.result @@ -66,10 +66,10 @@ WHERE VARIABLE_NAME='sql_big_selects'; count(VARIABLE_VALUE) 1 '#----------------------FN_DYNVARS_153_07------------------------#' -SELECT @@session.sql_big_selects = VARIABLE_VALUE +SELECT IF(@@session.sql_big_selects, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sql_big_selects'; -@@session.sql_big_selects = VARIABLE_VALUE +IF(@@session.sql_big_selects, "ON", "OFF") = VARIABLE_VALUE 1 SELECT @@session.sql_big_selects; @@session.sql_big_selects diff --git a/mysql-test/suite/sys_vars/r/sql_big_tables_basic.result b/mysql-test/suite/sys_vars/r/sql_big_tables_basic.result index bce14b2aba2..46e93f7ff23 100644 --- a/mysql-test/suite/sys_vars/r/sql_big_tables_basic.result +++ b/mysql-test/suite/sys_vars/r/sql_big_tables_basic.result @@ -71,10 +71,10 @@ WHERE VARIABLE_NAME='sql_big_tables'; count(VARIABLE_VALUE) 1 '#----------------------FN_DYNVARS_154_07------------------------#' -SELECT @@session.sql_big_tables = VARIABLE_VALUE +SELECT IF(@@session.sql_big_tables, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sql_big_tables'; -@@session.sql_big_tables = VARIABLE_VALUE +IF(@@session.sql_big_tables, "ON", "OFF") = VARIABLE_VALUE 1 SELECT @@session.sql_big_tables; @@session.sql_big_tables diff --git a/mysql-test/suite/sys_vars/r/sql_buffer_result_basic.result b/mysql-test/suite/sys_vars/r/sql_buffer_result_basic.result index d03b688dbe6..146872afc1d 100644 --- a/mysql-test/suite/sys_vars/r/sql_buffer_result_basic.result +++ b/mysql-test/suite/sys_vars/r/sql_buffer_result_basic.result @@ -79,10 +79,10 @@ WHERE VARIABLE_NAME='sql_buffer_result'; count(VARIABLE_VALUE) 1 '#----------------------FN_DYNVARS_155_07------------------------#' -SELECT @@session.sql_buffer_result = VARIABLE_VALUE +SELECT IF(@@session.sql_buffer_result, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sql_buffer_result'; -@@session.sql_buffer_result = VARIABLE_VALUE +IF(@@session.sql_buffer_result, "ON", "OFF") = VARIABLE_VALUE 1 SELECT @@session.sql_buffer_result; @@session.sql_buffer_result diff --git a/mysql-test/suite/sys_vars/r/sql_log_bin_basic.result b/mysql-test/suite/sys_vars/r/sql_log_bin_basic.result index 4e37c2079d6..751b801047c 100644 --- a/mysql-test/suite/sys_vars/r/sql_log_bin_basic.result +++ b/mysql-test/suite/sys_vars/r/sql_log_bin_basic.result @@ -69,10 +69,10 @@ SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARI count(VARIABLE_VALUE) 1 '#----------------------FN_DYNVARS_156_07------------------------#' -SELECT @@session.sql_log_bin = VARIABLE_VALUE +SELECT IF(@@session.sql_log_bin, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sql_log_bin'; -@@session.sql_log_bin = VARIABLE_VALUE +IF(@@session.sql_log_bin, "ON", "OFF") = VARIABLE_VALUE 1 SELECT @@session.sql_log_bin; @@session.sql_log_bin diff --git a/mysql-test/suite/sys_vars/r/sql_log_off_basic.result b/mysql-test/suite/sys_vars/r/sql_log_off_basic.result index 03846cb6ce8..9f610991ce2 100644 --- a/mysql-test/suite/sys_vars/r/sql_log_off_basic.result +++ b/mysql-test/suite/sys_vars/r/sql_log_off_basic.result @@ -71,10 +71,10 @@ WHERE VARIABLE_NAME='sql_log_off'; count(VARIABLE_VALUE) 1 '#----------------------FN_DYNVARS_157_07------------------------#' -SELECT @@session.sql_log_off = VARIABLE_VALUE +SELECT IF(@@session.sql_log_off, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sql_log_off'; -@@session.sql_log_off = VARIABLE_VALUE +IF(@@session.sql_log_off, "ON", "OFF") = VARIABLE_VALUE 1 SELECT @@session.sql_log_off; @@session.sql_log_off diff --git a/mysql-test/suite/sys_vars/r/sql_low_priority_updates_basic.result b/mysql-test/suite/sys_vars/r/sql_low_priority_updates_basic.result index 6a09e6720b3..7b834d70038 100644 --- a/mysql-test/suite/sys_vars/r/sql_low_priority_updates_basic.result +++ b/mysql-test/suite/sys_vars/r/sql_low_priority_updates_basic.result @@ -102,10 +102,10 @@ SELECT @@session.sql_low_priority_updates AS res_is_1; res_is_1 1 '#----------------------FN_DYNVARS_159_06------------------------#' -SELECT @@global.sql_low_priority_updates = VARIABLE_VALUE +SELECT IF(@@global.sql_low_priority_updates, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='sql_low_priority_updates'; -@@global.sql_low_priority_updates = VARIABLE_VALUE +IF(@@global.sql_low_priority_updates, "ON", "OFF") = VARIABLE_VALUE 1 SELECT @@global.sql_low_priority_updates; @@global.sql_low_priority_updates @@ -116,11 +116,11 @@ WHERE VARIABLE_NAME='sql_low_priority_updates'; VARIABLE_VALUE OFF '#----------------------FN_DYNVARS_159_07------------------------#' -SELECT @@session.sql_low_priority_updates = VARIABLE_VALUE +SELECT IF(@@session.sql_low_priority_updates, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sql_low_priority_updates'; -@@session.sql_low_priority_updates = VARIABLE_VALUE -0 +IF(@@session.sql_low_priority_updates, "ON", "OFF") = VARIABLE_VALUE +1 SELECT @@session.sql_low_priority_updates; @@session.sql_low_priority_updates 1 diff --git a/mysql-test/suite/sys_vars/r/sql_notes_basic.result b/mysql-test/suite/sys_vars/r/sql_notes_basic.result index 5dd792d8ede..d6ec1239f45 100644 --- a/mysql-test/suite/sys_vars/r/sql_notes_basic.result +++ b/mysql-test/suite/sys_vars/r/sql_notes_basic.result @@ -69,10 +69,10 @@ SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARI count(VARIABLE_VALUE) 1 '#----------------------FN_DYNVARS_161_07------------------------#' -SELECT @@session.sql_notes = VARIABLE_VALUE +SELECT IF(@@session.sql_notes, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sql_notes'; -@@session.sql_notes = VARIABLE_VALUE +IF(@@session.sql_notes, "ON", "OFF") = VARIABLE_VALUE 1 SELECT @@session.sql_notes; @@session.sql_notes diff --git a/mysql-test/suite/sys_vars/r/sql_quote_show_create_basic.result b/mysql-test/suite/sys_vars/r/sql_quote_show_create_basic.result index 2550f2d1057..ed9322618f0 100644 --- a/mysql-test/suite/sys_vars/r/sql_quote_show_create_basic.result +++ b/mysql-test/suite/sys_vars/r/sql_quote_show_create_basic.result @@ -71,10 +71,10 @@ WHERE VARIABLE_NAME='sql_quote_show_create'; count(VARIABLE_VALUE) 1 '#----------------------FN_DYNVARS_162_07------------------------#' -SELECT @@session.sql_quote_show_create = VARIABLE_VALUE +SELECT IF(@@session.sql_quote_show_create, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sql_quote_show_create'; -@@session.sql_quote_show_create = VARIABLE_VALUE +IF(@@session.sql_quote_show_create, "ON", "OFF") = VARIABLE_VALUE 1 SELECT @@session.sql_quote_show_create; @@session.sql_quote_show_create diff --git a/mysql-test/suite/sys_vars/r/sql_safe_updates_basic.result b/mysql-test/suite/sys_vars/r/sql_safe_updates_basic.result index 539b38bb1fe..4daf78228f3 100644 --- a/mysql-test/suite/sys_vars/r/sql_safe_updates_basic.result +++ b/mysql-test/suite/sys_vars/r/sql_safe_updates_basic.result @@ -71,10 +71,10 @@ WHERE VARIABLE_NAME='sql_safe_updates'; count(VARIABLE_VALUE) 1 '#----------------------FN_DYNVARS_163_07------------------------#' -SELECT @@session.sql_safe_updates = VARIABLE_VALUE +SELECT IF(@@session.sql_safe_updates, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sql_safe_updates'; -@@session.sql_safe_updates = VARIABLE_VALUE +IF(@@session.sql_safe_updates, "ON", "OFF") = VARIABLE_VALUE 1 SELECT @@session.sql_safe_updates; @@session.sql_safe_updates diff --git a/mysql-test/suite/sys_vars/r/sql_warnings_basic.result b/mysql-test/suite/sys_vars/r/sql_warnings_basic.result index 46907c0ced8..cf39ef851d4 100644 --- a/mysql-test/suite/sys_vars/r/sql_warnings_basic.result +++ b/mysql-test/suite/sys_vars/r/sql_warnings_basic.result @@ -71,10 +71,10 @@ WHERE VARIABLE_NAME='sql_warnings'; count(VARIABLE_VALUE) 1 '#----------------------FN_DYNVARS_166_07------------------------#' -SELECT @@session.sql_warnings = VARIABLE_VALUE +SELECT IF(@@session.sql_warnings, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sql_warnings'; -@@session.sql_warnings = VARIABLE_VALUE +IF(@@session.sql_warnings, "ON", "OFF") = VARIABLE_VALUE 1 SELECT @@session.sql_warnings; @@session.sql_warnings diff --git a/mysql-test/suite/sys_vars/r/sync_frm_basic.result b/mysql-test/suite/sys_vars/r/sync_frm_basic.result index 9792307d17f..aa5416749a3 100644 --- a/mysql-test/suite/sys_vars/r/sync_frm_basic.result +++ b/mysql-test/suite/sys_vars/r/sync_frm_basic.result @@ -69,10 +69,10 @@ ERROR HY000: Variable 'sync_frm' is a GLOBAL variable and should be set with SET SELECT @@session.sync_frm; ERROR HY000: Variable 'sync_frm' is a GLOBAL variable '#----------------------FN_DYNVARS_169_06------------------------#' -SELECT @@global.sync_frm = VARIABLE_VALUE +SELECT IF(@@global.sync_frm, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='sync_frm'; -@@global.sync_frm = VARIABLE_VALUE +IF(@@global.sync_frm, "ON", "OFF") = VARIABLE_VALUE 1 '#---------------------FN_DYNVARS_169_07----------------------#' SET @@global.sync_frm = 1; diff --git a/mysql-test/suite/sys_vars/r/timed_mutexes_basic.result b/mysql-test/suite/sys_vars/r/timed_mutexes_basic.result index d8bd2cd975f..50a5285b0d7 100644 --- a/mysql-test/suite/sys_vars/r/timed_mutexes_basic.result +++ b/mysql-test/suite/sys_vars/r/timed_mutexes_basic.result @@ -67,11 +67,11 @@ WHERE VARIABLE_NAME='timed_mutexes'; count(VARIABLE_VALUE) 1 '#----------------------FN_DYNVARS_177_07------------------------#' -SELECT @@global.timed_mutexes = VARIABLE_VALUE +SELECT IF(@@global.timed_mutexes, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='timed_mutexes'; -@@global.timed_mutexes = VARIABLE_VALUE -0 +IF(@@global.timed_mutexes, "ON", "OFF") = VARIABLE_VALUE +1 SELECT @@global.timed_mutexes; @@global.timed_mutexes 1 diff --git a/mysql-test/suite/sys_vars/r/unique_checks_basic.result b/mysql-test/suite/sys_vars/r/unique_checks_basic.result index cc22c1c7f98..50ca7317490 100644 --- a/mysql-test/suite/sys_vars/r/unique_checks_basic.result +++ b/mysql-test/suite/sys_vars/r/unique_checks_basic.result @@ -58,10 +58,10 @@ ERROR 42000: Variable 'unique_checks' can't be set to the value of 'test' SET @@session.unique_checks = 123456789031; ERROR 42000: Variable 'unique_checks' can't be set to the value of '123456789031' '#------------------FN_DYNVARS_005_07-----------------------#' -SELECT @@session.unique_checks = VARIABLE_VALUE +SELECT IF(@@session.unique_checks, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='unique_checks'; -@@session.unique_checks = VARIABLE_VALUE +IF(@@session.unique_checks, "ON", "OFF") = VARIABLE_VALUE 1 '#---------------------FN_DYNVARS_001_08----------------------#' SET @@unique_checks = 1; diff --git a/mysql-test/suite/sys_vars/t/auto_commit_basic.test b/mysql-test/suite/sys_vars/t/auto_commit_basic.test index 0ea070ded59..b899c273093 100644 --- a/mysql-test/suite/sys_vars/t/auto_commit_basic.test +++ b/mysql-test/suite/sys_vars/t/auto_commit_basic.test @@ -113,7 +113,7 @@ SELECT @@global.autocommit; # Check if the value in SESSION Table matches value in variable # ######################################################################### -SELECT @@session.autocommit = VARIABLE_VALUE +SELECT IF(@@session.autocommit, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='autocommit'; --echo Bug # 34839: Values in variable and information_schema do not match for autocommit @@ -124,7 +124,7 @@ WHERE VARIABLE_NAME='autocommit'; ######################################################################### SET @@autocommit = 1; -SELECT @@autocommit = VARIABLE_VALUE +SELECT IF(@@autocommit, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='autocommit'; diff --git a/mysql-test/suite/sys_vars/t/automatic_sp_privileges_basic.test b/mysql-test/suite/sys_vars/t/automatic_sp_privileges_basic.test index 74da0904454..005aec91acf 100644 --- a/mysql-test/suite/sys_vars/t/automatic_sp_privileges_basic.test +++ b/mysql-test/suite/sys_vars/t/automatic_sp_privileges_basic.test @@ -113,7 +113,7 @@ SELECT @@session.automatic_sp_privileges; # Check if the value in GLOBAL Tables matches values in variable # ############################################################################## -SELECT @@global.automatic_sp_privileges = VARIABLE_VALUE +SELECT IF(@@global.automatic_sp_privileges, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='automatic_sp_privileges'; echo 'Bug# 34839: Values in variable and information_schema donot match'; diff --git a/mysql-test/suite/sys_vars/t/big_tables_basic.test b/mysql-test/suite/sys_vars/t/big_tables_basic.test index 8665895bb19..67215f2625d 100644 --- a/mysql-test/suite/sys_vars/t/big_tables_basic.test +++ b/mysql-test/suite/sys_vars/t/big_tables_basic.test @@ -107,7 +107,7 @@ SELECT @@global.big_tables; # Check if the value in SESSION Tables matches values in variable # ############################################################################## -SELECT @@big_tables = VARIABLE_VALUE +SELECT IF(@@big_tables, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='big_tables'; --echo Bug # 34839: Values in variable and information_schema do not match for autocommit diff --git a/mysql-test/suite/sys_vars/t/engine_condition_pushdown_basic.test b/mysql-test/suite/sys_vars/t/engine_condition_pushdown_basic.test index ee781159d6a..58ac196d1c2 100644 --- a/mysql-test/suite/sys_vars/t/engine_condition_pushdown_basic.test +++ b/mysql-test/suite/sys_vars/t/engine_condition_pushdown_basic.test @@ -160,7 +160,7 @@ SELECT @@session.engine_condition_pushdown AS res_is_1; # Check if the value in GLOBAL Table matches value in variable # ######################################################################### -SELECT @@global.engine_condition_pushdown = VARIABLE_VALUE +SELECT IF(@@global.engine_condition_pushdown, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='engine_condition_pushdown'; SELECT @@global.engine_condition_pushdown; @@ -173,7 +173,7 @@ WHERE VARIABLE_NAME='engine_condition_pushdown'; # Check if the value in SESSION Table matches value in variable # ######################################################################### -SELECT @@session.engine_condition_pushdown = VARIABLE_VALUE +SELECT IF(@@session.engine_condition_pushdown, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='engine_condition_pushdown'; SELECT @@session.engine_condition_pushdown; diff --git a/mysql-test/suite/sys_vars/t/flush_basic.test b/mysql-test/suite/sys_vars/t/flush_basic.test index f5f6665562e..0b8fc0388ee 100644 --- a/mysql-test/suite/sys_vars/t/flush_basic.test +++ b/mysql-test/suite/sys_vars/t/flush_basic.test @@ -120,7 +120,7 @@ SELECT @@session.flush; # Check if the value in GLOBAL Tables matches values in variable # #################################################################### -SELECT @@global.flush = VARIABLE_VALUE +SELECT IF(@@global.flush, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='flush'; diff --git a/mysql-test/suite/sys_vars/t/foreign_key_checks_basic.test b/mysql-test/suite/sys_vars/t/foreign_key_checks_basic.test index 54d94aca971..d7a01f2bf71 100644 --- a/mysql-test/suite/sys_vars/t/foreign_key_checks_basic.test +++ b/mysql-test/suite/sys_vars/t/foreign_key_checks_basic.test @@ -131,7 +131,7 @@ SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARI # Check if the value in GLOBAL Table matches value in variable # ######################################################################### -SELECT @@session.foreign_key_checks = VARIABLE_VALUE +SELECT IF(@@session.foreign_key_checks, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='foreign_key_checks'; SELECT @@session.foreign_key_checks; diff --git a/mysql-test/suite/sys_vars/t/general_log_basic.test b/mysql-test/suite/sys_vars/t/general_log_basic.test index 82f3be45bc9..6a1d00f1b6f 100644 --- a/mysql-test/suite/sys_vars/t/general_log_basic.test +++ b/mysql-test/suite/sys_vars/t/general_log_basic.test @@ -103,7 +103,7 @@ SELECT @@session.general_log; # Check if the value in GLOBAL Tables matches values in variable # ############################################################################## -SELECT @@global.general_log = VARIABLE_VALUE +SELECT IF(@@global.general_log, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='general_log'; diff --git a/mysql-test/suite/sys_vars/t/innodb_checksums_basic.test b/mysql-test/suite/sys_vars/t/innodb_checksums_basic.test index 89daad9ce0a..c4c39d7d380 100644 --- a/mysql-test/suite/sys_vars/t/innodb_checksums_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_checksums_basic.test @@ -52,7 +52,7 @@ SELECT COUNT(@@GLOBAL.innodb_checksums); # Check if the value in GLOBAL Table matches value in variable # ################################################################# -SELECT @@GLOBAL.innodb_checksums = VARIABLE_VALUE +SELECT IF(@@GLOBAL.innodb_checksums, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_checksums'; --echo 1 Expected diff --git a/mysql-test/suite/sys_vars/t/innodb_doublewrite_basic.test b/mysql-test/suite/sys_vars/t/innodb_doublewrite_basic.test index 4a0460bb4bc..72dd22cbeb8 100644 --- a/mysql-test/suite/sys_vars/t/innodb_doublewrite_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_doublewrite_basic.test @@ -52,7 +52,7 @@ SELECT COUNT(@@GLOBAL.innodb_doublewrite); # Check if the value in GLOBAL Table matches value in variable # ################################################################# -SELECT @@GLOBAL.innodb_doublewrite = VARIABLE_VALUE +SELECT IF(@@GLOBAL.innodb_doublewrite, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_doublewrite'; --echo 1 Expected diff --git a/mysql-test/suite/sys_vars/t/innodb_locks_unsafe_for_binlog_basic.test b/mysql-test/suite/sys_vars/t/innodb_locks_unsafe_for_binlog_basic.test index 63835113770..08792d299a1 100644 --- a/mysql-test/suite/sys_vars/t/innodb_locks_unsafe_for_binlog_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_locks_unsafe_for_binlog_basic.test @@ -52,7 +52,7 @@ SELECT COUNT(@@GLOBAL.innodb_locks_unsafe_for_binlog); # Check if the value in GLOBAL Table matches value in variable # ################################################################# -SELECT @@GLOBAL.innodb_locks_unsafe_for_binlog = VARIABLE_VALUE +SELECT IF(@@GLOBAL.innodb_locks_unsafe_for_binlog, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_locks_unsafe_for_binlog'; --echo 1 Expected diff --git a/mysql-test/suite/sys_vars/t/innodb_rollback_on_timeout_basic.test b/mysql-test/suite/sys_vars/t/innodb_rollback_on_timeout_basic.test index c33e0fa1b75..81025bb9d73 100644 --- a/mysql-test/suite/sys_vars/t/innodb_rollback_on_timeout_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_rollback_on_timeout_basic.test @@ -52,7 +52,7 @@ SELECT COUNT(@@GLOBAL.innodb_rollback_on_timeout); # Check if the value in GLOBAL Table matches value in variable # ################################################################# -SELECT @@GLOBAL.innodb_rollback_on_timeout = VARIABLE_VALUE +SELECT IF(@@GLOBAL.innodb_rollback_on_timeout, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_rollback_on_timeout'; --echo 1 Expected diff --git a/mysql-test/suite/sys_vars/t/innodb_support_xa_basic.test b/mysql-test/suite/sys_vars/t/innodb_support_xa_basic.test index 6da3e68ebdf..840fd240bde 100644 --- a/mysql-test/suite/sys_vars/t/innodb_support_xa_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_support_xa_basic.test @@ -169,7 +169,7 @@ SELECT @@session.innodb_support_xa AS res_is_1; # Check if the value in GLOBAL Table matches value in variable # ######################################################################### -SELECT @@global.innodb_support_xa = +SELECT IF(@@global.innodb_support_xa, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_support_xa'; SELECT @@global.innodb_support_xa; @@ -182,7 +182,7 @@ SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES # Check if the value in SESSION Table matches value in variable # ######################################################################### -SELECT @@session.innodb_support_xa = +SELECT IF(@@session.innodb_support_xa, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='innodb_support_xa'; SELECT @@session.innodb_support_xa; diff --git a/mysql-test/suite/sys_vars/t/innodb_table_locks_basic.test b/mysql-test/suite/sys_vars/t/innodb_table_locks_basic.test index 35961c43a7f..f7d06d18ada 100644 --- a/mysql-test/suite/sys_vars/t/innodb_table_locks_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_table_locks_basic.test @@ -167,7 +167,7 @@ SELECT @@session.innodb_table_locks AS res_is_1; # Check if the value in GLOBAL Table matches value in variable # ######################################################################### -SELECT @@global.innodb_table_locks = +SELECT IF(@@global.innodb_table_locks, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_table_locks'; SELECT @@global.innodb_table_locks; @@ -179,7 +179,7 @@ SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES # Check if the value in SESSION Table matches value in variable # ######################################################################### -SELECT @@session.innodb_table_locks = +SELECT IF(@@session.innodb_table_locks, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='innodb_table_locks'; SELECT @@session.innodb_table_locks; diff --git a/mysql-test/suite/sys_vars/t/keep_files_on_create_basic.test b/mysql-test/suite/sys_vars/t/keep_files_on_create_basic.test index a855f56c863..bc6ac8687f7 100644 --- a/mysql-test/suite/sys_vars/t/keep_files_on_create_basic.test +++ b/mysql-test/suite/sys_vars/t/keep_files_on_create_basic.test @@ -156,7 +156,7 @@ SELECT @@session.keep_files_on_create; #################################################################### -SELECT @@global.keep_files_on_create = VARIABLE_VALUE +SELECT IF(@@global.keep_files_on_create, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='keep_files_on_create'; @@ -165,7 +165,7 @@ WHERE VARIABLE_NAME='keep_files_on_create'; # Check if the value in SESSION Table matches value in variable # #################################################################### -SELECT @@session.keep_files_on_create = VARIABLE_VALUE +SELECT IF(@@session.keep_files_on_create, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='keep_files_on_create'; diff --git a/mysql-test/suite/sys_vars/t/local_infile_basic.test b/mysql-test/suite/sys_vars/t/local_infile_basic.test index 63f6b0fdb91..731eac42541 100644 --- a/mysql-test/suite/sys_vars/t/local_infile_basic.test +++ b/mysql-test/suite/sys_vars/t/local_infile_basic.test @@ -112,7 +112,7 @@ SELECT @@session.local_infile = 1; # Check if the value in GLOBAL Tables matches values in variable # #################################################################### -SELECT @@global.local_infile = VARIABLE_VALUE +SELECT IF(@@global.local_infile, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='local_infile'; diff --git a/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_basic.test b/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_basic.test index 3b8b43e1354..e7bdb433971 100644 --- a/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_basic.test +++ b/mysql-test/suite/sys_vars/t/log_bin_trust_function_creators_basic.test @@ -122,12 +122,12 @@ SET @@global.log_bin_trust_function_creators = test; ############################################################################### -SELECT @@global.log_bin_trust_function_creators = VARIABLE_VALUE +SELECT IF(@@global.log_bin_trust_function_creators, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='log_bin_trust_function_creators'; --Error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@session.log_bin_trust_function_creators = VARIABLE_VALUE +SELECT IF(@@session.log_bin_trust_function_creators, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='log_bin_trust_function_creators'; diff --git a/mysql-test/suite/sys_vars/t/log_queries_not_using_indexes_basic.test b/mysql-test/suite/sys_vars/t/log_queries_not_using_indexes_basic.test index f1152c07176..f7e6e8df640 100644 --- a/mysql-test/suite/sys_vars/t/log_queries_not_using_indexes_basic.test +++ b/mysql-test/suite/sys_vars/t/log_queries_not_using_indexes_basic.test @@ -129,4 +129,5 @@ SET @@SESSION log_queries_not_using_indexes= TRUE; SET @@global.log_queries_not_using_indexes= @start_value; +SELECT IF(@@GLOBAL.log_queries_not_using_indexes, "ON", "OFF") = VARIABLE_VALUE diff --git a/mysql-test/suite/sys_vars/t/low_priority_updates_basic.test b/mysql-test/suite/sys_vars/t/low_priority_updates_basic.test index 0ce4ee8f921..762fa726f1f 100644 --- a/mysql-test/suite/sys_vars/t/low_priority_updates_basic.test +++ b/mysql-test/suite/sys_vars/t/low_priority_updates_basic.test @@ -156,7 +156,7 @@ SET @@session.low_priority_updates = test; #################################################################### -SELECT @@global.low_priority_updates = VARIABLE_VALUE +SELECT IF(@@global.low_priority_updates, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='low_priority_updates'; @@ -165,7 +165,7 @@ WHERE VARIABLE_NAME='low_priority_updates'; # Check if the value in SESSION Table matches value in variable # #################################################################### -SELECT @@session.low_priority_updates = VARIABLE_VALUE +SELECT IF(@@session.low_priority_updates, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='low_priority_updates'; diff --git a/mysql-test/suite/sys_vars/t/myisam_use_mmap_basic.test b/mysql-test/suite/sys_vars/t/myisam_use_mmap_basic.test index d2cc39cfea7..dd1f8dbeee7 100644 --- a/mysql-test/suite/sys_vars/t/myisam_use_mmap_basic.test +++ b/mysql-test/suite/sys_vars/t/myisam_use_mmap_basic.test @@ -54,7 +54,7 @@ SELECT COUNT(@@GLOBAL.myisam_use_mmap); # Check if the value in GLOBAL Table matches value in variable # ################################################################# -SELECT @@GLOBAL.myisam_use_mmap = VARIABLE_VALUE +SELECT IF(@@GLOBAL.myisam_use_mmap, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='myisam_use_mmap'; --echo 1 Expected diff --git a/mysql-test/suite/sys_vars/t/new_basic.test b/mysql-test/suite/sys_vars/t/new_basic.test index b1d12c9a4de..cf0ba08dfdb 100644 --- a/mysql-test/suite/sys_vars/t/new_basic.test +++ b/mysql-test/suite/sys_vars/t/new_basic.test @@ -154,7 +154,7 @@ SET @@session.new = test; #################################################################### -SELECT @@global.new = VARIABLE_VALUE +SELECT IF(@@global.new, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='new'; @@ -163,7 +163,7 @@ WHERE VARIABLE_NAME='new'; # Check if the value in SESSION Table matches value in variable # #################################################################### -SELECT @@session.new = VARIABLE_VALUE +SELECT IF(@@session.new, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='new'; diff --git a/mysql-test/suite/sys_vars/t/old_passwords_basic.test b/mysql-test/suite/sys_vars/t/old_passwords_basic.test index b78ac9ca9b8..34a9394a1e7 100644 --- a/mysql-test/suite/sys_vars/t/old_passwords_basic.test +++ b/mysql-test/suite/sys_vars/t/old_passwords_basic.test @@ -154,7 +154,7 @@ SET @@session.old_passwords = test; #################################################################### -SELECT @@global.old_passwords = VARIABLE_VALUE +SELECT IF(@@global.old_passwords, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='old_passwords'; @@ -163,7 +163,7 @@ WHERE VARIABLE_NAME='old_passwords'; # Check if the value in SESSION Table matches value in variable # #################################################################### -SELECT @@session.old_passwords = VARIABLE_VALUE +SELECT IF(@@session.old_passwords, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='old_passwords'; diff --git a/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_basic.test b/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_basic.test index f253c1b4f43..5acb36961af 100644 --- a/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_basic.test +++ b/mysql-test/suite/sys_vars/t/query_cache_wlock_invalidate_basic.test @@ -165,7 +165,7 @@ SELECT @@session.query_cache_wlock_invalidate AS res_is_1; # Check if the value in GLOBAL Table matches value in variable # ######################################################################### -SELECT @@global.query_cache_wlock_invalidate = VARIABLE_VALUE +SELECT IF(@@global.query_cache_wlock_invalidate, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='query_cache_wlock_invalidate'; SELECT @@global.query_cache_wlock_invalidate; @@ -178,7 +178,7 @@ WHERE VARIABLE_NAME='query_cache_wlock_invalidate'; # Check if the value in SESSION Table matches value in variable # ######################################################################### -SELECT @@session.query_cache_wlock_invalidate = VARIABLE_VALUE +SELECT IF(@@session.query_cache_wlock_invalidate, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='query_cache_wlock_invalidate'; SELECT @@session.query_cache_wlock_invalidate; diff --git a/mysql-test/suite/sys_vars/t/read_only_basic.test b/mysql-test/suite/sys_vars/t/read_only_basic.test index 917842256b1..9d8078b8c68 100644 --- a/mysql-test/suite/sys_vars/t/read_only_basic.test +++ b/mysql-test/suite/sys_vars/t/read_only_basic.test @@ -121,11 +121,11 @@ SELECT @@read_only; # Check if the value in GLOBAL & SESSION Tables matches values in variable # ############################################################################## -SELECT @@global.read_only = VARIABLE_VALUE +SELECT IF(@@global.read_only, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='read_only'; -SELECT @@read_only = VARIABLE_VALUE +SELECT IF(@@read_only, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='read_only'; diff --git a/mysql-test/suite/sys_vars/t/relay_log_purge_basic.test b/mysql-test/suite/sys_vars/t/relay_log_purge_basic.test index 7e4d6a51440..081b79ebb73 100644 --- a/mysql-test/suite/sys_vars/t/relay_log_purge_basic.test +++ b/mysql-test/suite/sys_vars/t/relay_log_purge_basic.test @@ -123,7 +123,7 @@ SELECT @@session.relay_log_purge; # Check if the value in GLOBAL Tables matches values in variable # ##################################################################### -SELECT @@global.relay_log_purge = VARIABLE_VALUE +SELECT IF(@@global.relay_log_purge, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='relay_log_purge'; diff --git a/mysql-test/suite/sys_vars/t/secure_auth_basic.test b/mysql-test/suite/sys_vars/t/secure_auth_basic.test index b52f219097b..4e4566ce1ff 100644 --- a/mysql-test/suite/sys_vars/t/secure_auth_basic.test +++ b/mysql-test/suite/sys_vars/t/secure_auth_basic.test @@ -130,7 +130,7 @@ WHERE VARIABLE_NAME='secure_auth'; # Check if the value in GLOBAL Table matches value in variable # ######################################################################## -SELECT @@global.secure_auth = VARIABLE_VALUE +SELECT IF(@@global.secure_auth, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='secure_auth'; SELECT @@global.secure_auth; diff --git a/mysql-test/suite/sys_vars/t/slave_allow_batching_basic.test b/mysql-test/suite/sys_vars/t/slave_allow_batching_basic.test index cf31917933a..020fd9c84c2 100644 --- a/mysql-test/suite/sys_vars/t/slave_allow_batching_basic.test +++ b/mysql-test/suite/sys_vars/t/slave_allow_batching_basic.test @@ -130,7 +130,7 @@ SET @global_start_value = @@global.slave_allow_batching; # Check if the value in GLOBAL Table matches value in variable # ######################################################################### -#SELECT @@global.slave_allow_batching = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='slave_allow_batching'; +#SELECT IF(@@global.slave_allow_batching, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='slave_allow_batching'; #SELECT @@global.slave_allow_batching; #SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='slave_allow_batching'; #--echo 'Bug: value in information schema does not match' diff --git a/mysql-test/suite/sys_vars/t/slave_compressed_protocol_basic.test b/mysql-test/suite/sys_vars/t/slave_compressed_protocol_basic.test index 29a3227a8f5..25ac8f35c5d 100644 --- a/mysql-test/suite/sys_vars/t/slave_compressed_protocol_basic.test +++ b/mysql-test/suite/sys_vars/t/slave_compressed_protocol_basic.test @@ -127,7 +127,7 @@ WHERE VARIABLE_NAME='slave_compressed_protocol'; # Check if the value in GLOBAL Table matches value in variable # ######################################################################### -SELECT @@global.slave_compressed_protocol = VARIABLE_VALUE +SELECT IF(@@global.slave_compressed_protocol, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='slave_compressed_protocol'; SELECT @@global.slave_compressed_protocol; diff --git a/mysql-test/suite/sys_vars/t/slow_query_log_basic.test b/mysql-test/suite/sys_vars/t/slow_query_log_basic.test index 3a1b2fbd9e7..fef37b5ff4a 100644 --- a/mysql-test/suite/sys_vars/t/slow_query_log_basic.test +++ b/mysql-test/suite/sys_vars/t/slow_query_log_basic.test @@ -104,7 +104,7 @@ SELECT @@session.slow_query_log; # Check if the value in GLOBAL Tables matches values in variable # ############################################################################## -SELECT @@global.slow_query_log = VARIABLE_VALUE +SELECT IF(@@global.slow_query_log, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='slow_query_log'; diff --git a/mysql-test/suite/sys_vars/t/sql_auto_is_null_basic.test b/mysql-test/suite/sys_vars/t/sql_auto_is_null_basic.test index a843b88bf85..da01a3b4459 100644 --- a/mysql-test/suite/sys_vars/t/sql_auto_is_null_basic.test +++ b/mysql-test/suite/sys_vars/t/sql_auto_is_null_basic.test @@ -55,7 +55,7 @@ SELECT COUNT(@@SESSION.sql_auto_is_null); # Check if the value in SESSION Table matches value in variable # ################################################################# -SELECT @@SESSION.sql_auto_is_null = VARIABLE_VALUE +SELECT IF(@@SESSION.sql_auto_is_null, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sql_auto_is_null'; --echo 1 Expected diff --git a/mysql-test/suite/sys_vars/t/sql_big_selects_basic.test b/mysql-test/suite/sys_vars/t/sql_big_selects_basic.test index dd83a19230a..dd9b585cc84 100644 --- a/mysql-test/suite/sys_vars/t/sql_big_selects_basic.test +++ b/mysql-test/suite/sys_vars/t/sql_big_selects_basic.test @@ -132,7 +132,7 @@ WHERE VARIABLE_NAME='sql_big_selects'; # Check if the value in GLOBAL Table matches value in variable # ######################################################################## -SELECT @@session.sql_big_selects = VARIABLE_VALUE +SELECT IF(@@session.sql_big_selects, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sql_big_selects'; SELECT @@session.sql_big_selects; diff --git a/mysql-test/suite/sys_vars/t/sql_big_tables_basic.test b/mysql-test/suite/sys_vars/t/sql_big_tables_basic.test index 4e3dbdc9504..64ce47b044b 100644 --- a/mysql-test/suite/sys_vars/t/sql_big_tables_basic.test +++ b/mysql-test/suite/sys_vars/t/sql_big_tables_basic.test @@ -135,7 +135,7 @@ WHERE VARIABLE_NAME='sql_big_tables'; # Check if the value in GLOBAL Table matches value in variable # ######################################################################### -SELECT @@session.sql_big_tables = VARIABLE_VALUE +SELECT IF(@@session.sql_big_tables, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sql_big_tables'; SELECT @@session.sql_big_tables; diff --git a/mysql-test/suite/sys_vars/t/sql_buffer_result_basic.test b/mysql-test/suite/sys_vars/t/sql_buffer_result_basic.test index f5a5e323fc4..04e65239ccb 100644 --- a/mysql-test/suite/sys_vars/t/sql_buffer_result_basic.test +++ b/mysql-test/suite/sys_vars/t/sql_buffer_result_basic.test @@ -144,7 +144,7 @@ WHERE VARIABLE_NAME='sql_buffer_result'; # Check if the value in GLOBAL Table matches value in variable # ######################################################################### -SELECT @@session.sql_buffer_result = VARIABLE_VALUE +SELECT IF(@@session.sql_buffer_result, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sql_buffer_result'; SELECT @@session.sql_buffer_result; diff --git a/mysql-test/suite/sys_vars/t/sql_log_bin_basic.test b/mysql-test/suite/sys_vars/t/sql_log_bin_basic.test index 0f6d9e1e126..9ac0474f982 100644 --- a/mysql-test/suite/sys_vars/t/sql_log_bin_basic.test +++ b/mysql-test/suite/sys_vars/t/sql_log_bin_basic.test @@ -134,7 +134,7 @@ SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARI # Check if the value in GLOBAL Table matches value in variable # ######################################################################### -SELECT @@session.sql_log_bin = VARIABLE_VALUE +SELECT IF(@@session.sql_log_bin, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sql_log_bin'; SELECT @@session.sql_log_bin; diff --git a/mysql-test/suite/sys_vars/t/sql_log_off_basic.test b/mysql-test/suite/sys_vars/t/sql_log_off_basic.test index bcf9e87c1dd..a208d30a39b 100644 --- a/mysql-test/suite/sys_vars/t/sql_log_off_basic.test +++ b/mysql-test/suite/sys_vars/t/sql_log_off_basic.test @@ -135,7 +135,7 @@ WHERE VARIABLE_NAME='sql_log_off'; # Check if the value in GLOBAL Table matches value in variable # ######################################################################### -SELECT @@session.sql_log_off = VARIABLE_VALUE +SELECT IF(@@session.sql_log_off, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sql_log_off'; SELECT @@session.sql_log_off; diff --git a/mysql-test/suite/sys_vars/t/sql_low_priority_updates_basic.test b/mysql-test/suite/sys_vars/t/sql_low_priority_updates_basic.test index 499723b636d..8d75349b851 100644 --- a/mysql-test/suite/sys_vars/t/sql_low_priority_updates_basic.test +++ b/mysql-test/suite/sys_vars/t/sql_low_priority_updates_basic.test @@ -166,7 +166,7 @@ SELECT @@session.sql_low_priority_updates AS res_is_1; # Check if the value in GLOBAL Table matches value in variable # ######################################################################### -SELECT @@global.sql_low_priority_updates = VARIABLE_VALUE +SELECT IF(@@global.sql_low_priority_updates, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='sql_low_priority_updates'; SELECT @@global.sql_low_priority_updates; @@ -179,7 +179,7 @@ WHERE VARIABLE_NAME='sql_low_priority_updates'; # Check if the value in SESSION Table matches value in variable # ######################################################################### -SELECT @@session.sql_low_priority_updates = VARIABLE_VALUE +SELECT IF(@@session.sql_low_priority_updates, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sql_low_priority_updates'; SELECT @@session.sql_low_priority_updates; diff --git a/mysql-test/suite/sys_vars/t/sql_notes_basic.test b/mysql-test/suite/sys_vars/t/sql_notes_basic.test index 984dca34e46..461e5d35e4f 100644 --- a/mysql-test/suite/sys_vars/t/sql_notes_basic.test +++ b/mysql-test/suite/sys_vars/t/sql_notes_basic.test @@ -135,7 +135,7 @@ SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARI # Check if the value in GLOBAL Table matches value in variable # ######################################################################### -SELECT @@session.sql_notes = VARIABLE_VALUE +SELECT IF(@@session.sql_notes, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sql_notes'; SELECT @@session.sql_notes; diff --git a/mysql-test/suite/sys_vars/t/sql_quote_show_create_basic.test b/mysql-test/suite/sys_vars/t/sql_quote_show_create_basic.test index 1919b3ee642..5e0edef55e5 100644 --- a/mysql-test/suite/sys_vars/t/sql_quote_show_create_basic.test +++ b/mysql-test/suite/sys_vars/t/sql_quote_show_create_basic.test @@ -136,7 +136,7 @@ WHERE VARIABLE_NAME='sql_quote_show_create'; # Check if the value in GLOBAL Table matches value in variable # ######################################################################### -SELECT @@session.sql_quote_show_create = VARIABLE_VALUE +SELECT IF(@@session.sql_quote_show_create, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sql_quote_show_create'; SELECT @@session.sql_quote_show_create; diff --git a/mysql-test/suite/sys_vars/t/sql_safe_updates_basic.test b/mysql-test/suite/sys_vars/t/sql_safe_updates_basic.test index 489b42949a0..4f2c57bdb81 100644 --- a/mysql-test/suite/sys_vars/t/sql_safe_updates_basic.test +++ b/mysql-test/suite/sys_vars/t/sql_safe_updates_basic.test @@ -135,7 +135,7 @@ WHERE VARIABLE_NAME='sql_safe_updates'; # Check if the value in GLOBAL Table matches value in variable # ######################################################################### -SELECT @@session.sql_safe_updates = VARIABLE_VALUE +SELECT IF(@@session.sql_safe_updates, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sql_safe_updates'; SELECT @@session.sql_safe_updates; diff --git a/mysql-test/suite/sys_vars/t/sql_warnings_basic.test b/mysql-test/suite/sys_vars/t/sql_warnings_basic.test index f740403ceda..99a9ad8dda2 100644 --- a/mysql-test/suite/sys_vars/t/sql_warnings_basic.test +++ b/mysql-test/suite/sys_vars/t/sql_warnings_basic.test @@ -140,7 +140,7 @@ WHERE VARIABLE_NAME='sql_warnings'; # Check if the value in GLOBAL Table matches value in variable # ######################################################################### -SELECT @@session.sql_warnings = VARIABLE_VALUE +SELECT IF(@@session.sql_warnings, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='sql_warnings'; SELECT @@session.sql_warnings; diff --git a/mysql-test/suite/sys_vars/t/sync_frm_basic.test b/mysql-test/suite/sys_vars/t/sync_frm_basic.test index 6c00182a805..33e6202167f 100644 --- a/mysql-test/suite/sys_vars/t/sync_frm_basic.test +++ b/mysql-test/suite/sys_vars/t/sync_frm_basic.test @@ -121,7 +121,7 @@ SELECT @@session.sync_frm; # Check if the value in GLOBAL Tables matches values in variable # #################################################################### -SELECT @@global.sync_frm = VARIABLE_VALUE +SELECT IF(@@global.sync_frm, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='sync_frm'; diff --git a/mysql-test/suite/sys_vars/t/timed_mutexes_basic.test b/mysql-test/suite/sys_vars/t/timed_mutexes_basic.test index b0eb41afb49..9422ecdabf9 100644 --- a/mysql-test/suite/sys_vars/t/timed_mutexes_basic.test +++ b/mysql-test/suite/sys_vars/t/timed_mutexes_basic.test @@ -128,7 +128,7 @@ WHERE VARIABLE_NAME='timed_mutexes'; # Check if the value in GLOBAL Table matches value in variable # ######################################################################### -SELECT @@global.timed_mutexes = VARIABLE_VALUE +SELECT IF(@@global.timed_mutexes, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='timed_mutexes'; SELECT @@global.timed_mutexes; diff --git a/mysql-test/suite/sys_vars/t/unique_checks_basic.test b/mysql-test/suite/sys_vars/t/unique_checks_basic.test index 55308adcc82..364dfc07cd1 100644 --- a/mysql-test/suite/sys_vars/t/unique_checks_basic.test +++ b/mysql-test/suite/sys_vars/t/unique_checks_basic.test @@ -121,7 +121,7 @@ SET @@session.unique_checks = 123456789031; # Check if the value in SESSION Table matches value in variable # #################################################################### -SELECT @@session.unique_checks = VARIABLE_VALUE +SELECT IF(@@session.unique_checks, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='unique_checks'; diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index ae48d5a8736..0c20fe523a4 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -1001,3 +1001,18 @@ SELECT * FROM t1; DROP TABLE t1; --echo End of 5.1 tests + +# +# Bug #31031 ALTER TABLE regression in 5.0 +# +# The ALTER TABLE operation failed with +# ERROR 1089 (HY000): Incorrect sub part key; ... +# +CREATE TABLE t1(c CHAR(10), + i INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY); +INSERT INTO t1 VALUES('a',2),('b',4),('c',6); +ALTER TABLE t1 + DROP i, + ADD i INT UNSIGNED NOT NULL AUTO_INCREMENT, + AUTO_INCREMENT = 1; +DROP TABLE t1; diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 5ffa1b93929..9f3c3a88151 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -1582,3 +1582,56 @@ create table t3 (a int) row_format=page; --echo --echo End of 5.1 tests + + +########################################################################### + +--echo +--echo # -- +--echo # -- Bug #43054 Assertion `!table->auto_increment_field_not_null' +--echo # -- failed when redefining trigger +--echo + +#--disable_abort_on_error + +CREATE TABLE B ( + pk INTEGER AUTO_INCREMENT, + int_key INTEGER NOT NULL, + PRIMARY KEY (pk), + KEY (int_key) +); + +INSERT IGNORE INTO B VALUES ('9', '9'); + +CREATE TABLE IF NOT EXISTS t1 ( + `pk` INTEGER NOT NULL AUTO_INCREMENT , + `int` INTEGER , + PRIMARY KEY ( `pk` ) +) SELECT `pk` , `int_key` FROM B ; + +--delimiter | + +CREATE TRIGGER f BEFORE INSERT ON t1 FOR EACH ROW +BEGIN + INSERT INTO t1 ( `int` ) VALUES (4 ),( 8 ),( 2 ) ; +END ; | + +--delimiter ; +--error ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG +CREATE TABLE IF NOT EXISTS t1 ( + `pk` INTEGER NOT NULL AUTO_INCREMENT , + `int` INTEGER , + PRIMARY KEY ( `pk` ) +) SELECT `pk` , `int_key` FROM B ; + +--delimiter | +--error ER_NOT_SUPPORTED_YET +CREATE TRIGGER f BEFORE INSERT ON t1 FOR EACH ROW +BEGIN + UPDATE A SET `pk`=1 WHERE `pk`=0 ; +END ;| + +--delimiter ; + +DROP TABLE t1; +DROP TABLE B; diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index f0c769251cf..cc1677b1f61 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -2,6 +2,8 @@ # Tests with the utf8 character set # +--source include/have_innodb.inc + --disable_warnings drop table if exists t1,t2; --enable_warnings @@ -256,9 +258,7 @@ drop table t1; # Bug 4521: unique key prefix interacts poorly with utf8 # InnoDB: keys with prefix compression, case insensitive collation. # ---disable_warnings create table t1 (c varchar(30) character set utf8, unique(c(10))) engine=innodb; ---enable_warnings insert into t1 values ('1'),('2'),('3'),('x'),('y'),('z'); insert into t1 values ('aaaaaaaaaa'); --error ER_DUP_ENTRY @@ -306,9 +306,7 @@ drop table t1; # Bug 4521: unique key prefix interacts poorly with utf8 # InnoDB: fixed length keys, case insensitive collation # ---disable_warnings create table t1 (c char(3) character set utf8, unique (c(2))) engine=innodb; ---enable_warnings insert into t1 values ('1'),('2'),('3'),('4'),('x'),('y'),('z'); insert into t1 values ('a'); insert into t1 values ('aa'); @@ -383,12 +381,10 @@ drop table t1; # Bug 4531: unique key prefix interacts poorly with utf8 # Check BDB, case insensitive collation # ---disable_warnings create table t1 ( c char(10) character set utf8, unique key a (c(1)) ) engine=innodb; ---enable_warnings insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); --error ER_DUP_ENTRY insert into t1 values ('aa'); @@ -506,12 +502,10 @@ drop table t1; # Bug 4531: unique key prefix interacts poorly with utf8 # Check BDB, binary collation # ---disable_warnings create table t1 ( c char(10) character set utf8 collate utf8_bin, unique key a (c(1)) ) engine=innodb; ---enable_warnings insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f'); --error ER_DUP_ENTRY insert into t1 values ('aa'); @@ -543,12 +537,10 @@ drop table t1; # Bug#4594: column index make = failed for gbk, but like works # Check InnoDB # ---disable_warnings create table t1 ( str varchar(255) character set utf8 not null, key str (str(2)) ) engine=innodb; ---enable_warnings INSERT INTO t1 VALUES ('str'); INSERT INTO t1 VALUES ('str2'); select * from t1 where str='str'; @@ -581,12 +573,10 @@ drop table t1; # the same for BDB # ---disable_warnings create table t1 ( str varchar(255) character set utf8 not null, key str (str(2)) ) engine=innodb; ---enable_warnings INSERT INTO t1 VALUES ('str'); INSERT INTO t1 VALUES ('str2'); select * from t1 where str='str'; @@ -603,14 +593,11 @@ DROP TABLE t1; # # Bug #5723: length(<varchar utf8 field>) returns varying results # ---disable_warnings SET NAMES utf8; ---disable_warnings CREATE TABLE t1 ( subject varchar(255) character set utf8 collate utf8_unicode_ci, p varchar(15) character set utf8 ) ENGINE=InnoDB DEFAULT CHARSET=latin1; ---enable_warnings INSERT INTO t1 VALUES ('è°·å·ä¿ŠäºŒã¨ç”³ã—ã¾ã™ãŒã€ã‚¤ãƒ³ã‚¿ãƒ¼ãƒãƒƒãƒˆäºˆç´„ã®ä¼šå“¡ç™»éŒ²ã‚’ã—ã¾ã—ãŸã¨ã“ã‚ã€ãƒ¡ãƒ¼ãƒ«ã‚¢ãƒ‰ãƒ¬ã‚¹ã‚’é–“é•ãˆã¦ã—ã¾ã„会員IDãŒå—ã‘å–ã‚‹ã“ã¨ãŒå‡ºæ¥ã¾ã›ã‚“ã§ã—ãŸã€‚é–“é•ãˆã‚¢ãƒ‰ãƒ¬ã‚¹ã¯tani-shun@n.vodafone.ne.jpを書ãè¾¼ã¿ã¾ã—ãŸã€‚ã©ã†ã™ã‚Œã°ã‚ˆã„ã§ã™ã‹ï¼Ÿ ãã®ä»–ã€ä½æ‰€ç‰ã¯é–“é•ãˆã‚りã¾ã›ã‚“。連絡ãã ã•ã„。よã‚ã—ããŠé¡˜ã„ã—ã¾ã™ã€‚m(__)m','040312-000057'); INSERT INTO t1 VALUES ('aaa','bbb'); SELECT length(subject) FROM t1; @@ -661,18 +648,14 @@ DROP TABLE t1; # Bug #6019 SELECT tries to use too short prefix index on utf8 data # set names utf8; ---disable_warnings create table t1 ( a int primary key, b varchar(6), index b3(b(3)) ) engine=innodb character set=utf8; ---enable_warnings insert into t1 values(1,'foo'),(2,'foobar'); select * from t1 where b like 'foob%'; ---disable_warnings alter table t1 engine=innodb; ---enable_warnings select * from t1 where b like 'foob%'; drop table t1; @@ -841,14 +824,12 @@ INSERT INTO t1 VALUES (1,'blah','464','aaa','fkc1c9ilc20x0hgae7lx6j09','ERR','ERR Имри.Ðфимим.Ðеимимримдмримрмрирор имримримримр имридм ирбднримрфмририримрфмфмим.Ðд.Д имдимримрад.Ðдимримримрмдиримримримр м.Дадимфшьмримд им.Ðдимимрн имадми','ИМРИ.ÐФИМИМ.ÐЕИМИМРИМДМРИМРМРИРОР',3,'2005-06-01 17:30:43','1234567890'), (2,'blah','464','aaa','haxpl2ilc20x00bj4tt2m5ti','11','11 g','G',3,'2005-06-02 22:43:10','1234567890'); ---disable_warnings CREATE TABLE t2 ( `msisdn` varchar(15) NOT NULL default '', `operator_id` int(11) NOT NULL default '0', `created` datetime NOT NULL default '0000-00-00 00:00:00', UNIQUE KEY `PK_user` (`msisdn`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ---enable_warnings INSERT INTO t2 VALUES ('1234567890',2,'2005-05-24 13:53:25'); @@ -1013,10 +994,8 @@ drop table t1; # additional tests from duplicate bug#20744 MySQL return no result set names utf8; ---disable_warnings create table t1 (a varchar(30) not null primary key) engine=innodb default character set utf8 collate utf8_general_ci; ---enable_warnings insert into t1 values ('ã‚ã„ã†ãˆãŠã‹ããã‘ã“ã•ã—ã™ã›ã'); insert into t1 values ('ã•ã—ã™ã›ãã‹ããã‘ã“ã‚ã„ã†ãˆãŠ'); select a as gci1 from t1 where a like 'ã•ã—ã™ã›ãã‹ããã‘ã“ã‚ã„ã†ãˆãŠ%'; @@ -1024,10 +1003,8 @@ select a as gci2 from t1 where a like 'ã‚ã„ã†ãˆãŠã‹ããã‘ã“ã•ã—ã™ã drop table t1; set names utf8; ---disable_warnings create table t1 (a varchar(30) not null primary key) engine=innodb default character set utf8 collate utf8_unicode_ci; ---enable_warnings insert into t1 values ('ã‚ã„ã†ãˆãŠã‹ããã‘ã“ã•ã—ã™ã›ã'); insert into t1 values ('ã•ã—ã™ã›ãã‹ããã‘ã“ã‚ã„ã†ãˆãŠ'); select a as uci1 from t1 where a like 'ã•ã—ã™ã›ãã‹ããã‘ã“ã‚ã„ã†ãˆãŠ%'; @@ -1035,10 +1012,8 @@ select a as uci2 from t1 where a like 'ã‚ã„ã†ãˆãŠã‹ããã‘ã“ã•ã—ã™ã drop table t1; set names utf8; ---disable_warnings create table t1 (a varchar(30) not null primary key) engine=innodb default character set utf8 collate utf8_bin; ---enable_warnings insert into t1 values ('ã‚ã„ã†ãˆãŠã‹ããã‘ã“ã•ã—ã™ã›ã'); insert into t1 values ('ã•ã—ã™ã›ãã‹ããã‘ã“ã‚ã„ã†ãˆãŠ'); select a as bin1 from t1 where a like 'ã•ã—ã™ã›ãã‹ããã‘ã“ã‚ã„ã†ãˆãŠ%'; @@ -1363,26 +1338,22 @@ select concat(a, if(b>10, 'x' 'x', 'y' 'y')) from t1; select concat(a, if(b>10, 'x' 'æ', 'y' 'ß')) from t1; drop table t1; - # # Bug#19960: Inconsistent results when joining # InnoDB tables using partial UTF8 indexes # ---disable_warnings + CREATE TABLE t1 ( colA int(11) NOT NULL, colB varchar(255) character set utf8 NOT NULL, PRIMARY KEY (colA) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; ---enable_warnings INSERT INTO t1 (colA, colB) VALUES (1, 'foo'), (2, 'foo bar'); ---disable_warnings CREATE TABLE t2 ( colA int(11) NOT NULL, colB varchar(255) character set utf8 NOT NULL, KEY bad (colA,colB(3)) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; ---enable_warnings INSERT INTO t2 (colA, colB) VALUES (1, 'foo'),(2, 'foo bar'); SELECT * FROM t1 JOIN t2 ON t1.colA=t2.colA AND t1.colB=t2.colB WHERE t1.colA < 3; diff --git a/mysql-test/t/delayed.test b/mysql-test/t/delayed.test index 94ad22b80d0..038b0047497 100644 --- a/mysql-test/t/delayed.test +++ b/mysql-test/t/delayed.test @@ -329,3 +329,38 @@ drop table t1; set global low_priority_updates = @old_delayed_updates; --echo End of 5.1 tests + + + +--echo # +--echo # Bug #47274 assert in open_table on CREATE TABLE <already existing> +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; +--enable_warnings + +CREATE TABLE t1 ( f1 INTEGER AUTO_INCREMENT, PRIMARY KEY (f1)); + +--echo # The following CREATE TABLEs before gave an assert. + +INSERT DELAYED t1 VALUES (4); +--error ER_TABLE_EXISTS_ERROR +CREATE TABLE t1 AS SELECT 1 AS f1; + +REPLACE DELAYED t1 VALUES (5); +--error ER_TABLE_EXISTS_ERROR +CREATE TABLE t1 AS SELECT 1 AS f1; + +INSERT DELAYED t1 VALUES (6); +--error ER_TABLE_EXISTS_ERROR +CREATE TABLE t1 (f1 INTEGER); + +CREATE TABLE t2 (f1 INTEGER); +INSERT DELAYED t1 VALUES (7); +--error ER_TABLE_EXISTS_ERROR +CREATE TABLE t1 LIKE t2; + +DROP TABLE t2; +DROP TABLE t1; diff --git a/mysql-test/t/drop-no_root.test b/mysql-test/t/drop-no_root.test new file mode 100644 index 00000000000..8fb5b3f74a8 --- /dev/null +++ b/mysql-test/t/drop-no_root.test @@ -0,0 +1,85 @@ +# This test uses chmod, can't be run with root permissions +--source include/not_as_root.inc + +########################################################################### + +--echo +--echo # -- +--echo # -- Bug#26704: Failing DROP DATABASE brings mysql-client out of sync. +--echo # -- + +--echo +--disable_warnings +DROP DATABASE IF EXISTS mysql_test; +--enable_warnings + +--echo +CREATE DATABASE mysql_test; +CREATE TABLE mysql_test.t1(c INT); + +use mysql_test; + +let $MYSQLD_DATADIR= `select @@datadir`; + +--echo +--echo chmod 000 mysql_test/t1.frm +--chmod 0000 $MYSQLD_DATADIR/mysql_test/t1.frm + +# NOTE: For the DROP DATABASE below we need: +# - disable result log because ER_DB_DROP_RMDIR contains errno, which can be +# different on different platforms. +# - expect different error codes, because Windows and UNIX behaves +# differently (see below). +# +# NOTE: Windows and UNIX behaves differently in this test case: +# +# - on UNIX when t1.frm is chmoded to 000, it is perfectly deleted +# by the first DROP DATABASE, but some other files (t1.MYI and t1.MYD) left +# in the directory. So, we have to explicitly removes them before the +# second DROP DATABASE. +# +# - on Windows when t1.frm is chmoded to 000, it is not deleted by the first +# DROP DATABASE, but all other files in the database directory are deleted. +# Thus, we have to change the t1.frm permissions again and delete it +# explicitly before the second DROP DATABASE. +# +# All those differences do not really matter for the idea of this test case: +# checking that if DROP DATABASE failed, the client is Ok. + +--echo +--disable_result_log +--error ER_DB_DROP_RMDIR,6 +DROP DATABASE mysql_test; +--enable_result_log + +--echo +SELECT DATABASE(); + +# Remove t1.MYI and t1.MYD. On UNIX it should succeed. On Windows, it fails. +--echo +--echo rm -f mysql_test/t1.MYD mysql_test/t1.MYI +--error 0, 1 +--remove_file $MYSQLD_DATADIR/mysql_test/t1.MYD +--error 0, 1 +--remove_file $MYSQLD_DATADIR/mysql_test/t1.MYI + +# Make t1.frm removable: fail on UNIX, succeed on Windows. +--echo chmod 666 mysql_test/t1.frm +--error 0, 1 +--chmod 0666 $MYSQLD_DATADIR/mysql_test/t1.frm + +# Remove t1.frm: fail on UNIX, succeed on Windows. +--echo rm -f mysql_test/t1.frm +--error 0, 1 +--remove_file $MYSQLD_DATADIR/mysql_test/t1.frm + +--echo +DROP DATABASE mysql_test; + +--echo +use test; + +--echo +--echo # -- End of Bug#26704. + +########################################################################### diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test index bcd393bd6ab..6cf43620c1a 100644 --- a/mysql-test/t/grant.test +++ b/mysql-test/t/grant.test @@ -1525,5 +1525,34 @@ DROP USER 'user1'@'localhost'; DROP USER 'user2'; DROP DATABASE db1; + +--echo # +--echo # Bug #25863 No database selected error, but documentation +--echo # says * for global allowed +--echo # + +connect(conn1,localhost,root,,*NO-ONE*); + +--error ER_NO_DB_ERROR +GRANT ALL ON * TO mysqltest_1; + +GRANT ALL ON *.* TO mysqltest_1; +SHOW GRANTS FOR mysqltest_1; +DROP USER mysqltest_1; + +USE test; + +GRANT ALL ON * TO mysqltest_1; +SHOW GRANTS FOR mysqltest_1; +DROP USER mysqltest_1; + +GRANT ALL ON *.* TO mysqltest_1; +SHOW GRANTS FOR mysqltest_1; +DROP USER mysqltest_1; + +connection default; +disconnect conn1; + + # Wait till we reached the initial number of concurrent sessions --source include/wait_until_count_sessions.inc diff --git a/mysql-test/t/index_merge_innodb.test b/mysql-test/t/index_merge_innodb.test index 04516f45bfe..10d772797a2 100644 --- a/mysql-test/t/index_merge_innodb.test +++ b/mysql-test/t/index_merge_innodb.test @@ -21,14 +21,10 @@ let $index_merge_random_rows_in_EXPLAIN = 1; # InnoDB does not support Merge tables (affects include/index_merge1.inc) let $merge_table_support= 0; -# The first two tests are disabled because of non deterministic explain output. -# If include/index_merge1.inc can be enabled for InnoDB and all other -# storage engines, please remove the subtest for Bug#21277 from -# include/index_merge2.inc. -# This test exists already in include/index_merge1.inc. +# -- [DISABLED Bug#45727] # --source include/index_merge1.inc # --source include/index_merge_ror.inc +# --source include/index_merge2.inc ---source include/index_merge2.inc --source include/index_merge_2sweeps.inc --source include/index_merge_ror_cpk.inc diff --git a/mysql-test/t/information_schema-big.test b/mysql-test/t/information_schema-big.test new file mode 100644 index 00000000000..c9cd65f0851 --- /dev/null +++ b/mysql-test/t/information_schema-big.test @@ -0,0 +1,48 @@ +# This test uses grants, which can't get tested for embedded server +-- source include/big_test.inc +-- source include/not_embedded.inc + +# check that CSV engine was compiled in, as the result of the test depends +# on the presence of the log tables (which are CSV-based). +--source include/have_csv.inc + +--disable_warnings +DROP TABLE IF EXISTS t0,t1,t2,t3,t4,t5; +DROP VIEW IF EXISTS v1; +--enable_warnings + + +--echo # +--echo # Bug#18925: subqueries with MIN/MAX functions on INFORMARTION_SCHEMA +--echo # + +SELECT t.table_name, c1.column_name + FROM information_schema.tables t + INNER JOIN + information_schema.columns c1 + ON t.table_schema = c1.table_schema AND + t.table_name = c1.table_name + WHERE t.table_schema = 'information_schema' AND + c1.ordinal_position = + ( SELECT COALESCE(MIN(c2.ordinal_position),1) + FROM information_schema.columns c2 + WHERE c2.table_schema = t.table_schema AND + c2.table_name = t.table_name AND + c2.column_name LIKE '%SCHEMA%' + ) + AND t.table_name NOT LIKE 'innodb%'; +SELECT t.table_name, c1.column_name + FROM information_schema.tables t + INNER JOIN + information_schema.columns c1 + ON t.table_schema = c1.table_schema AND + t.table_name = c1.table_name + WHERE t.table_schema = 'information_schema' AND + c1.ordinal_position = + ( SELECT COALESCE(MIN(c2.ordinal_position),1) + FROM information_schema.columns c2 + WHERE c2.table_schema = 'information_schema' AND + c2.table_name = t.table_name AND + c2.column_name LIKE '%SCHEMA%' + ) + AND t.table_name NOT LIKE 'innodb%'; diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index 6060c78f791..b590ec306d6 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -914,41 +914,6 @@ DROP PROCEDURE p1; DROP USER mysql_bug20230@localhost; # -# Bug#18925 subqueries with MIN/MAX functions on INFORMARTION_SCHEMA -# - -SELECT t.table_name, c1.column_name - FROM information_schema.tables t - INNER JOIN - information_schema.columns c1 - ON t.table_schema = c1.table_schema AND - t.table_name = c1.table_name - WHERE t.table_schema = 'information_schema' AND - c1.ordinal_position = - ( SELECT COALESCE(MIN(c2.ordinal_position),1) - FROM information_schema.columns c2 - WHERE c2.table_schema = t.table_schema AND - c2.table_name = t.table_name AND - c2.column_name LIKE '%SCHEMA%' - ) - AND t.table_name not like 'innodb_%'; -SELECT t.table_name, c1.column_name - FROM information_schema.tables t - INNER JOIN - information_schema.columns c1 - ON t.table_schema = c1.table_schema AND - t.table_name = c1.table_name - WHERE t.table_schema = 'information_schema' AND - c1.ordinal_position = - ( SELECT COALESCE(MIN(c2.ordinal_position),1) - FROM information_schema.columns c2 - WHERE c2.table_schema = 'information_schema' AND - c2.table_name = t.table_name AND - c2.column_name LIKE '%SCHEMA%' - ) - AND t.table_name not like 'innodb_%'; - -# # Bug#2123 query with a simple non-correlated subquery over # INFORMARTION_SCHEMA.TABLES # diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test index c643465b2f3..eb33cc6bd6d 100644 --- a/mysql-test/t/innodb_mysql.test +++ b/mysql-test/t/innodb_mysql.test @@ -462,3 +462,21 @@ EXPLAIN SELECT * FROM t1 FORCE INDEX(PRIMARY) WHERE b=1 AND c=1 ORDER BY a; DROP TABLE t1; --echo End of 5.1 tests + + +--echo # +--echo # Test for bug #39932 "create table fails if column for FK is in different +--echo # case than in corr index". +--echo # +--disable_warnings +drop tables if exists t1, t2; +--enable_warnings +create table t1 (pk int primary key) engine=InnoDB; +--echo # Even although the below statement uses uppercased field names in +--echo # foreign key definition it still should be able to find explicitly +--echo # created supporting index. So it should succeed and should not +--echo # create any additional supporting indexes. +create table t2 (fk int, key x (fk), + constraint x foreign key (FK) references t1 (PK)) engine=InnoDB; +show create table t2; +drop table t2, t1; diff --git a/mysql-test/t/insert.test b/mysql-test/t/insert.test index 8f9ed6c7d06..f2b9e61915e 100644 --- a/mysql-test/t/insert.test +++ b/mysql-test/t/insert.test @@ -499,3 +499,33 @@ DROP TABLE t1, t2; --echo End of 5.0 tests. +--echo # +--echo # Bug#34898 "mysql_info() reports 0 warnings while +--echo # mysql_warning_count() reports 1" +--echo # Check that the number of warnings reported by +--echo # mysql_info() is correct. +--echo # + +--disable_warnings +drop table if exists t1; +--enable_warnings + +create table t1 (data varchar(4) not null); + +set sql_mode='error_for_division_by_zero'; +--echo # +--echo # Demonstrate that the number of warnings matches +--echo # the information in mysql_info(). +--echo # +--enable_info +insert t1 (data) values ('letter'), (1/0); +update t1 set data='envelope' where 1/0 or 1; +insert t1 (data) values (default), (1/0), ('dead beef'); +--disable_info + +set sql_mode=default; +drop table t1; + +--echo # +--echo # End of 5.4 tests +--echo # diff --git a/mysql-test/t/log_state.test b/mysql-test/t/log_state.test index e40dd1e3491..4d8c8fc6e74 100644 --- a/mysql-test/t/log_state.test +++ b/mysql-test/t/log_state.test @@ -1,16 +1,5 @@ ### t/log_state.test ### # -# This test suffers from server -# Bug#38124 "general_log_file" variable silently unset when using expression -# In short: -# SET GLOBAL general_log_file = @<whatever> -# SET GLOBAL slow_query_log = @<whatever> -# cause that the value of these server system variables is set to default -# instead of the assigned values. There comes no error message or warning. -# If this bug is fixed please -# 1. try this test with "let $fixed_bug38124 = 0;" -# 2. remove all workarounds if 1. was successful. -let $fixed_bug38124 = 0; --source include/not_embedded.inc --source include/have_csv.inc @@ -166,16 +155,6 @@ SET @@global.general_log = @old_general_log; SET @@global.general_log_file = @old_general_log_file; SET @@global.slow_query_log = @old_slow_query_log; SET @@global.slow_query_log_file = @old_slow_query_log_file; -if(!$fixed_bug38124) -{ - --disable_query_log - let $my_var = `SELECT @old_general_log_file`; - eval SET @@global.general_log_file = '$my_var'; - let $my_var = `SELECT @old_slow_query_log_file`; - eval SET @@global.slow_query_log_file = '$my_var'; - --enable_query_log -} - ########################################################################### @@ -278,15 +257,6 @@ SET GLOBAL slow_query_log_file= NULL; # Reset to initial values in case a setting above was successful. SET GLOBAL general_log_file= @old_general_log_file; SET GLOBAL slow_query_log_file= @old_slow_query_log_file; -if(!$fixed_bug38124) -{ - --disable_query_log - let $my_var = `SELECT @old_general_log_file`; - eval SET @@global.general_log_file = '$my_var'; - let $my_var = `SELECT @old_slow_query_log_file`; - eval SET @@global.slow_query_log_file = '$my_var'; - --enable_query_log -} ########################################################################### @@ -307,15 +277,6 @@ SHOW VARIABLES LIKE '%log_file'; --echo SET GLOBAL general_log_file = @old_general_log_file; SET GLOBAL slow_query_log_file = @old_slow_query_log_file; -if(!$fixed_bug38124) -{ - --disable_query_log - let $my_var = `SELECT @old_general_log_file`; - eval SET @@global.general_log_file = '$my_var'; - let $my_var = `SELECT @old_slow_query_log_file`; - eval SET @@global.slow_query_log_file = '$my_var'; - --enable_query_log -} --echo --echo # -- End of Bug#32748. @@ -351,19 +312,43 @@ SET @@global.general_log = @old_general_log; SET @@global.general_log_file = @old_general_log_file; SET @@global.slow_query_log = @old_slow_query_log; SET @@global.slow_query_log_file = @old_slow_query_log_file; -if(!$fixed_bug38124) -{ - --disable_query_log - let $my_var = `SELECT @old_general_log_file`; - eval SET @@global.general_log_file = '$my_var'; - let $my_var = `SELECT @old_slow_query_log_file`; - eval SET @@global.slow_query_log_file = '$my_var'; - --enable_query_log -} - --echo End of 5.1 tests + +########################################################################### + +--echo +--echo # -- +--echo # -- Bug#38124: "general_log_file" variable silently unset when +--echo # -- using expression +--echo # -- + +# Store away the special DEFAULT value so we +# can compare it later, then try to set the +# general_log_file using different functions +# and expressions. + +SET GLOBAL general_log_file = DEFAULT; +SELECT @@general_log_file INTO @my_glf; + +SET GLOBAL general_log_file = 'BUG38124.LOG'; +SELECT @@general_log_file; + +SET GLOBAL general_log_file = concat('BUG38124-2.LOG'); +SELECT @@general_log_file; + +SET GLOBAL general_log_file = substr('BUG38124-2.LOG',3,6); +SELECT @@general_log_file; + +SET GLOBAL general_log_file = DEFAULT; +SELECT @@general_log_file = @my_glf; + + +## Reset to initial values +SET GLOBAL general_log_file = @old_general_log_file; + + --enable_ps_protocol # @@ -380,17 +365,7 @@ SET global general_log = @old_general_log; SET global general_log_file = @old_general_log_file; SET global slow_query_log = @old_slow_query_log; SET global slow_query_log_file = @old_slow_query_log_file; -if(!$fixed_bug38124) -{ - --disable_query_log - let $my_var = `SELECT @old_general_log_file`; - eval SET @@global.general_log_file = '$my_var'; - let $my_var = `SELECT @old_slow_query_log_file`; - eval SET @@global.slow_query_log_file = '$my_var'; - --enable_query_log -} - -# Remove the log files that was created in the "default location" + +# Remove the log file that was created in the "default location" # i.e var/run ---remove_file $MYSQLTEST_VARDIR/run/mysqld.log --remove_file $MYSQLTEST_VARDIR/tmp/log.master diff --git a/mysql-test/t/log_state_bug33693-master.opt b/mysql-test/t/log_state_bug33693-master.opt new file mode 100644 index 00000000000..9f4ae1a0c8f --- /dev/null +++ b/mysql-test/t/log_state_bug33693-master.opt @@ -0,0 +1 @@ +--pid-file=$MYSQLTEST_VARDIR/run/mysqld.1.pid --log= diff --git a/mysql-test/t/log_state_bug33693.test b/mysql-test/t/log_state_bug33693.test new file mode 100644 index 00000000000..d67b28fc3e9 --- /dev/null +++ b/mysql-test/t/log_state_bug33693.test @@ -0,0 +1,18 @@ +### t/log_state_bug33693.test +# +# Regression test for bug #33693 +# "general log name and location depend on PID +# file, not on predefined values" +# +# The server is started with a hard-coded +# PID file in the $MYSQLTEST_VARDIR/run +# directory, and an unspecified general log +# file name. +# +# The correct result should show the log file to +# rest in the database directory. Unfixed, the +# log file will be in the same directory as the +# PID. + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--eval SELECT INSTR(@@general_log_file, '$MYSQLTEST_VARDIR/run'); diff --git a/mysql-test/t/lowercase_table2.test b/mysql-test/t/lowercase_table2.test index 521df01cc9b..92add60616a 100644 --- a/mysql-test/t/lowercase_table2.test +++ b/mysql-test/t/lowercase_table2.test @@ -150,3 +150,75 @@ select TABLE_SCHEMA,TABLE_NAME FROM information_schema.TABLES where TABLE_SCHEMA ='mysqltest_LC2'; use test; drop database mysqltest_LC2; + +--echo # End of 5.1 tests + + +--echo # +--echo # Test for bug #44738 "fill_schema_table_from_frm() opens tables without +--echo # lowercasing table name". Due to not properly normalizing table names +--echo # in lower_case_table_names modes in this function queries to I_S which +--echo # were executed through it left entries with incorrect key in table +--echo # definition cache. As result further queries to I_S that used this +--echo # function produced stale results in cases when table definition was +--echo # changed by a DDL statement. Also combination of this issue and a +--echo # similar problem in CREATE TABLE (it also has peeked into table +--echo # definition cache using non-normalized key) led to spurious +--echo # ER_TABLE_EXISTS_ERROR errors when one tried to create table with the +--echo # same name as a previously existing but dropped table. +--echo # +--disable_warnings +drop database if exists mysqltest_UPPERCASE; +drop table if exists t_bug44738_UPPERCASE; +--enable_warnings +create database mysqltest_UPPERCASE; +use mysqltest_UPPERCASE; +create table t_bug44738_UPPERCASE (i int) comment='Old comment'; +create table t_bug44738_lowercase (i int) comment='Old comment'; +select table_schema, table_name, table_comment from information_schema.tables + where table_schema like 'mysqltest_%' and table_name like 't_bug44738_%' + order by table_name; +alter table t_bug44738_UPPERCASE comment='New comment'; +alter table t_bug44738_lowercase comment='New comment'; +--echo # There should be no stale entries in TDC for our tables after the +--echo # above ALTER TABLE statements so new version of comments should be +--echo # returned by the below query to I_S. +select table_schema, table_name, table_comment from information_schema.tables + where table_schema like 'mysqltest_%' and table_name like 't_bug44738_%' + order by table_name; +drop database mysqltest_UPPERCASE; +use test; + +--echo # Let us check that the original test case which led to discovery +--echo # of this problem also works. +create table t_bug44738_UPPERCASE (i int); +select table_schema, table_name, table_comment from information_schema.tables + where table_schema = 'test' and table_name like 't_bug44738_%'; +drop table t_bug44738_UPPERCASE; +--echo # After the above DROP TABLE there are no entries in TDC which correspond +--echo # to our table and therefore the below statement should succeed. +create table t_bug44738_UPPERCASE (i int); +drop table t_bug44738_UPPERCASE; + +--echo # Finally, let us check that another issue which was exposed by +--echo # the original test case is solved. I.e. that fuse in CREATE TABLE +--echo # which ensures that table is not created if there is an entry for +--echo # it in TDC even though it was removed from disk uses normalized +--echo # version of the table name. +create table t_bug44738_UPPERCASE (i int) engine = myisam; +--echo # Load table definition in TDC. +select table_schema, table_name, table_comment from information_schema.tables + where table_schema = 'test' and table_name like 't_bug44738_%'; +--echo # Simulate manual removal of the table. +let $MYSQLD_DATADIR= `select @@datadir`; +--remove_file $MYSQLD_DATADIR/test/t_bug44738_UPPERCASE.frm +--remove_file $MYSQLD_DATADIR/test/t_bug44738_UPPERCASE.MYD +--remove_file $MYSQLD_DATADIR/test/t_bug44738_UPPERCASE.MYI +--echo # After manual removal of table still there should be an entry for table +--echo # in TDC so attempt to create table with the same name should fail. +--error ER_TABLE_EXISTS_ERROR +create table t_bug44738_UPPERCASE (i int); +--echo # And should succeed after FLUSH TABLES. +flush tables; +create table t_bug44738_UPPERCASE (i int); +drop table t_bug44738_UPPERCASE; diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index 015ae28c155..63ad5a1e97c 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -1634,3 +1634,63 @@ DROP TRIGGER tr1; DROP TABLE t1, t2, t3; --echo End of 5.1 tests + +--echo # +--echo # An additional test case for Bug#27430 Crash in subquery code +--echo # when in PS and table DDL changed after PREPARE +--echo # +--echo # Test merge table with too many merge children. +--echo # +--disable_warnings +drop table if exists t_parent; +--enable_warnings +set @save_table_definition_cache=@@global.table_definition_cache; +--echo # +--echo # Set @@global.table_definition_cache to minimum +--echo # +set @@global.table_definition_cache=400; +set @a=null; +let $1 = 400; +--echo # +--echo # Create 400 merge children +--echo # +--disable_query_log +while ($1) +{ +--disable_warnings + eval drop table if exists t$1; +--enable_warnings + eval create table t$1 (a int) engine=myisam; + eval set @a=ifnull(concat(@a, ", ", "t$1"), "t$1"); + dec $1; +} +--enable_query_log +set @a=concat("create table t_parent (a int) union(", @a, + ") insert_method=first engine=mrg_myisam"); +prepare stmt from @a; +execute stmt; +prepare stmt from "select * from t_parent"; +--error ER_NEED_REPREPARE +execute stmt; +--error ER_NEED_REPREPARE +execute stmt; +--error ER_NEED_REPREPARE +execute stmt; +deallocate prepare stmt; +--echo # +--echo # Create merge parent +--echo # + +--echo # +--echo # Cleanup +--echo # +let $1 = 400; +--disable_query_log +while ($1) +{ + eval drop table t$1; + dec $1; +} +--enable_query_log +drop table t_parent; +set @@global.table_definition_cache=@save_table_definition_cache; diff --git a/mysql-test/t/metadata.test b/mysql-test/t/metadata.test index a10767579fb..a42dcfd618d 100644 --- a/mysql-test/t/metadata.test +++ b/mysql-test/t/metadata.test @@ -130,3 +130,60 @@ SELECT COALESCE(d, d), IFNULL(d, d), IF(i, d, d), DROP TABLE t1; --echo End of 5.0 tests + +# Verify that column metadata is correct for all possible data types. +# Originally about BUG#42980 "Client doesn't set NUM_FLAG for DECIMAL" + +create table t1( +# numeric types +bool_col bool, +boolean_col boolean, +bit_col bit(5), +tiny tinyint, +tiny_uns tinyint unsigned, +small smallint, +small_uns smallint unsigned, +medium mediumint, +medium_uns mediumint unsigned, +int_col int, +int_col_uns int unsigned, +big bigint, +big_uns bigint unsigned, +decimal_col decimal(10,5), +# synonyms of DECIMAL +numeric_col numeric(10), +fixed_col fixed(10), +dec_col dec(10), +decimal_col_uns decimal(10,5) unsigned, +fcol float, +fcol_uns float unsigned, +dcol double, +double_precision_col double precision, +dcol_uns double unsigned, +# date/time types +date_col date, +time_col time, +timestamp_col timestamp, +year_col year, +datetime_col datetime, +# string types +char_col char(5), +varchar_col varchar(10), +binary_col binary(10), +varbinary_col varbinary(10), +tinyblob_col tinyblob, +blob_col blob, +mediumblob_col mediumblob, +longblob_col longblob, +text_col text, +mediumtext_col mediumtext, +longtext_col longtext, +enum_col enum("A","B","C"), +set_col set("F","E","D") +); + +--enable_metadata +select * from t1; +--disable_metadata + +drop table t1; diff --git a/mysql-test/t/partition_pruning.test b/mysql-test/t/partition_pruning.test index 11e65be45fc..ea72cef5b62 100644 --- a/mysql-test/t/partition_pruning.test +++ b/mysql-test/t/partition_pruning.test @@ -1159,3 +1159,22 @@ INSERT INTO t1 VALUES ('2006-03-01 12:00:00'); -- echo must use p0 only: explain partitions select * from t1 where recdate < '2006-01-01 00:00:00'; drop table t1; + +-- echo # +-- echo # BUG#33730 Full table scan instead selected partitions for query more than 10 partitions +-- echo # +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 (a int) + partition by range(a+0) ( + partition p0 values less than (64), + partition p1 values less than (128), + partition p2 values less than (255) +); +insert into t1 select A.a + 10*B.a from t0 A, t0 B; + +# this will use interval_via_walking +explain partitions select * from t1 where a between 10 and 13; +explain partitions select * from t1 where a between 10 and 10+33; + +drop table t0, t1; diff --git a/mysql-test/t/profiling.test b/mysql-test/t/profiling.test index 275c2d77c4a..afbce04b966 100644 --- a/mysql-test/t/profiling.test +++ b/mysql-test/t/profiling.test @@ -1,4 +1,4 @@ ---source include/have_community_features.inc +--source include/have_profiling.inc # Verify that the protocol isn't violated if we ask for profiling info # before profiling has recorded anything. diff --git a/mysql-test/t/sp-vars.test b/mysql-test/t/sp-vars.test index fe063889f81..2e7257cbcea 100644 --- a/mysql-test/t/sp-vars.test +++ b/mysql-test/t/sp-vars.test @@ -1448,3 +1448,42 @@ drop function f1; drop table t1; # End of 5.1 tests. + +########################################################################### +# +# Test case for BUG#28299: To-number conversion warnings work +# differenly with CHAR and VARCHAR sp variables +# +########################################################################### + +--echo +--echo --------------------------------------------------------------- +--echo BUG#28299 +--echo --------------------------------------------------------------- +--echo + +DELIMITER |; +CREATE PROCEDURE ctest() +BEGIN + DECLARE i CHAR(16); + DECLARE j INT; + SET i= 'string'; + SET j= 1 + i; +END| +DELIMITER ;| + +CALL ctest(); +DROP PROCEDURE ctest; + +DELIMITER |; +CREATE PROCEDURE vctest() +BEGIN + DECLARE i VARCHAR(16); + DECLARE j INT; + SET i= 'string'; + SET j= 1 + i; +END| +DELIMITER ;| + +CALL vctest(); +DROP PROCEDURE vctest; diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 44c4556340e..d82abab6f17 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -8267,3 +8267,53 @@ DROP TABLE t1, t2; --echo # ------------------------------------------------------------------ --echo # -- End of 5.1 tests --echo # ------------------------------------------------------------------ + +# +# Bug#39255: Stored procedures: crash if function references nonexistent table +# + +--disable_warnings +DROP FUNCTION IF EXISTS f1; +DROP TABLE IF EXISTS t_non_existing; +DROP TABLE IF EXISTS t1; +--enable_warnings + +delimiter |; +CREATE FUNCTION f1() RETURNS INT +BEGIN + DECLARE v INT; + SELECT a INTO v FROM t_non_existing; + RETURN 1; +END| +delimiter ;| + +CREATE TABLE t1 (a INT) ENGINE = myisam; +INSERT INTO t1 VALUES (1); + +--error ER_NO_SUCH_TABLE +SELECT * FROM t1 WHERE a = f1(); + +DROP FUNCTION f1; +DROP TABLE t1; + +--echo # +--echo # Bug#34197: CREATE PROCEDURE fails when COMMENT truncated in non +--echo # strict SQL mode +--echo # + +--disable_warnings +DROP PROCEDURE IF EXISTS p1; +--enable_warnings + +CREATE PROCEDURE p1 () +COMMENT +'12345678901234567890123456789012345678901234567890123456789012345678901234567890' +BEGIN +END; + +SELECT comment FROM mysql.proc WHERE name = "p1"; + +SELECT routine_comment FROM information_schema.routines WHERE routine_name = "p1"; + +DROP PROCEDURE p1; + diff --git a/mysql-test/t/sp_trans.test b/mysql-test/t/sp_trans.test index 0b04b9d7668..ce18b2b578e 100644 --- a/mysql-test/t/sp_trans.test +++ b/mysql-test/t/sp_trans.test @@ -592,6 +592,44 @@ select distinct f1, bug13575(f1) from t3 order by f1| drop function bug13575| drop table t3| +--echo # +--echo # End of 5.1 tests +--echo # + +--echo # +--echo # Bug #35877 Update .. WHERE with function, constraint violation, crash +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1_aux| +DROP TABLE IF EXISTS t1_not_null| +DROP FUNCTION IF EXISTS f1_two_inserts| +--enable_warnings + +-- echo # MyISAM test +CREATE TABLE t1_not_null (f1 BIGINT, f2 BIGINT NOT NULL)| +CREATE TABLE t1_aux (f1 BIGINT, f2 BIGINT)| +INSERT INTO t1_aux VALUES (1,1)| + +CREATE FUNCTION f1_two_inserts() returns INTEGER +BEGIN + INSERT INTO t1_not_null SET f1 = 10, f2 = NULL; + RETURN 1; +END| + +-- error ER_BAD_NULL_ERROR +UPDATE t1_aux SET f2 = 2 WHERE f1 = f1_two_inserts()| + +-- echo # InnoDB test +ALTER TABLE t1_not_null ENGINE = InnoDB| +ALTER TABLE t1_aux ENGINE = InnoDB| + +-- error ER_BAD_NULL_ERROR +UPDATE t1_aux SET f2 = 2 WHERE f1 = f1_two_inserts()| + +DROP TABLE t1_aux, t1_not_null| +DROP FUNCTION f1_two_inserts| + # # BUG#NNNN: New bug synopsis diff --git a/mysql-test/t/sql_mode.test b/mysql-test/t/sql_mode.test index 4a9f34443cb..27956bc8877 100644 --- a/mysql-test/t/sql_mode.test +++ b/mysql-test/t/sql_mode.test @@ -309,6 +309,21 @@ flush privileges; --connection default drop user mysqltest_32753@localhost; + +# +# Bug#21099 MySQL 5.0.22 silently creates MyISAM tables even though +# InnoDB specified. +# + +SET @org_mode=@@sql_mode; +SET @@sql_mode='traditional'; + +# Agreed change was to add NO_ENGINE_SUBSTITUTION to TRADITIONAL sql mode. +SELECT @@sql_mode LIKE '%NO_ENGINE_SUBSTITUTION%'; + +SET sql_mode=@org_mode; + + # # Bug#45100: Incomplete DROP USER in case of SQL_MODE = 'PAD_CHAR_TO_FULL_LENGTH' # diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test index 1e55f9d5993..3ab724a835a 100644 --- a/mysql-test/t/trigger.test +++ b/mysql-test/t/trigger.test @@ -2397,3 +2397,31 @@ SELECT * FROM t2; DROP TABLE t1, t2; --echo End of 5.1 tests. + + +--echo # +--echo # Bug#34453 Can't change size of file (Errcode: 1224) +--echo # + +--disable_warnings +DROP TRIGGER IF EXISTS t1_bi; +DROP TRIGGER IF EXISTS t1_bd; +DROP TABLE IF EXISTS t1; +DROP TEMPORARY TABLE IF EXISTS t2; +--enable_warnings + +CREATE TABLE t1 (s1 INT); +CREATE TEMPORARY TABLE t2 (s1 INT); +CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 VALUES (0); +CREATE TRIGGER t1_bd BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t2; +INSERT INTO t1 VALUES (0); +INSERT INTO t1 VALUES (0); +SELECT * FROM t1; +SELECT * FROM t2; +-- echo # Reported to give ERROR 14 (HY000): +-- echo # Can't change size of file (Errcode: 1224) +-- echo # on Windows +DELETE FROM t1; + +DROP TABLE t1; +DROP TEMPORARY TABLE t2; diff --git a/mysql-test/t/type_varchar.test b/mysql-test/t/type_varchar.test index 9098881e379..33b84266118 100644 --- a/mysql-test/t/type_varchar.test +++ b/mysql-test/t/type_varchar.test @@ -199,3 +199,21 @@ SELECT a,(a + 0) FROM t1 ORDER BY a; SELECT a,(a DIV 2) FROM t1 ORDER BY a; SELECT a,CAST(a AS SIGNED) FROM t1 ORDER BY a; DROP TABLE t1; + +# +# Bug #28299: To-number conversion warnings work differenly with CHAR +# and VARCHAR sp variables +# +# * Verify that 'Truncated incorrect DOUBLE value' is shown for 's' +# when using both CHAR and VARCHAR. +# + +CREATE TABLE t1 (a VARCHAR(16)); +INSERT INTO t1 VALUES ('5'), ('s'), (''); +SELECT 5 = a FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a CHAR(16)); +INSERT INTO t1 VALUES ('5'), ('s'), (''); +SELECT 5 = a FROM t1; +DROP TABLE t1; diff --git a/mysql-test/t/variables+c.test b/mysql-test/t/variables+c.test index 0092d34133d..aa4bc6c631c 100644 --- a/mysql-test/t/variables+c.test +++ b/mysql-test/t/variables+c.test @@ -1,4 +1,4 @@ ---source include/have_community_features.inc +--source include/have_profiling.inc # # Bug#24822: Patch: uptime_since_flush_status diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index 1580d7f36d7..7bda4a84406 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -1227,3 +1227,165 @@ SET GLOBAL max_binlog_cache_size = 5 * 1024 * 1024 * 1024; SELECT @@GLOBAL.max_binlog_cache_size; SET GLOBAL max_binlog_cache_size = @old_max_binlog_cache_size; --echo End of 5.1 tests + +########################################################################### + +--echo +--echo # +--echo # Bug#34828: OF is taken as OFF and a value of 0 is set for variable SQL_notes. +--echo # +--echo + +--echo # Checking sql_notes... +SET @sql_notes_saved = @@sql_notes; + +--echo +SET @@sql_notes = ON; +SELECT @@sql_notes; + +--echo +--error ER_WRONG_VALUE_FOR_VAR +SET @@sql_notes = OF; +SELECT @@sql_notes; + +--echo +SET @@sql_notes = OFF; +SELECT @@sql_notes; + +--echo +SET @@sql_notes = @sql_notes_saved; + +--echo +--echo # Checking delay_key_write... +SET @delay_key_write_saved = @@delay_key_write; + +--echo +SET GLOBAL delay_key_write = ON; +SELECT @@delay_key_write; + +--echo +--error ER_WRONG_VALUE_FOR_VAR +SET GLOBAL delay_key_write = OF; +SELECT @@delay_key_write; + +--echo +--error ER_WRONG_VALUE_FOR_VAR +SET GLOBAL delay_key_write = AL; +SELECT @@delay_key_write; + +--echo +SET GLOBAL delay_key_write = OFF; +SELECT @@delay_key_write; + +--echo +SET GLOBAL delay_key_write = ALL; +SELECT @@delay_key_write; + +--echo +SET GLOBAL delay_key_write = @delay_key_write_saved; + +--echo +--echo # Checking sql_safe_updates... +SET @sql_safe_updates_saved = @@sql_safe_updates; + +--echo +SET @@sql_safe_updates = ON; +SELECT @@sql_safe_updates; + +--echo +--error ER_WRONG_VALUE_FOR_VAR +SET @@sql_safe_updates = OF; +SELECT @@sql_safe_updates; + +--echo +SET @@sql_safe_updates = OFF; +SELECT @@sql_safe_updates; + +--echo +SET @@sql_safe_updates = @sql_safe_updates_saved; + +--echo +--echo # Checking foreign_key_checks... +SET @foreign_key_checks_saved = @@foreign_key_checks; + +--echo +SET @@foreign_key_checks = ON; +SELECT @@foreign_key_checks; + +--echo +--error ER_WRONG_VALUE_FOR_VAR +SET @@foreign_key_checks = OF; +SELECT @@foreign_key_checks; + +--echo +SET @@foreign_key_checks = OFF; +SELECT @@foreign_key_checks; + +--echo +SET @@foreign_key_checks = @foreign_key_checks_saved; + +--echo +--echo # Checking unique_checks... +SET @unique_checks_saved = @@unique_checks; + +--echo +SET @@unique_checks = ON; +SELECT @@unique_checks; + +--echo +--error ER_WRONG_VALUE_FOR_VAR +SET @@unique_checks = OF; +SELECT @@unique_checks; + +--echo +SET @@unique_checks = OFF; +SELECT @@unique_checks; + +--echo +SET @@unique_checks = @unique_checks_saved; + +--echo +--echo # Checking sql_buffer_result... +SET @sql_buffer_result_saved = @@sql_buffer_result; + +--echo +SET @@sql_buffer_result = ON; +SELECT @@sql_buffer_result; + +--echo +--error ER_WRONG_VALUE_FOR_VAR +SET @@sql_buffer_result = OF; +SELECT @@sql_buffer_result; + +--echo +SET @@sql_buffer_result = OFF; +SELECT @@sql_buffer_result; + +--echo +SET @@sql_buffer_result = @sql_buffer_result_saved; + +--echo +--echo # Checking sql_quote_show_create... +SET @sql_quote_show_create_saved = @@sql_quote_show_create; + +--echo +SET @@sql_quote_show_create = ON; +SELECT @@sql_quote_show_create; + +--echo +--error ER_WRONG_VALUE_FOR_VAR +SET @@sql_quote_show_create = OF; +SELECT @@sql_quote_show_create; + +--echo +SET @@sql_quote_show_create = OFF; +SELECT @@sql_quote_show_create; + +--echo +SET @@sql_quote_show_create = @sql_quote_show_create_saved; + +--echo +--echo # End of Bug#34828. +--echo + +########################################################################### diff --git a/mysys/Makefile.am b/mysys/Makefile.am index fdc93ba1a4a..0c916166aab 100644 --- a/mysys/Makefile.am +++ b/mysys/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (C) 2000-2006 MySQL AB +# Copyright (C) 2000-2006 MySQL AB, 2009 Sun Microsystems, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -25,7 +25,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \ mf_path.c mf_loadpath.c my_file.c \ my_open.c my_create.c my_dup.c my_seek.c my_read.c \ my_pread.c my_write.c my_getpagesize.c \ - mf_keycache.c mf_keycaches.c my_crc32.c \ + mf_keycaches.c my_crc32.c \ mf_iocache.c mf_iocache2.c mf_cache.c mf_tempfile.c \ mf_tempdir.c my_lock.c mf_brkhant.c my_alarm.c \ my_malloc.c my_realloc.c my_once.c mulalloc.c \ @@ -53,6 +53,14 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \ my_handler.c my_netware.c my_largepage.c \ my_memmem.c stacktrace.c \ my_windac.c my_access.c base64.c my_libwrap.c + +if NEED_THREAD +# mf_keycache is used only in the server, so it is safe to leave the file +# out of the non-threaded library. +# In fact, it will currently not compile without thread support. +libmysys_a_SOURCES += mf_keycache.c +endif + EXTRA_DIST = thr_alarm.c thr_lock.c my_pthread.c my_thr_init.c \ thr_mutex.c thr_rwlock.c \ CMakeLists.txt mf_soundex.c \ diff --git a/mysys/mf_keycaches.c b/mysys/mf_keycaches.c index 6227a05ce06..999e8cc7975 100644 --- a/mysys/mf_keycaches.c +++ b/mysys/mf_keycaches.c @@ -108,9 +108,9 @@ static my_bool safe_hash_init(SAFE_HASH *hash, uint elements, uchar *default_value) { DBUG_ENTER("safe_hash"); - if (hash_init(&hash->hash, &my_charset_bin, elements, - 0, 0, (hash_get_key) safe_hash_entry_get, - (void (*)(void*)) safe_hash_entry_free, 0)) + if (my_hash_init(&hash->hash, &my_charset_bin, elements, + 0, 0, (my_hash_get_key) safe_hash_entry_get, + (void (*)(void*)) safe_hash_entry_free, 0)) { hash->default_value= 0; DBUG_RETURN(1); @@ -137,7 +137,7 @@ static void safe_hash_free(SAFE_HASH *hash) */ if (hash->default_value) { - hash_free(&hash->hash); + my_hash_free(&hash->hash); rwlock_destroy(&hash->mutex); hash->default_value=0; } @@ -152,7 +152,7 @@ static uchar *safe_hash_search(SAFE_HASH *hash, const uchar *key, uint length) uchar *result; DBUG_ENTER("safe_hash_search"); rw_rdlock(&hash->mutex); - result= hash_search(&hash->hash, key, length); + result= my_hash_search(&hash->hash, key, length); rw_unlock(&hash->mutex); if (!result) result= hash->default_value; @@ -192,7 +192,7 @@ static my_bool safe_hash_set(SAFE_HASH *hash, const uchar *key, uint length, DBUG_PRINT("enter",("key: %.*s data: 0x%lx", length, key, (long) data)); rw_wrlock(&hash->mutex); - entry= (SAFE_HASH_ENTRY*) hash_search(&hash->hash, key, length); + entry= (SAFE_HASH_ENTRY*) my_hash_search(&hash->hash, key, length); if (data == hash->default_value) { @@ -206,7 +206,7 @@ static my_bool safe_hash_set(SAFE_HASH *hash, const uchar *key, uint length, /* unlink entry from list */ if ((*entry->prev= entry->next)) entry->next->prev= entry->prev; - hash_delete(&hash->hash, (uchar*) entry); + my_hash_delete(&hash->hash, (uchar*) entry); goto end; } if (entry) @@ -277,7 +277,7 @@ static void safe_hash_change(SAFE_HASH *hash, uchar *old_data, uchar *new_data) { if ((*entry->prev= entry->next)) entry->next->prev= entry->prev; - hash_delete(&hash->hash, (uchar*) entry); + my_hash_delete(&hash->hash, (uchar*) entry); } else entry->data= new_data; diff --git a/mysys/my_largepage.c b/mysys/my_largepage.c index a20111396cb..9fa5b73bf88 100644 --- a/mysys/my_largepage.c +++ b/mysys/my_largepage.c @@ -128,7 +128,7 @@ uchar* my_large_malloc_int(size_t size, myf my_flags) { if (my_flags & MY_WME) fprintf(stderr, - "Warning: Failed to allocate %lu bytesx from HugeTLB memory." + "Warning: Failed to allocate %lu bytes from HugeTLB memory." " errno %d\n", (ulong) size, errno); DBUG_RETURN(NULL); diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql index 67e18517915..c07686b793b 100644 --- a/scripts/mysql_system_tables.sql +++ b/scripts/mysql_system_tables.sql @@ -13,7 +13,7 @@ set @had_db_table= @@warning_count != 0; CREATE TABLE IF NOT EXISTS host ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, PRIMARY KEY Host (Host,Db) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Host privileges; Merged with database privileges'; -CREATE TABLE IF NOT EXISTS user ( Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, max_user_connections int(11) unsigned DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges'; +CREATE TABLE IF NOT EXISTS user ( Host char(60) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL, Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, Create_tablespace_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, ssl_type enum('','ANY','X509', 'SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL, ssl_cipher BLOB NOT NULL, x509_issuer BLOB NOT NULL, x509_subject BLOB NOT NULL, max_questions int(11) unsigned DEFAULT 0 NOT NULL, max_updates int(11) unsigned DEFAULT 0 NOT NULL, max_connections int(11) unsigned DEFAULT 0 NOT NULL, max_user_connections int(11) unsigned DEFAULT 0 NOT NULL, PRIMARY KEY Host (Host,User) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges'; -- Remember for later if user table already existed set @had_user_table= @@warning_count != 0; @@ -60,7 +60,7 @@ CREATE TABLE IF NOT EXISTS time_zone_transition_type ( Time_zone_id int unsign CREATE TABLE IF NOT EXISTS time_zone_leap_second ( Transition_time bigint signed NOT NULL, Correction int signed NOT NULL, PRIMARY KEY TranTime (Transition_time) ) engine=MyISAM CHARACTER SET utf8 comment='Leap seconds information for time zones'; -CREATE TABLE IF NOT EXISTS proc (db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum( 'CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA') DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob NOT NULL, returns longblob DEFAULT '' NOT NULL, body longblob NOT NULL, definer char(77) collate utf8_bin DEFAULT '' NOT NULL, created timestamp, modified timestamp, sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'NOT_USED', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE', 'NO_ENGINE_SUBSTITUTION', 'PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment char(64) collate utf8_bin DEFAULT '' NOT NULL, character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db,name,type)) engine=MyISAM character set utf8 comment='Stored Procedures'; +CREATE TABLE IF NOT EXISTS proc (db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum( 'CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA') DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob NOT NULL, returns longblob DEFAULT '' NOT NULL, body longblob NOT NULL, definer char(77) collate utf8_bin DEFAULT '' NOT NULL, created timestamp, modified timestamp, sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'NOT_USED', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE', 'NO_ENGINE_SUBSTITUTION', 'PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment text collate utf8_bin NOT NULL, character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db,name,type)) engine=MyISAM character set utf8 comment='Stored Procedures'; CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) binary DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp(14), PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges'; diff --git a/scripts/mysql_system_tables_data.sql b/scripts/mysql_system_tables_data.sql index 9a3a3f7bb84..03136fe9361 100644 --- a/scripts/mysql_system_tables_data.sql +++ b/scripts/mysql_system_tables_data.sql @@ -21,9 +21,9 @@ DROP TABLE tmp_db; -- from local machine if "users" table didn't exist before CREATE TEMPORARY TABLE tmp_user LIKE user; set @current_hostname= @@hostname; -INSERT INTO tmp_user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); -REPLACE INTO tmp_user SELECT @current_hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0 FROM dual WHERE LOWER( @current_hostname) != 'localhost'; -REPLACE INTO tmp_user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); +INSERT INTO tmp_user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); +REPLACE INTO tmp_user SELECT @current_hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0 FROM dual WHERE LOWER( @current_hostname) != 'localhost'; +REPLACE INTO tmp_user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); INSERT INTO tmp_user (host,user) VALUES ('localhost',''); INSERT INTO tmp_user (host,user) SELECT @current_hostname,'' FROM dual WHERE LOWER(@current_hostname ) != 'localhost'; INSERT INTO user SELECT * FROM tmp_user WHERE @had_user_table=0; diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql index a6497f57f0a..a5a9d4e0a84 100644 --- a/scripts/mysql_system_tables_fix.sql +++ b/scripts/mysql_system_tables_fix.sql @@ -427,6 +427,9 @@ ALTER TABLE proc ADD body_utf8 longblob DEFAULT NULL AFTER db_collation; ALTER TABLE proc MODIFY body_utf8 longblob DEFAULT NULL; +# Change comment from char(64) to text +ALTER TABLE proc MODIFY comment + text collate utf8_bin NOT NULL; # # EVENT privilege @@ -537,6 +540,18 @@ ALTER TABLE tables_priv MODIFY Table_priv set('Select','Insert','Update','Delete UPDATE user SET Trigger_priv=Super_priv WHERE @hadTriggerPriv = 0; +# +# user.Create_tablespace_priv +# + +SET @hadCreateTablespacePriv := 0; +SELECT @hadCreateTablespacePriv :=1 FROM user WHERE Create_tablespace_priv LIKE '%'; + +ALTER TABLE user ADD Create_tablespace_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Trigger_priv; +ALTER TABLE user MODIFY Create_tablespace_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL AFTER Trigger_priv; + +UPDATE user SET Create_tablespace_priv = Super_priv WHERE @hadCreateTablespacePriv = 0; + # Activate the new, possible modified privilege tables # This should not be needed, but gives us some extra testing that the above # changes was correct diff --git a/sql-common/client.c b/sql-common/client.c index 84029b449af..8ebd38178fa 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -145,9 +145,12 @@ int my_connect(my_socket fd, const struct sockaddr *name, uint namelen, uint timeout) { #if defined(__WIN__) || defined(__NETWARE__) - return connect(fd, (struct sockaddr*) name, namelen); + DBUG_ENTER("my_connect"); + DBUG_RETURN(connect(fd, (struct sockaddr*) name, namelen)); #else int flags, res, s_err; + DBUG_ENTER("my_connect"); + DBUG_PRINT("enter", ("fd: %d timeout: %u", fd, timeout)); /* If they passed us a timeout of zero, we should behave @@ -155,24 +158,26 @@ int my_connect(my_socket fd, const struct sockaddr *name, uint namelen, */ if (timeout == 0) - return connect(fd, (struct sockaddr*) name, namelen); + DBUG_RETURN(connect(fd, (struct sockaddr*) name, namelen)); flags = fcntl(fd, F_GETFL, 0); /* Set socket to not block */ #ifdef O_NONBLOCK fcntl(fd, F_SETFL, flags | O_NONBLOCK); /* and save the flags.. */ #endif + DBUG_PRINT("info", ("connecting non-blocking")); res= connect(fd, (struct sockaddr*) name, namelen); + DBUG_PRINT("info", ("connect result: %d errno: %d", res, errno)); s_err= errno; /* Save the error... */ fcntl(fd, F_SETFL, flags); if ((res != 0) && (s_err != EINPROGRESS)) { errno= s_err; /* Restore it */ - return(-1); + DBUG_RETURN(-1); } if (res == 0) /* Connected quickly! */ - return(0); - return wait_for_data(fd, timeout); + DBUG_RETURN(0); + DBUG_RETURN(wait_for_data(fd, timeout)); #endif } @@ -191,26 +196,58 @@ static int wait_for_data(my_socket fd, uint timeout) #ifdef HAVE_POLL struct pollfd ufds; int res; + DBUG_ENTER("wait_for_data"); + DBUG_PRINT("info", ("polling")); ufds.fd= fd; ufds.events= POLLIN | POLLPRI; if (!(res= poll(&ufds, 1, (int) timeout*1000))) { + DBUG_PRINT("info", ("poll timed out")); errno= EINTR; - return -1; + DBUG_RETURN(-1); } + DBUG_PRINT("info", + ("poll result: %d errno: %d revents: 0x%02d events: 0x%02d", + res, errno, ufds.revents, ufds.events)); if (res < 0 || !(ufds.revents & (POLLIN | POLLPRI))) - return -1; - return 0; + DBUG_RETURN(-1); + /* + At this point, we know that something happened on the socket. + But this does not means that everything is alright. + The connect might have failed. We need to retrieve the error code + from the socket layer. We must return success only if we are sure + that it was really a success. Otherwise we might prevent the caller + from trying another address to connect to. + */ + { + int s_err; + socklen_t s_len= sizeof(s_err); + + DBUG_PRINT("info", ("Get SO_ERROR from non-blocked connected socket.")); + res= getsockopt(fd, SOL_SOCKET, SO_ERROR, &s_err, &s_len); + DBUG_PRINT("info", ("getsockopt res: %d s_err: %d", res, s_err)); + if (res) + DBUG_RETURN(res); + /* getsockopt() was successful, check the retrieved status value. */ + if (s_err) + { + errno= s_err; + DBUG_RETURN(-1); + } + /* Status from connect() is zero. Socket is successfully connected. */ + } + DBUG_RETURN(0); #else SOCKOPT_OPTLEN_TYPE s_err_size = sizeof(uint); fd_set sfds; struct timeval tv; time_t start_time, now_time; int res, s_err; + DBUG_ENTER("wait_for_data"); if (fd >= FD_SETSIZE) /* Check if wrong error */ - return 0; /* Can't use timeout */ + DBUG_RETURN(0); /* Can't use timeout */ /* Our connection is "in progress." We can use the select() call to wait @@ -250,11 +287,11 @@ static int wait_for_data(my_socket fd, uint timeout) break; #endif if (res == 0) /* timeout */ - return -1; + DBUG_RETURN(-1); now_time= my_time(0); timeout-= (uint) (now_time - start_time); if (errno != EINTR || (int) timeout <= 0) - return -1; + DBUG_RETURN(-1); } /* @@ -265,14 +302,14 @@ static int wait_for_data(my_socket fd, uint timeout) s_err=0; if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (char*) &s_err, &s_err_size) != 0) - return(-1); + DBUG_RETURN(-1); if (s_err) { /* getsockopt could succeed */ errno = s_err; - return(-1); /* but return an error... */ + DBUG_RETURN(-1); /* but return an error... */ } - return (0); /* ok */ + DBUG_RETURN(0); /* ok */ #endif /* HAVE_POLL */ } #endif /* defined(__WIN__) || defined(__NETWARE__) */ @@ -999,7 +1036,6 @@ static const char *default_options[]= "ssl-key" ,"ssl-cert" ,"ssl-ca" ,"ssl-capath", "character-sets-dir", "default-character-set", "interactive-timeout", "connect-timeout", "local-infile", "disable-local-infile", - "replication-probe", "enable-reads-from-master", "repl-parse-query", "ssl-cipher", "max-allowed-packet", "protocol", "shared-memory-base-name", "multi-results", "multi-statements", "multi-queries", "secure-auth", "report-data-truncation", @@ -1145,7 +1181,7 @@ void mysql_read_default_options(struct st_mysql_options *options, my_free(options->ssl_capath, MYF(MY_ALLOW_ZERO_PTR)); options->ssl_capath = my_strdup(opt_arg, MYF(MY_WME)); break; - case 26: /* ssl_cipher */ + case 23: /* ssl_cipher */ my_free(options->ssl_cipher, MYF(MY_ALLOW_ZERO_PTR)); options->ssl_cipher= my_strdup(opt_arg, MYF(MY_WME)); break; @@ -1154,7 +1190,7 @@ void mysql_read_default_options(struct st_mysql_options *options, case 14: case 15: case 16: - case 26: + case 23: break; #endif /* HAVE_OPENSSL */ case 17: /* charset-lib */ @@ -1177,24 +1213,11 @@ void mysql_read_default_options(struct st_mysql_options *options, case 22: options->client_flag&= ~CLIENT_LOCAL_FILES; break; - case 23: /* replication probe */ -#ifndef TO_BE_DELETED - options->rpl_probe= 1; -#endif - break; - case 24: /* enable-reads-from-master */ - options->no_master_reads= 0; - break; - case 25: /* repl-parse-query */ -#ifndef TO_BE_DELETED - options->rpl_parse= 1; -#endif - break; - case 27: + case 24: /* max-allowed-packet */ if (opt_arg) options->max_allowed_packet= atoi(opt_arg); break; - case 28: /* protocol */ + case 25: /* protocol */ if ((options->protocol= find_type(opt_arg, &sql_protocol_typelib,0)) <= 0) { @@ -1202,24 +1225,24 @@ void mysql_read_default_options(struct st_mysql_options *options, exit(1); } break; - case 29: /* shared_memory_base_name */ + case 26: /* shared_memory_base_name */ #ifdef HAVE_SMEM if (options->shared_memory_base_name != def_shared_memory_base_name) my_free(options->shared_memory_base_name,MYF(MY_ALLOW_ZERO_PTR)); options->shared_memory_base_name=my_strdup(opt_arg,MYF(MY_WME)); #endif break; - case 30: + case 27: /* multi-results */ options->client_flag|= CLIENT_MULTI_RESULTS; break; - case 31: - case 32: + case 28: /* multi-statements */ + case 29: /* multi-queries */ options->client_flag|= CLIENT_MULTI_STATEMENTS | CLIENT_MULTI_RESULTS; break; - case 33: /* secure-auth */ + case 30: /* secure-auth */ options->secure_auth= TRUE; break; - case 34: /* report-data-truncation */ + case 31: /* report-data-truncation */ options->report_data_truncation= opt_arg ? test(atoi(opt_arg)) : 1; break; default: @@ -1313,7 +1336,7 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields, field->flags= uint2korr(pos+7); field->decimals= (uint) pos[9]; - if (INTERNAL_NUM_FIELD(field)) + if (IS_NUM(field->type)) field->flags|= NUM_FLAG; if (default_value && row->data[7]) { @@ -1354,7 +1377,7 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields, field->flags= (uint) (uchar) row->data[4][0]; field->decimals=(uint) (uchar) row->data[4][1]; } - if (INTERNAL_NUM_FIELD(field)) + if (IS_NUM(field->type)) field->flags|= NUM_FLAG; if (default_value && row->data[5]) { @@ -1546,16 +1569,8 @@ mysql_init(MYSQL *mysql) else bzero((char*) (mysql), sizeof(*(mysql))); mysql->options.connect_timeout= CONNECT_TIMEOUT; - mysql->last_used_con= mysql->next_slave= mysql->master = mysql; mysql->charset=default_client_charset_info; strmov(mysql->net.sqlstate, not_error_sqlstate); - /* - By default, we are a replication pivot. The caller must reset it - after we return if this is not the case. - */ -#ifndef TO_BE_DELETED - mysql->rpl_pivot = 1; -#endif /* Only enable LOAD DATA INFILE by default if configured with @@ -1877,11 +1892,18 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, init_sigpipe_variables DBUG_ENTER("mysql_real_connect"); - DBUG_PRINT("enter",("host: %s db: %s user: %s", + DBUG_PRINT("enter",("host: %s db: %s user: %s (client)", host ? host : "(Null)", db ? db : "(Null)", user ? user : "(Null)")); + /* Test whether we're already connected */ + if (net->vio) + { + set_mysql_error(mysql, CR_ALREADY_CONNECTED, unknown_sqlstate); + DBUG_RETURN(0); + } + /* Don't give sigpipe errors if the client doesn't want them */ set_sigpipe(mysql); mysql->methods= &client_methods; @@ -1927,6 +1949,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, unix_socket=mysql->options.unix_socket; mysql->server_status=SERVER_STATUS_AUTOCOMMIT; + DBUG_PRINT("info", ("Connecting")); /* Part 0: Grab a socket and connect it to the server @@ -1936,6 +1959,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, mysql->options.protocol == MYSQL_PROTOCOL_MEMORY) && (!host || !strcmp(host,LOCAL_HOST))) { + DBUG_PRINT("info", ("Using shared memory")); if ((create_shared_memory(mysql,net, mysql->options.connect_timeout)) == INVALID_HANDLE_VALUE) { @@ -2034,6 +2058,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, } } #endif + DBUG_PRINT("info", ("net->vio: %p protocol: %d", + net->vio, mysql->options.protocol)); if (!net->vio && (!mysql->options.protocol || mysql->options.protocol == MYSQL_PROTOCOL_TCP)) @@ -2105,6 +2131,11 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, min(sizeof(sock_addr.sin_addr), (size_t) hp->h_length)); DBUG_PRINT("info",("Trying %s...", (my_inet_ntoa(sock_addr.sin_addr, ipaddr), ipaddr))); + /* + Here we rely on my_connect() to return success only if the + connect attempt was really successful. Otherwise we would stop + trying another address, believing we were successful. + */ status= my_connect(sock, (struct sockaddr *) &sock_addr, sizeof(sock_addr), mysql->options.connect_timeout); } @@ -2163,6 +2194,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, /* Part 1: Connection established, read and parse first packet */ + DBUG_PRINT("info", ("Read first packet.")); if ((pkt_length=cli_safe_read(mysql)) == packet_error) { @@ -2479,11 +2511,6 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user, mysql->reconnect=reconnect; } -#ifndef TO_BE_DELETED - if (mysql->options.rpl_probe && mysql_rpl_probe(mysql)) - goto error; -#endif - DBUG_PRINT("exit", ("Mysql handler: 0x%lx", (long) mysql)); reset_sigpipe(mysql); DBUG_RETURN(mysql); @@ -2505,28 +2532,6 @@ error: } -/* needed when we move MYSQL structure to a different address */ - -#ifndef TO_BE_DELETED -static void mysql_fix_pointers(MYSQL* mysql, MYSQL* old_mysql) -{ - MYSQL *tmp, *tmp_prev; - if (mysql->master == old_mysql) - mysql->master= mysql; - if (mysql->last_used_con == old_mysql) - mysql->last_used_con= mysql; - if (mysql->last_used_slave == old_mysql) - mysql->last_used_slave= mysql; - for (tmp_prev = mysql, tmp = mysql->next_slave; - tmp != old_mysql;tmp = tmp->next_slave) - { - tmp_prev= tmp; - } - tmp_prev->next_slave= mysql; -} -#endif - - my_bool mysql_reconnect(MYSQL *mysql) { MYSQL tmp_mysql; @@ -2545,8 +2550,7 @@ my_bool mysql_reconnect(MYSQL *mysql) mysql_init(&tmp_mysql); tmp_mysql.options= mysql->options; tmp_mysql.options.my_cnf_file= tmp_mysql.options.my_cnf_group= 0; - tmp_mysql.rpl_pivot= mysql->rpl_pivot; - + if (!mysql_real_connect(&tmp_mysql,mysql->host,mysql->user,mysql->passwd, mysql->db, mysql->port, mysql->unix_socket, mysql->client_flag | CLIENT_REMEMBER_OPTIONS)) @@ -2580,7 +2584,6 @@ my_bool mysql_reconnect(MYSQL *mysql) mysql->free_me=0; mysql_close(mysql); *mysql=tmp_mysql; - mysql_fix_pointers(mysql, &tmp_mysql); /* adjust connection pointers */ net_clear(&mysql->net, 1); mysql->affected_rows= ~(my_ulonglong) 0; DBUG_RETURN(0); @@ -2758,23 +2761,6 @@ void STDCALL mysql_close(MYSQL *mysql) mysql_close_free_options(mysql); mysql_close_free(mysql); mysql_detach_stmt_list(&mysql->stmts, "mysql_close"); -#ifndef TO_BE_DELETED - /* free/close slave list */ - if (mysql->rpl_pivot) - { - MYSQL* tmp; - for (tmp = mysql->next_slave; tmp != mysql; ) - { - /* trick to avoid following freed pointer */ - MYSQL* tmp1 = tmp->next_slave; - mysql_close(tmp); - tmp = tmp1; - } - mysql->rpl_pivot=0; - } -#endif - if (mysql != mysql->master) - mysql_close(mysql->master); #ifndef MYSQL_SERVER if (mysql->thd) (*mysql->methods->free_embedded_thd)(mysql); @@ -2794,12 +2780,6 @@ static my_bool cli_read_query_result(MYSQL *mysql) ulong length; DBUG_ENTER("cli_read_query_result"); - /* - Read from the connection which we actually used, which - could differ from the original connection if we have slaves - */ - mysql = mysql->last_used_con; - if ((length = cli_safe_read(mysql)) == packet_error) DBUG_RETURN(1); free_old_query(mysql); /* Free old result */ @@ -2874,23 +2854,6 @@ int STDCALL mysql_send_query(MYSQL* mysql, const char* query, ulong length) { DBUG_ENTER("mysql_send_query"); - DBUG_PRINT("enter",("rpl_parse: %d rpl_pivot: %d", - mysql->options.rpl_parse, mysql->rpl_pivot)); -#ifndef TO_BE_DELETED - if (mysql->options.rpl_parse && mysql->rpl_pivot) - { - switch (mysql_rpl_query_type(query, length)) { - case MYSQL_RPL_MASTER: - DBUG_RETURN(mysql_master_send_query(mysql, query, length)); - case MYSQL_RPL_SLAVE: - DBUG_RETURN(mysql_slave_send_query(mysql, query, length)); - case MYSQL_RPL_ADMIN: - break; /* fall through */ - } - } - mysql->last_used_con = mysql; -#endif - DBUG_RETURN(simple_command(mysql, COM_QUERY, (uchar*) query, length, 1)); } @@ -2917,8 +2880,7 @@ MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql) { MYSQL_RES *result; DBUG_ENTER("mysql_store_result"); - /* read from the actually used connection */ - mysql = mysql->last_used_con; + if (!mysql->fields) DBUG_RETURN(0); if (mysql->status != MYSQL_STATUS_GET_RESULT) @@ -2973,8 +2935,6 @@ static MYSQL_RES * cli_use_result(MYSQL *mysql) MYSQL_RES *result; DBUG_ENTER("cli_use_result"); - mysql = mysql->last_used_con; - if (!mysql->fields) DBUG_RETURN(0); if (mysql->status != MYSQL_STATUS_GET_RESULT) diff --git a/sql/Makefile.am b/sql/Makefile.am index 600a6117ebf..d4c79851904 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -110,7 +110,7 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \ sql_plugin.h authors.h event_parse_data.h \ event_data_objects.h event_scheduler.h \ sql_partition.h partition_info.h partition_element.h \ - contributors.h sql_servers.h sql_signal.h + contributors.h sql_servers.h sql_signal.h records.h mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \ item.cc item_sum.cc item_buff.cc item_func.cc \ diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc index dba32cac6b2..271ac73bd30 100644 --- a/sql/event_data_objects.cc +++ b/sql/event_data_objects.cc @@ -1225,7 +1225,9 @@ Event_timed::get_create_event(THD *thd, String *buf) expression)) DBUG_RETURN(EVEX_MICROSECOND_UNSUP); - buf->append(STRING_WITH_LEN("CREATE EVENT ")); + buf->append(STRING_WITH_LEN("CREATE ")); + append_definer(thd, buf, &definer_user, &definer_host); + buf->append(STRING_WITH_LEN("EVENT ")); append_identifier(thd, buf, name.str, name.length); if (expression) diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc index daaa6be0520..ea20270b457 100644 --- a/sql/event_scheduler.cc +++ b/sql/event_scheduler.cc @@ -607,7 +607,12 @@ Event_scheduler::stop() LOCK_DATA(); DBUG_PRINT("info", ("state before action %s", scheduler_states_names[state].str)); if (state != RUNNING) + { + /* Synchronously wait until the scheduler stops. */ + while (state != INITIALIZED) + COND_STATE_WAIT(thd, NULL, "Waiting for the scheduler to stop"); goto end; + } /* Guarantee we don't catch spurious signals */ do { diff --git a/sql/field.cc b/sql/field.cc index 64b156fbdcb..2d29c0b7f74 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1016,6 +1016,36 @@ Item_result Field::result_merge_type(enum_field_types field_type) Static help functions *****************************************************************************/ +/** + Output a warning for erroneous conversion of strings to numerical + values. For use with ER_TRUNCATED_WRONG_VALUE[_FOR_FIELD] + + @param thd THD object + @param str pointer to string that failed to be converted + @param length length of string + @param cs charset for string + @param typestr string describing type converted to + @param error error value to output + @param field_name (for *_FOR_FIELD) name of field + @param row_num (for *_FOR_FIELD) row number + */ +static void push_numerical_conversion_warning(THD* thd, const char* str, + uint length, CHARSET_INFO* cs, + const char* typestr, int error, + const char* field_name="UNKNOWN", + ulong row_num=0) +{ + char buf[max(max(DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE, + LONGLONG_TO_STRING_CONVERSION_BUFFER_SIZE), + DECIMAL_TO_STRING_CONVERSION_BUFFER_SIZE)]; + + String tmp(buf, sizeof(buf), cs); + tmp.copy(str, length, cs); + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + error, ER(error), typestr, tmp.c_ptr(), + field_name, row_num); +} + /** Check whether a field type can be partially indexed by a key. @@ -1109,14 +1139,11 @@ int Field_num::check_int(CHARSET_INFO *cs, const char *str, int length, /* Test if we get an empty string or wrong integer */ if (str == int_end || error == MY_ERRNO_EDOM) { - char buff[128]; - String tmp(buff, (uint32) sizeof(buff), system_charset_info); - tmp.copy(str, length, system_charset_info); - push_warning_printf(table->in_use, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, - ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD), - "integer", tmp.c_ptr(), field_name, - (ulong) table->in_use->warning_info->current_row_for_warning()); + push_numerical_conversion_warning(table->in_use, str, length, + cs, "integer", + ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, + field_name, + table->in_use->warning_info->current_row_for_warning()); return 1; } /* Test if we have garbage at the end of the given string. */ @@ -1772,7 +1799,7 @@ bool Field::optimize_range(uint idx, uint part) } -Field *Field::new_field(MEM_ROOT *root, struct st_table *new_table, +Field *Field::new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type __attribute__((unused))) { Field *tmp; @@ -1793,7 +1820,7 @@ Field *Field::new_field(MEM_ROOT *root, struct st_table *new_table, } -Field *Field::new_key_field(MEM_ROOT *root, struct st_table *new_table, +Field *Field::new_key_field(MEM_ROOT *root, TABLE *new_table, uchar *new_ptr, uchar *new_null_ptr, uint new_null_bit) { @@ -1810,7 +1837,7 @@ Field *Field::new_key_field(MEM_ROOT *root, struct st_table *new_table, /* This is used to generate a field in TABLE from TABLE_SHARE */ -Field *Field::clone(MEM_ROOT *root, struct st_table *new_table) +Field *Field::clone(MEM_ROOT *root, TABLE *new_table) { Field *tmp; if ((tmp= (Field*) memdup_root(root,(char*) this,size_of()))) @@ -2674,16 +2701,11 @@ int Field_new_decimal::store(const char *from, uint length, &decimal_value)) && table->in_use->abort_on_warning) { - /* Because "from" is not NUL-terminated and we use %s in the ER() */ - String from_as_str; - from_as_str.copy(from, length, &my_charset_bin); - - push_warning_printf(table->in_use, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, - ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD), - "decimal", from_as_str.c_ptr(), field_name, - (ulong) table->in_use->warning_info->current_row_for_warning()); - + push_numerical_conversion_warning(table->in_use, from, length, + &my_charset_bin, "decimal", + ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, + field_name, + table->in_use->warning_info->current_row_for_warning()); DBUG_RETURN(err); } @@ -2697,18 +2719,13 @@ int Field_new_decimal::store(const char *from, uint length, break; case E_DEC_BAD_NUM: { - /* Because "from" is not NUL-terminated and we use %s in the ER() */ - String from_as_str; - from_as_str.copy(from, length, &my_charset_bin); - - push_warning_printf(table->in_use, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, - ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD), - "decimal", from_as_str.c_ptr(), field_name, - (ulong) table->in_use->warning_info->current_row_for_warning()); - my_decimal_set_zero(&decimal_value); - - break; + push_numerical_conversion_warning(table->in_use, from, length, + &my_charset_bin, "decimal", + ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, + field_name, + table->in_use->warning_info->current_row_for_warning()); + my_decimal_set_zero(&decimal_value); + break; } } @@ -6610,13 +6627,8 @@ double Field_string::val_real(void) !check_if_only_end_space(cs, end, (char*) ptr + field_length)))) { - char buf[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE]; - String tmp(buf, sizeof(buf), cs); - tmp.copy((char*) ptr, field_length, cs); - push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_TRUNCATED_WRONG_VALUE, - ER(ER_TRUNCATED_WRONG_VALUE), - "DOUBLE", tmp.c_ptr()); + push_numerical_conversion_warning(current_thd, (char*)ptr, field_length, + cs, "DOUBLE", ER_TRUNCATED_WRONG_VALUE); } return result; } @@ -6636,13 +6648,8 @@ longlong Field_string::val_int(void) !check_if_only_end_space(cs, end, (char*) ptr + field_length)))) { - char buf[LONGLONG_TO_STRING_CONVERSION_BUFFER_SIZE]; - String tmp(buf, sizeof(buf), cs); - tmp.copy((char*) ptr, field_length, cs); - push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_TRUNCATED_WRONG_VALUE, - ER(ER_TRUNCATED_WRONG_VALUE), - "INTEGER", tmp.c_ptr()); + push_numerical_conversion_warning(current_thd, (char*)ptr, field_length, + cs, "INTEGER", ER_TRUNCATED_WRONG_VALUE); } return result; } @@ -6674,14 +6681,8 @@ my_decimal *Field_string::val_decimal(my_decimal *decimal_value) charset(), decimal_value); if (!table->in_use->no_errors && err) { - char buf[DECIMAL_TO_STRING_CONVERSION_BUFFER_SIZE]; - CHARSET_INFO *cs= charset(); - String tmp(buf, sizeof(buf), cs); - tmp.copy((char*) ptr, field_length, cs); - push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_TRUNCATED_WRONG_VALUE, - ER(ER_TRUNCATED_WRONG_VALUE), - "DECIMAL", tmp.c_ptr()); + push_numerical_conversion_warning(current_thd, (char*)ptr, field_length, + charset(), "DECIMAL", ER_TRUNCATED_WRONG_VALUE); } return decimal_value; @@ -7002,7 +7003,7 @@ uint Field_string::get_key_image(uchar *buff, uint length, imagetype type_arg) } -Field *Field_string::new_field(MEM_ROOT *root, struct st_table *new_table, +Field *Field_string::new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type) { Field *field; @@ -7113,22 +7114,46 @@ int Field_varstring::store(longlong nr, bool unsigned_val) double Field_varstring::val_real(void) { ASSERT_COLUMN_MARKED_FOR_READ; - int not_used; - char *end_not_used; + int error; + char *end; + double result; + CHARSET_INFO* cs= charset(); + uint length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr); - return my_strntod(field_charset, (char*) ptr+length_bytes, length, - &end_not_used, ¬_used); + result= my_strntod(cs, (char*)ptr+length_bytes, length, &end, &error); + + if (!table->in_use->no_errors && + (error || (length != (uint)(end - (char*)ptr+length_bytes) && + !check_if_only_end_space(cs, end, (char*)ptr+length_bytes+length)))) + { + push_numerical_conversion_warning(current_thd, (char*)ptr+length_bytes, + length, cs,"DOUBLE", + ER_TRUNCATED_WRONG_VALUE); + } + return result; } longlong Field_varstring::val_int(void) { ASSERT_COLUMN_MARKED_FOR_READ; - int not_used; - char *end_not_used; + int error; + char *end; + CHARSET_INFO *cs= charset(); + uint length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr); - return my_strntoll(field_charset, (char*) ptr+length_bytes, length, 10, - &end_not_used, ¬_used); + longlong result= my_strntoll(cs, (char*) ptr+length_bytes, length, 10, + &end, &error); + + if (!table->in_use->no_errors && + (error || (length != (uint)(end - (char*)ptr+length_bytes) && + !check_if_only_end_space(cs, end, (char*)ptr+length_bytes+length)))) + { + push_numerical_conversion_warning(current_thd, (char*)ptr+length_bytes, + length, cs, "INTEGER", + ER_TRUNCATED_WRONG_VALUE); + } + return result; } String *Field_varstring::val_str(String *val_buffer __attribute__((unused)), @@ -7144,9 +7169,17 @@ String *Field_varstring::val_str(String *val_buffer __attribute__((unused)), my_decimal *Field_varstring::val_decimal(my_decimal *decimal_value) { ASSERT_COLUMN_MARKED_FOR_READ; + CHARSET_INFO *cs= charset(); uint length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr); - str2my_decimal(E_DEC_FATAL_ERROR, (char*) ptr+length_bytes, length, - charset(), decimal_value); + int error= str2my_decimal(E_DEC_FATAL_ERROR, (char*) ptr+length_bytes, length, + cs, decimal_value); + + if (!table->in_use->no_errors && error) + { + push_numerical_conversion_warning(current_thd, (char*)ptr+length_bytes, + length, cs, "DECIMAL", + ER_TRUNCATED_WRONG_VALUE); + } return decimal_value; } @@ -7548,7 +7581,7 @@ int Field_varstring::cmp_binary(const uchar *a_ptr, const uchar *b_ptr, } -Field *Field_varstring::new_field(MEM_ROOT *root, struct st_table *new_table, +Field *Field_varstring::new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type) { Field_varstring *res= (Field_varstring*) Field::new_field(root, new_table, @@ -7560,7 +7593,7 @@ Field *Field_varstring::new_field(MEM_ROOT *root, struct st_table *new_table, Field *Field_varstring::new_key_field(MEM_ROOT *root, - struct st_table *new_table, + TABLE *new_table, uchar *new_ptr, uchar *new_null_ptr, uint new_null_bit) { @@ -8690,7 +8723,7 @@ void Field_enum::sql_type(String &res) const } -Field *Field_enum::new_field(MEM_ROOT *root, struct st_table *new_table, +Field *Field_enum::new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type) { Field_enum *res= (Field_enum*) Field::new_field(root, new_table, keep_type); @@ -8988,7 +9021,7 @@ Field_bit::do_last_null_byte() const Field *Field_bit::new_key_field(MEM_ROOT *root, - struct st_table *new_table, + TABLE *new_table, uchar *new_ptr, uchar *new_null_ptr, uint new_null_bit) { @@ -9828,8 +9861,7 @@ bool Create_field::init(THD *thd, char *fld_name, enum_field_types fld_type, break; case MYSQL_TYPE_DATE: /* Old date type. */ - if (protocol_version != PROTOCOL_VERSION-1) - sql_type= MYSQL_TYPE_NEWDATE; + sql_type= MYSQL_TYPE_NEWDATE; /* fall trough */ case MYSQL_TYPE_NEWDATE: length= 10; diff --git a/sql/field.h b/sql/field.h index ffcf665d45f..0de07935b68 100644 --- a/sql/field.h +++ b/sql/field.h @@ -60,8 +60,8 @@ public: Note that you can use table->in_use as replacement for current_thd member only inside of val_*() and store() members (e.g. you can't use it in cons) */ - struct st_table *table; // Pointer for table - struct st_table *orig_table; // Pointer to original table + TABLE *table; // Pointer for table + TABLE *orig_table; // Pointer to original table const char **table_name, *field_name; LEX_STRING comment; /* Field is part of the following keys */ @@ -301,12 +301,12 @@ public: */ virtual bool can_be_compared_as_longlong() const { return FALSE; } virtual void free() {} - virtual Field *new_field(MEM_ROOT *root, struct st_table *new_table, + virtual Field *new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type); - virtual Field *new_key_field(MEM_ROOT *root, struct st_table *new_table, + virtual Field *new_key_field(MEM_ROOT *root, TABLE *new_table, uchar *new_ptr, uchar *new_null_ptr, uint new_null_bit); - Field *clone(MEM_ROOT *mem_root, struct st_table *new_table); + Field *clone(MEM_ROOT *mem_root, TABLE *new_table); inline void move_field(uchar *ptr_arg,uchar *null_ptr_arg,uchar null_bit_arg) { ptr=ptr_arg; null_ptr=null_ptr_arg; null_bit=null_bit_arg; @@ -1506,7 +1506,7 @@ public: enum_field_types real_type() const { return MYSQL_TYPE_STRING; } bool has_charset(void) const { return charset() == &my_charset_bin ? FALSE : TRUE; } - Field *new_field(MEM_ROOT *root, struct st_table *new_table, bool keep_type); + Field *new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type); virtual uint get_key_image(uchar *buff,uint length, imagetype type); private: int do_save_field_metadata(uchar *first_byte); @@ -1593,8 +1593,8 @@ public: enum_field_types real_type() const { return MYSQL_TYPE_VARCHAR; } bool has_charset(void) const { return charset() == &my_charset_bin ? FALSE : TRUE; } - Field *new_field(MEM_ROOT *root, struct st_table *new_table, bool keep_type); - Field *new_key_field(MEM_ROOT *root, struct st_table *new_table, + Field *new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type); + Field *new_key_field(MEM_ROOT *root, TABLE *new_table, uchar *new_ptr, uchar *new_null_ptr, uint new_null_bit); uint is_equal(Create_field *new_field); @@ -1833,7 +1833,7 @@ public: { flags|=ENUM_FLAG; } - Field *new_field(MEM_ROOT *root, struct st_table *new_table, bool keep_type); + Field *new_field(MEM_ROOT *root, TABLE *new_table, bool keep_type); enum_field_types type() const { return MYSQL_TYPE_STRING; } enum Item_result cmp_type () const { return INT_RESULT; } enum Item_result cast_to_int_type () const { return INT_RESULT; } @@ -1971,7 +1971,7 @@ public: uint param_data, bool low_byte_first); virtual void set_default(); - Field *new_key_field(MEM_ROOT *root, struct st_table *new_table, + Field *new_key_field(MEM_ROOT *root, TABLE *new_table, uchar *new_ptr, uchar *new_null_ptr, uint new_null_bit); void set_bit_ptr(uchar *bit_ptr_arg, uchar bit_ofs_arg) diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 90194fa00e7..2a73ac5d906 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -355,8 +355,8 @@ Thd_ndb::Thd_ndb() m_error_code= 0; query_state&= NDB_QUERY_NORMAL; options= 0; - (void) hash_init(&open_tables, &my_charset_bin, 5, 0, 0, - (hash_get_key)thd_ndb_share_get_key, 0, 0); + (void) my_hash_init(&open_tables, &my_charset_bin, 5, 0, 0, + (my_hash_get_key)thd_ndb_share_get_key, 0, 0); } Thd_ndb::~Thd_ndb() @@ -380,7 +380,7 @@ Thd_ndb::~Thd_ndb() ndb= NULL; } changed_tables.empty(); - hash_free(&open_tables); + my_hash_free(&open_tables); } void @@ -4587,9 +4587,9 @@ int ha_ndbcluster::init_handler_for_statement(THD *thd, Thd_ndb *thd_ndb) const void *key= m_table; HASH_SEARCH_STATE state; THD_NDB_SHARE *thd_ndb_share= - (THD_NDB_SHARE*)hash_first(&thd_ndb->open_tables, (uchar *)&key, sizeof(key), &state); + (THD_NDB_SHARE*)my_hash_first(&thd_ndb->open_tables, (uchar *)&key, sizeof(key), &state); while (thd_ndb_share && thd_ndb_share->key != key) - thd_ndb_share= (THD_NDB_SHARE*)hash_next(&thd_ndb->open_tables, (uchar *)&key, sizeof(key), &state); + thd_ndb_share= (THD_NDB_SHARE*)my_hash_next(&thd_ndb->open_tables, (uchar *)&key, sizeof(key), &state); if (thd_ndb_share == 0) { thd_ndb_share= (THD_NDB_SHARE *) alloc_root(&thd->transaction.mem_root, @@ -5523,8 +5523,8 @@ int ha_ndbcluster::create(const char *name, */ { uint length= (uint) strlen(name); - if ((share= (NDB_SHARE*) hash_search(&ndbcluster_open_tables, - (uchar*) name, length))) + if ((share= (NDB_SHARE*) my_hash_search(&ndbcluster_open_tables, + (uchar*) name, length))) handle_trailing_share(share); } /* @@ -7118,18 +7118,18 @@ int ndbcluster_find_files(handlerton *hton, THD *thd, NdbDictionary::Object::UserTable) != 0) ERR_RETURN(dict->getNdbError()); - if (hash_init(&ndb_tables, system_charset_info,list.count,0,0, - (hash_get_key)tables_get_key,0,0)) + if (my_hash_init(&ndb_tables, system_charset_info,list.count,0,0, + (my_hash_get_key)tables_get_key,0,0)) { DBUG_PRINT("error", ("Failed to init HASH ndb_tables")); DBUG_RETURN(-1); } - if (hash_init(&ok_tables, system_charset_info,32,0,0, - (hash_get_key)tables_get_key,0,0)) + if (my_hash_init(&ok_tables, system_charset_info,32,0,0, + (my_hash_get_key)tables_get_key,0,0)) { DBUG_PRINT("error", ("Failed to init HASH ok_tables")); - hash_free(&ndb_tables); + my_hash_free(&ndb_tables); DBUG_RETURN(-1); } @@ -7170,7 +7170,8 @@ int ndbcluster_find_files(handlerton *hton, THD *thd, { bool file_on_disk= FALSE; DBUG_PRINT("info", ("%s", file_name->str)); - if (hash_search(&ndb_tables, (uchar*) file_name->str, file_name->length)) + if (my_hash_search(&ndb_tables, (uchar*) file_name->str, + file_name->length)) { build_table_filename(name, sizeof(name) - 1, db, file_name->str, reg_ext, 0); @@ -7205,10 +7206,10 @@ int ndbcluster_find_files(handlerton *hton, THD *thd, if (file_on_disk) { // Ignore this ndb table - uchar *record= hash_search(&ndb_tables, (uchar*) file_name->str, - file_name->length); + uchar *record= my_hash_search(&ndb_tables, (uchar*) file_name->str, + file_name->length); DBUG_ASSERT(record); - hash_delete(&ndb_tables, record); + my_hash_delete(&ndb_tables, record); push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_TABLE_EXISTS_ERROR, "Local table %s.%s shadows ndb table", @@ -7242,7 +7243,7 @@ int ndbcluster_find_files(handlerton *hton, THD *thd, build_table_filename(name, sizeof(name) - 1, db, "", "", 0); for (i= 0; i < ok_tables.records; i++) { - file_name_str= (char*)hash_element(&ok_tables, i); + file_name_str= (char*)my_hash_element(&ok_tables, i); end= end1 + tablename_to_filename(file_name_str, end1, sizeof(name) - (end1 - name)); pthread_mutex_lock(&LOCK_open); @@ -7258,8 +7259,9 @@ int ndbcluster_find_files(handlerton *hton, THD *thd, List<char> create_list; for (i= 0 ; i < ndb_tables.records ; i++) { - file_name_str= (char*) hash_element(&ndb_tables, i); - if (!hash_search(&ok_tables, (uchar*) file_name_str, strlen(file_name_str))) + file_name_str= (char*) my_hash_element(&ndb_tables, i); + if (!my_hash_search(&ok_tables, (uchar*) file_name_str, + strlen(file_name_str))) { build_table_filename(name, sizeof(name) - 1, db, file_name_str, reg_ext, 0); @@ -7313,8 +7315,8 @@ int ndbcluster_find_files(handlerton *hton, THD *thd, pthread_mutex_unlock(&LOCK_open); - hash_free(&ok_tables); - hash_free(&ndb_tables); + my_hash_free(&ok_tables); + my_hash_free(&ndb_tables); // Delete schema file from files if (!strcmp(db, NDB_REP_DB)) @@ -7478,8 +7480,8 @@ static int ndbcluster_init(void *p) goto ndbcluster_init_error; } - (void) hash_init(&ndbcluster_open_tables,system_charset_info,32,0,0, - (hash_get_key) ndbcluster_get_key,0,0); + (void) my_hash_init(&ndbcluster_open_tables,system_charset_info,32,0,0, + (my_hash_get_key) ndbcluster_get_key,0,0); #ifdef HAVE_NDB_BINLOG /* start the ndb injector thread */ if (ndbcluster_binlog_start()) @@ -7492,7 +7494,7 @@ static int ndbcluster_init(void *p) if (pthread_create(&tmp, &connection_attrib, ndb_util_thread_func, 0)) { DBUG_PRINT("error", ("Could not create ndb utility thread")); - hash_free(&ndbcluster_open_tables); + my_hash_free(&ndbcluster_open_tables); pthread_mutex_destroy(&ndbcluster_mutex); pthread_mutex_destroy(&LOCK_ndb_util_thread); pthread_cond_destroy(&COND_ndb_util_thread); @@ -7509,7 +7511,7 @@ static int ndbcluster_init(void *p) if (!ndb_util_thread_running) { DBUG_PRINT("error", ("ndb utility thread exited prematurely")); - hash_free(&ndbcluster_open_tables); + my_hash_free(&ndbcluster_open_tables); pthread_mutex_destroy(&ndbcluster_mutex); pthread_mutex_destroy(&LOCK_ndb_util_thread); pthread_cond_destroy(&COND_ndb_util_thread); @@ -7560,7 +7562,7 @@ static int ndbcluster_end(handlerton *hton, ha_panic_function type) while (ndbcluster_open_tables.records) { NDB_SHARE *share= - (NDB_SHARE*) hash_element(&ndbcluster_open_tables, 0); + (NDB_SHARE*) my_hash_element(&ndbcluster_open_tables, 0); #ifndef DBUG_OFF fprintf(stderr, "NDB: table share %s with use_count %d not freed\n", share->key, share->use_count); @@ -7570,7 +7572,7 @@ static int ndbcluster_end(handlerton *hton, ha_panic_function type) pthread_mutex_unlock(&ndbcluster_mutex); } #endif - hash_free(&ndbcluster_open_tables); + my_hash_free(&ndbcluster_open_tables); if (g_ndb) { @@ -7903,9 +7905,9 @@ uint ndb_get_commitcount(THD *thd, char *dbname, char *tabname, dbname, tabname, "", 0); DBUG_PRINT("enter", ("name: %s", name)); pthread_mutex_lock(&ndbcluster_mutex); - if (!(share=(NDB_SHARE*) hash_search(&ndbcluster_open_tables, - (uchar*) name, - strlen(name)))) + if (!(share=(NDB_SHARE*) my_hash_search(&ndbcluster_open_tables, + (uchar*) name, + strlen(name)))) { pthread_mutex_unlock(&ndbcluster_mutex); DBUG_PRINT("info", ("Table %s not found in ndbcluster_open_tables", name)); @@ -8165,7 +8167,7 @@ static void print_ndbcluster_open_tables() fprintf(DBUG_FILE, ">ndbcluster_open_tables\n"); for (uint i= 0; i < ndbcluster_open_tables.records; i++) print_share("", - (NDB_SHARE*)hash_element(&ndbcluster_open_tables, i)); + (NDB_SHARE*)my_hash_element(&ndbcluster_open_tables, i)); fprintf(DBUG_FILE, "<ndbcluster_open_tables\n"); DBUG_UNLOCK_FILE; } @@ -8276,7 +8278,7 @@ int handle_trailing_share(NDB_SHARE *share) at the cost of a possible mem leak, by "renaming" the share - First remove from hash */ - hash_delete(&ndbcluster_open_tables, (uchar*) share); + my_hash_delete(&ndbcluster_open_tables, (uchar*) share); /* now give it a new name, just a running number @@ -8309,12 +8311,12 @@ static int rename_share(NDB_SHARE *share, const char *new_key) uint new_length= (uint) strlen(new_key); DBUG_PRINT("rename_share", ("old_key: %s old__length: %d", share->key, share->key_length)); - if ((tmp= (NDB_SHARE*) hash_search(&ndbcluster_open_tables, - (uchar*) new_key, new_length))) + if ((tmp= (NDB_SHARE*) my_hash_search(&ndbcluster_open_tables, + (uchar*) new_key, new_length))) handle_trailing_share(tmp); /* remove the share from hash */ - hash_delete(&ndbcluster_open_tables, (uchar*) share); + my_hash_delete(&ndbcluster_open_tables, (uchar*) share); dbug_print_open_tables(); /* save old stuff if insert should fail */ @@ -8415,9 +8417,9 @@ NDB_SHARE *ndbcluster_get_share(const char *key, TABLE *table, if (!have_lock) pthread_mutex_lock(&ndbcluster_mutex); - if (!(share= (NDB_SHARE*) hash_search(&ndbcluster_open_tables, - (uchar*) key, - length))) + if (!(share= (NDB_SHARE*) my_hash_search(&ndbcluster_open_tables, + (uchar*) key, + length))) { if (!create_if_not_exists) { @@ -8493,7 +8495,7 @@ void ndbcluster_real_free_share(NDB_SHARE **share) DBUG_ENTER("ndbcluster_real_free_share"); dbug_print_share("ndbcluster_real_free_share:", *share); - hash_delete(&ndbcluster_open_tables, (uchar*) *share); + my_hash_delete(&ndbcluster_open_tables, (uchar*) *share); thr_lock_delete(&(*share)->lock); pthread_mutex_destroy(&(*share)->mutex); @@ -9397,7 +9399,7 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused))) } for (i= 0, open_count= 0; i < record_count; i++) { - share= (NDB_SHARE *)hash_element(&ndbcluster_open_tables, i); + share= (NDB_SHARE *)my_hash_element(&ndbcluster_open_tables, i); #ifdef HAVE_NDB_BINLOG if ((share->use_count - (int) (share->op != 0) - (int) (share->op != 0)) <= 0) diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc index b9b9e7acbf2..d06dc47f91b 100644 --- a/sql/ha_ndbcluster_binlog.cc +++ b/sql/ha_ndbcluster_binlog.cc @@ -740,9 +740,9 @@ static NDB_SHARE *ndbcluster_check_ndb_apply_status_share() { pthread_mutex_lock(&ndbcluster_mutex); - void *share= hash_search(&ndbcluster_open_tables, - (uchar*) NDB_APPLY_TABLE_FILE, - sizeof(NDB_APPLY_TABLE_FILE) - 1); + void *share= my_hash_search(&ndbcluster_open_tables, + (uchar*) NDB_APPLY_TABLE_FILE, + sizeof(NDB_APPLY_TABLE_FILE) - 1); DBUG_PRINT("info",("ndbcluster_check_ndb_apply_status_share %s 0x%lx", NDB_APPLY_TABLE_FILE, (long) share)); pthread_mutex_unlock(&ndbcluster_mutex); @@ -758,9 +758,9 @@ static NDB_SHARE *ndbcluster_check_ndb_schema_share() { pthread_mutex_lock(&ndbcluster_mutex); - void *share= hash_search(&ndbcluster_open_tables, - (uchar*) NDB_SCHEMA_TABLE_FILE, - sizeof(NDB_SCHEMA_TABLE_FILE) - 1); + void *share= my_hash_search(&ndbcluster_open_tables, + (uchar*) NDB_SCHEMA_TABLE_FILE, + sizeof(NDB_SCHEMA_TABLE_FILE) - 1); DBUG_PRINT("info",("ndbcluster_check_ndb_schema_share %s 0x%lx", NDB_SCHEMA_TABLE_FILE, (long) share)); pthread_mutex_unlock(&ndbcluster_mutex); @@ -2184,8 +2184,8 @@ ndb_binlog_thread_handle_schema_event_post_epoch(THD *thd, { pthread_mutex_lock(&ndbcluster_mutex); NDB_SCHEMA_OBJECT *ndb_schema_object= - (NDB_SCHEMA_OBJECT*) hash_search(&ndb_schema_objects, - (uchar*) key, strlen(key)); + (NDB_SCHEMA_OBJECT*) my_hash_search(&ndb_schema_objects, + (uchar*) key, strlen(key)); if (ndb_schema_object) { pthread_mutex_lock(&ndb_schema_object->mutex); @@ -2571,8 +2571,8 @@ int ndbcluster_create_binlog_setup(Ndb *ndb, const char *key, pthread_mutex_lock(&ndbcluster_mutex); /* Handle any trailing share */ - NDB_SHARE *share= (NDB_SHARE*) hash_search(&ndbcluster_open_tables, - (uchar*) key, key_len); + NDB_SHARE *share= (NDB_SHARE*) my_hash_search(&ndbcluster_open_tables, + (uchar*) key, key_len); if (share && share_may_exist) { @@ -3558,9 +3558,9 @@ static NDB_SCHEMA_OBJECT *ndb_get_schema_object(const char *key, if (!have_lock) pthread_mutex_lock(&ndbcluster_mutex); while (!(ndb_schema_object= - (NDB_SCHEMA_OBJECT*) hash_search(&ndb_schema_objects, - (uchar*) key, - length))) + (NDB_SCHEMA_OBJECT*) my_hash_search(&ndb_schema_objects, + (uchar*) key, + length))) { if (!create_if_not_exists) { @@ -3609,7 +3609,7 @@ static void ndb_free_schema_object(NDB_SCHEMA_OBJECT **ndb_schema_object, if (!--(*ndb_schema_object)->use_count) { DBUG_PRINT("info", ("use_count: %d", (*ndb_schema_object)->use_count)); - hash_delete(&ndb_schema_objects, (uchar*) *ndb_schema_object); + my_hash_delete(&ndb_schema_objects, (uchar*) *ndb_schema_object); pthread_mutex_destroy(&(*ndb_schema_object)->mutex); my_free((uchar*) *ndb_schema_object, MYF(0)); *ndb_schema_object= 0; @@ -3713,8 +3713,8 @@ pthread_handler_t ndb_binlog_thread_func(void *arg) } /* init hash for schema object distribution */ - (void) hash_init(&ndb_schema_objects, system_charset_info, 32, 0, 0, - (hash_get_key)ndb_schema_objects_get_key, 0, 0); + (void) my_hash_init(&ndb_schema_objects, system_charset_info, 32, 0, 0, + (my_hash_get_key)ndb_schema_objects_get_key, 0, 0); /* Expose global reference to our ndb object. @@ -4365,7 +4365,7 @@ err: i_ndb= 0; } - hash_free(&ndb_schema_objects); + my_hash_free(&ndb_schema_objects); net_end(&thd->net); thd->cleanup(); diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index cc041d91809..d04f1b6e7e4 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -2452,6 +2452,21 @@ err1: /**************************************************************************** MODULE open/close object ****************************************************************************/ + + +/** + A destructor for partition-specific TABLE_SHARE data. +*/ + +void ha_data_partition_destroy(void *ha_data) +{ + if (ha_data) + { + HA_DATA_PARTITION *ha_data_partition= (HA_DATA_PARTITION*) ha_data; + pthread_mutex_destroy(&ha_data_partition->mutex); + } +} + /* Open handler object @@ -2608,6 +2623,8 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked) } DBUG_PRINT("info", ("table_share->ha_data 0x%p", ha_data)); bzero(ha_data, sizeof(HA_DATA_PARTITION)); + table_share->ha_data_destroy= ha_data_partition_destroy; + pthread_mutex_init(&ha_data->mutex, MY_MUTEX_INIT_FAST); } if (is_not_tmp_table) pthread_mutex_unlock(&table_share->mutex); diff --git a/sql/ha_partition.h b/sql/ha_partition.h index ea1ef4d05fc..29509515d23 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -45,6 +45,7 @@ typedef struct st_ha_data_partition { ulonglong next_auto_inc_val; /**< first non reserved value */ bool auto_inc_initialized; + pthread_mutex_t mutex; } HA_DATA_PARTITION; #define PARTITION_BYTES_IN_POS 2 diff --git a/sql/handler.cc b/sql/handler.cc index 6aa6450cbb8..495670e238e 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1533,7 +1533,7 @@ static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin, } // recovery mode if (info->commit_list ? - hash_search(info->commit_list, (uchar *)&x, sizeof(x)) != 0 : + my_hash_search(info->commit_list, (uchar *)&x, sizeof(x)) != 0 : tc_heuristic_recover == TC_HEURISTIC_RECOVER_COMMIT) { #ifndef DBUG_OFF @@ -1649,7 +1649,7 @@ bool mysql_xa_recover(THD *thd) DBUG_RETURN(1); pthread_mutex_lock(&LOCK_xid_cache); - while ((xs= (XID_STATE*)hash_element(&xid_cache, i++))) + while ((xs= (XID_STATE*) my_hash_element(&xid_cache, i++))) { if (xs->xa_state==XA_PREPARED) { @@ -2972,9 +2972,9 @@ static bool update_frm_version(TABLE *table) if ((result= my_pwrite(file,(uchar*) version,4,51L,MYF_RW))) goto err; - for (entry=(TABLE*) hash_first(&open_cache,(uchar*) key,key_length, &state); + for (entry=(TABLE*) my_hash_first(&open_cache,(uchar*) key,key_length, &state); entry; - entry= (TABLE*) hash_next(&open_cache,(uchar*) key,key_length, &state)) + entry= (TABLE*) my_hash_next(&open_cache,(uchar*) key,key_length, &state)) entry->s->mysql_version= MYSQL_VERSION_ID; } err: diff --git a/sql/handler.h b/sql/handler.h index f759239d66e..f055af218b3 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -505,9 +505,8 @@ class st_alter_tablespace : public Sql_alloc /* The handler for a table type. Will be included in the TABLE structure */ -struct st_table; -typedef struct st_table TABLE; -typedef struct st_table_share TABLE_SHARE; +struct TABLE; +struct TABLE_SHARE; struct st_foreign_key_info; typedef struct st_foreign_key_info FOREIGN_KEY_INFO; typedef bool (stat_print_fn)(THD *thd, const char *type, uint type_len, @@ -582,6 +581,7 @@ struct handler_iterator { void *buffer; }; +class handler; /* handlerton is a singleton structure - one instance per storage engine - to provide access to storage engine functionality that works on the @@ -1076,8 +1076,8 @@ class handler :public Sql_alloc public: typedef ulonglong Table_flags; protected: - struct st_table_share *table_share; /* The table definition */ - struct st_table *table; /* The current open table */ + TABLE_SHARE *table_share; /* The table definition */ + TABLE *table; /* The current open table */ Table_flags cached_table_flags; /* Set on init() and open() */ ha_rows estimation_rows_to_insert; @@ -1153,7 +1153,7 @@ public: virtual ~handler(void) { DBUG_ASSERT(locked == FALSE); - /* TODO: DBUG_ASSERT(inited == NONE); */ + DBUG_ASSERT(inited == NONE); } virtual handler *clone(MEM_ROOT *mem_root); /** This is called after create to allow us to set up cached variables */ diff --git a/sql/hash_filo.h b/sql/hash_filo.h index ab13d338695..5d17b880b4d 100644 --- a/sql/hash_filo.h +++ b/sql/hash_filo.h @@ -38,8 +38,8 @@ class hash_filo_element class hash_filo { const uint size, key_offset, key_length; - const hash_get_key get_key; - hash_free_key free_element; + const my_hash_get_key get_key; + my_hash_free_key free_element; bool init; CHARSET_INFO *hash_charset; @@ -49,7 +49,7 @@ public: HASH cache; hash_filo(uint size_arg, uint key_offset_arg , uint key_length_arg, - hash_get_key get_key_arg, hash_free_key free_element_arg, + my_hash_get_key get_key_arg, my_hash_free_key free_element_arg, CHARSET_INFO *hash_charset_arg) :size(size_arg), key_offset(key_offset_arg), key_length(key_length_arg), get_key(get_key_arg), free_element(free_element_arg),init(0), @@ -63,7 +63,7 @@ public: if (init) { if (cache.array.buffer) /* Avoid problems with thread library */ - (void) hash_free(&cache); + (void) my_hash_free(&cache); pthread_mutex_destroy(&lock); } } @@ -76,8 +76,8 @@ public: } if (!locked) (void) pthread_mutex_lock(&lock); - (void) hash_free(&cache); - (void) hash_init(&cache,hash_charset,size,key_offset, + (void) my_hash_free(&cache); + (void) my_hash_init(&cache,hash_charset,size,key_offset, key_length, get_key, free_element,0); if (!locked) (void) pthread_mutex_unlock(&lock); @@ -87,7 +87,7 @@ public: hash_filo_element *search(uchar* key, size_t length) { hash_filo_element *entry=(hash_filo_element*) - hash_search(&cache,(uchar*) key,length); + my_hash_search(&cache,(uchar*) key,length); if (entry) { // Found; link it first if (entry != first_link) @@ -113,7 +113,7 @@ public: { hash_filo_element *tmp=last_link; last_link=last_link->prev_used; - hash_delete(&cache,(uchar*) tmp); + my_hash_delete(&cache,(uchar*) tmp); } if (my_hash_insert(&cache,(uchar*) entry)) { diff --git a/sql/hostname.cc b/sql/hostname.cc index c8cf46383a9..45b10d16ce2 100644 --- a/sql/hostname.cc +++ b/sql/hostname.cc @@ -64,7 +64,7 @@ bool hostname_cache_init() uint offset= (uint) ((char*) (&tmp.ip) - (char*) &tmp); if (!(hostname_cache=new hash_filo(HOST_CACHE_SIZE, offset, sizeof(struct in_addr),NULL, - (hash_free_key) free, + (my_hash_free_key) free, &my_charset_bin))) return 1; hostname_cache->clear(); diff --git a/sql/item_create.cc b/sql/item_create.cc index 7991d9adf82..5daad660d59 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -4960,14 +4960,14 @@ int item_create_init() DBUG_ENTER("item_create_init"); - if (hash_init(& native_functions_hash, - system_charset_info, - array_elements(func_array), - 0, - 0, - (hash_get_key) get_native_fct_hash_key, - NULL, /* Nothing to free */ - MYF(0))) + if (my_hash_init(& native_functions_hash, + system_charset_info, + array_elements(func_array), + 0, + 0, + (my_hash_get_key) get_native_fct_hash_key, + NULL, /* Nothing to free */ + MYF(0))) DBUG_RETURN(1); for (func= func_array; func->builder != NULL; func++) @@ -4979,7 +4979,7 @@ int item_create_init() #ifndef DBUG_OFF for (uint i=0 ; i < native_functions_hash.records ; i++) { - func= (Native_func_registry*) hash_element(& native_functions_hash, i); + func= (Native_func_registry*) my_hash_element(& native_functions_hash, i); DBUG_PRINT("info", ("native function: %s length: %u", func->name.str, (uint) func->name.length)); } @@ -4997,7 +4997,7 @@ int item_create_init() void item_create_cleanup() { DBUG_ENTER("item_create_cleanup"); - hash_free(& native_functions_hash); + my_hash_free(& native_functions_hash); DBUG_VOID_RETURN; } @@ -5008,9 +5008,9 @@ find_native_function_builder(THD *thd, LEX_STRING name) Create_func *builder= NULL; /* Thread safe */ - func= (Native_func_registry*) hash_search(& native_functions_hash, - (uchar*) name.str, - name.length); + func= (Native_func_registry*) my_hash_search(& native_functions_hash, + (uchar*) name.str, + name.length); if (func) { diff --git a/sql/item_func.cc b/sql/item_func.cc index cf499aaf93c..f40f2a52495 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -3284,7 +3284,7 @@ public: { if (key) { - hash_delete(&hash_user_locks,(uchar*) this); + my_hash_delete(&hash_user_locks,(uchar*) this); my_free(key, MYF(0)); } pthread_cond_destroy(&cond); @@ -3308,8 +3308,8 @@ static bool item_user_lock_inited= 0; void item_user_lock_init(void) { pthread_mutex_init(&LOCK_user_locks,MY_MUTEX_INIT_SLOW); - hash_init(&hash_user_locks,system_charset_info, - 16,0,0,(hash_get_key) ull_get_key,NULL,0); + my_hash_init(&hash_user_locks,system_charset_info, + 16,0,0,(my_hash_get_key) ull_get_key,NULL,0); item_user_lock_inited= 1; } @@ -3318,7 +3318,7 @@ void item_user_lock_free(void) if (item_user_lock_inited) { item_user_lock_inited= 0; - hash_free(&hash_user_locks); + my_hash_free(&hash_user_locks); pthread_mutex_destroy(&LOCK_user_locks); } } @@ -3385,9 +3385,9 @@ void debug_sync_point(const char* lock_name, uint lock_timeout) this case, we will not be waiting, but rather, just waste CPU and memory on the whole deal */ - if (!(ull= ((User_level_lock*) hash_search(&hash_user_locks, - (uchar*) lock_name, - lock_name_len)))) + if (!(ull= ((User_level_lock*) my_hash_search(&hash_user_locks, + (uchar*) lock_name, + lock_name_len)))) { pthread_mutex_unlock(&LOCK_user_locks); return; @@ -3488,9 +3488,9 @@ longlong Item_func_get_lock::val_int() thd->ull=0; } - if (!(ull= ((User_level_lock *) hash_search(&hash_user_locks, - (uchar*) res->ptr(), - (size_t) res->length())))) + if (!(ull= ((User_level_lock *) my_hash_search(&hash_user_locks, + (uchar*) res->ptr(), + (size_t) res->length())))) { ull= new User_level_lock((uchar*) res->ptr(), (size_t) res->length(), thd->thread_id); @@ -3592,9 +3592,9 @@ longlong Item_func_release_lock::val_int() result=0; pthread_mutex_lock(&LOCK_user_locks); - if (!(ull= ((User_level_lock*) hash_search(&hash_user_locks, - (const uchar*) res->ptr(), - (size_t) res->length())))) + if (!(ull= ((User_level_lock*) my_hash_search(&hash_user_locks, + (const uchar*) res->ptr(), + (size_t) res->length())))) { null_value=1; } @@ -3774,12 +3774,12 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name, { user_var_entry *entry; - if (!(entry = (user_var_entry*) hash_search(hash, (uchar*) name.str, - name.length)) && + if (!(entry = (user_var_entry*) my_hash_search(hash, (uchar*) name.str, + name.length)) && create_if_not_exists) { uint size=ALIGN_SIZE(sizeof(user_var_entry))+name.length+1+extra_size; - if (!hash_inited(hash)) + if (!my_hash_inited(hash)) return 0; if (!(entry = (user_var_entry*) my_malloc(size,MYF(MY_WME)))) return 0; @@ -5709,8 +5709,8 @@ longlong Item_func_is_free_lock::val_int() } pthread_mutex_lock(&LOCK_user_locks); - ull= (User_level_lock *) hash_search(&hash_user_locks, (uchar*) res->ptr(), - (size_t) res->length()); + ull= (User_level_lock *) my_hash_search(&hash_user_locks, (uchar*) res->ptr(), + (size_t) res->length()); pthread_mutex_unlock(&LOCK_user_locks); if (!ull || !ull->locked) return 1; @@ -5728,8 +5728,8 @@ longlong Item_func_is_used_lock::val_int() return 0; pthread_mutex_lock(&LOCK_user_locks); - ull= (User_level_lock *) hash_search(&hash_user_locks, (uchar*) res->ptr(), - (size_t) res->length()); + ull= (User_level_lock *) my_hash_search(&hash_user_locks, (uchar*) res->ptr(), + (size_t) res->length()); pthread_mutex_unlock(&LOCK_user_locks); if (!ull || !ull->locked) return 0; diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index da651cec70c..d16710f6660 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -1863,7 +1863,8 @@ void subselect_uniquesubquery_engine::fix_length_and_dec(Item_cache **row) DBUG_ASSERT(0); } -int init_read_record_seq(JOIN_TAB *tab); +int read_first_record_seq(JOIN_TAB *tab); +int rr_sequential(READ_RECORD *info); int join_read_always_key_or_null(JOIN_TAB *tab); int join_read_next_same_or_null(READ_RECORD *info); @@ -1945,7 +1946,8 @@ int subselect_single_select_engine::exec() /* Change the access method to full table scan */ tab->save_read_first_record= tab->read_first_record; tab->save_read_record= tab->read_record.read_record; - tab->read_first_record= init_read_record_seq; + tab->read_record.read_record= rr_sequential; + tab->read_first_record= read_first_record_seq; tab->read_record.record= tab->table->record[0]; tab->read_record.thd= join->thd; tab->read_record.ref_length= tab->table->file->ref_length; diff --git a/sql/item_sum.cc b/sql/item_sum.cc index c8576722c69..5dafee7ff27 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -847,7 +847,7 @@ bool Aggregator_distinct::setup(THD *thd) DBUG_ENTER("Item_sum_distinct::setup"); /* It's legal to call setup() more than once when in a subquery */ if (tree) - return FALSE; + DBUG_RETURN(FALSE); /* Virtual table and the tree are created anew on each re-execution of @@ -855,7 +855,7 @@ bool Aggregator_distinct::setup(THD *thd) mem_root. */ if (field_list.push_back(&field_def)) - return TRUE; + DBUG_RETURN(TRUE); item_sum->null_value= item_sum->maybe_null= 1; item_sum->quick_group= 0; @@ -871,7 +871,7 @@ bool Aggregator_distinct::setup(THD *thd) } if (always_null) - return FALSE; + DBUG_RETURN(FALSE); enum enum_field_types field_type; @@ -884,7 +884,7 @@ bool Aggregator_distinct::setup(THD *thd) arg->unsigned_flag); if (! (table= create_virtual_tmp_table(thd, field_list))) - return TRUE; + DBUG_RETURN(TRUE); /* XXX: check that the case of CHAR(0) works OK */ tree_key_length= table->s->reclength - table->s->null_bytes; diff --git a/sql/lock.cc b/sql/lock.cc index 93d8b868688..c0cda1dbf03 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -1029,11 +1029,11 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list, bool check_in_use) if (check_in_use) { /* Only insert the table if we haven't insert it already */ - for (table=(TABLE*) hash_first(&open_cache, (uchar*)key, - key_length, &state); + for (table=(TABLE*) my_hash_first(&open_cache, (uchar*)key, + key_length, &state); table ; - table = (TABLE*) hash_next(&open_cache,(uchar*) key, - key_length, &state)) + table = (TABLE*) my_hash_next(&open_cache,(uchar*) key, + key_length, &state)) { if (table->in_use == thd) { @@ -1060,7 +1060,7 @@ void unlock_table_name(THD *thd, TABLE_LIST *table_list) { if (table_list->table) { - hash_delete(&open_cache, (uchar*) table_list->table); + my_hash_delete(&open_cache, (uchar*) table_list->table); broadcast_refresh(); } } @@ -1235,11 +1235,11 @@ is_table_name_exclusively_locked_by_this_thread(THD *thd, uchar *key, HASH_SEARCH_STATE state; TABLE *table; - for (table= (TABLE*) hash_first(&open_cache, key, - key_length, &state); + for (table= (TABLE*) my_hash_first(&open_cache, key, + key_length, &state); table ; - table= (TABLE*) hash_next(&open_cache, key, - key_length, &state)) + table= (TABLE*) my_hash_next(&open_cache, key, + key_length, &state)) { if (table->in_use == thd && table->open_placeholder == 1 && diff --git a/sql/log.cc b/sql/log.cc index ed208a84ffc..23d647f58e5 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -110,9 +110,16 @@ sql_print_message_func sql_print_message_handlers[3] = }; +/** + Create the name of the default general log file + + @param[IN] buff Location for building new string. + @param[IN] log_ext The extension for the file (e.g .log) + @returns Pointer to a new string containing the name +*/ char *make_default_log_name(char *buff,const char* log_ext) { - strmake(buff, pidfile_name, FN_REFLEN-5); + strmake(buff, default_logfile_name, FN_REFLEN-5); return fn_format(buff, buff, mysql_data_home, log_ext, MYF(MY_UNPACK_FILENAME|MY_REPLACE_EXT)); } @@ -5426,8 +5433,8 @@ int TC_LOG_MMAP::recover() goto err1; } - if (hash_init(&xids, &my_charset_bin, tc_log_page_size/3, 0, - sizeof(my_xid), 0, 0, MYF(0))) + if (my_hash_init(&xids, &my_charset_bin, tc_log_page_size/3, 0, + sizeof(my_xid), 0, 0, MYF(0))) goto err1; for ( ; p < end_p ; p++) @@ -5440,12 +5447,12 @@ int TC_LOG_MMAP::recover() if (ha_recover(&xids)) goto err2; - hash_free(&xids); + my_hash_free(&xids); bzero(data, (size_t)file_length); return 0; err2: - hash_free(&xids); + my_hash_free(&xids); err1: sql_print_error("Crash recovery failed. Either correct the problem " "(if it's, for example, out of memory error) and restart, " @@ -5629,8 +5636,8 @@ int TC_LOG_BINLOG::recover(IO_CACHE *log, Format_description_log_event *fdle) MEM_ROOT mem_root; if (! fdle->is_valid() || - hash_init(&xids, &my_charset_bin, TC_LOG_PAGE_SIZE/3, 0, - sizeof(my_xid), 0, 0, MYF(0))) + my_hash_init(&xids, &my_charset_bin, TC_LOG_PAGE_SIZE/3, 0, + sizeof(my_xid), 0, 0, MYF(0))) goto err1; init_alloc_root(&mem_root, TC_LOG_PAGE_SIZE, TC_LOG_PAGE_SIZE); @@ -5655,12 +5662,12 @@ int TC_LOG_BINLOG::recover(IO_CACHE *log, Format_description_log_event *fdle) goto err2; free_root(&mem_root, MYF(0)); - hash_free(&xids); + my_hash_free(&xids); return 0; err2: free_root(&mem_root, MYF(0)); - hash_free(&xids); + my_hash_free(&xids); err1: sql_print_error("Crash recovery failed. Either correct the problem " "(if it's, for example, out of memory error) and restart, " diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 9c781b80ec3..d8c5091b7fd 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -641,7 +641,6 @@ enum enum_parsing_place IN_ON }; -struct st_table; #define thd_proc_info(thd, msg) set_thd_proc_info(thd, msg, __func__, __FILE__, __LINE__) class THD; @@ -879,6 +878,7 @@ bool general_log_write(THD *thd, enum enum_server_command command, #include "tztime.h" #ifdef MYSQL_SERVER #include "sql_servers.h" +#include "records.h" #include "opt_range.h" #ifdef HAVE_QUERY_CACHE @@ -905,6 +905,8 @@ struct Query_cache_query_flags }; #define QUERY_CACHE_FLAGS_SIZE sizeof(Query_cache_query_flags) #include "sql_cache.h" +#define query_cache_abort(A) query_cache.abort(A) +#define query_cache_end_of_result(A) query_cache.end_of_result(A) #define query_cache_store_query(A, B) query_cache.store_query(A, B) #define query_cache_destroy() query_cache.destroy() #define query_cache_result_size_limit(A) query_cache.result_size_limit(A) @@ -1938,6 +1940,7 @@ extern MYSQL_PLUGIN_IMPORT uint reg_ext_length; #ifdef MYSQL_SERVER extern char glob_hostname[FN_REFLEN], mysql_home[FN_REFLEN]; extern char pidfile_name[FN_REFLEN], system_time_zone[30], *opt_init_file; +extern char default_logfile_name[FN_REFLEN]; extern char log_error_file[FN_REFLEN], *opt_tc_log_file; extern ulonglong log_10_int[20]; extern ulonglong keybuff_size; @@ -2086,7 +2089,7 @@ extern uint sql_command_flags[]; extern TYPELIB log_output_typelib; /* optional things, have_* variables */ -extern SHOW_COMP_OPTION have_community_features; +extern SHOW_COMP_OPTION have_profiling; extern handlerton *partition_hton; extern handlerton *myisam_hton; @@ -2237,12 +2240,6 @@ longlong get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg, int test_if_number(char *str,int *res,bool allow_wildcards); void change_byte(uchar *,uint,char,char); -void init_read_record(READ_RECORD *info, THD *thd, TABLE *reg_form, - SQL_SELECT *select, int use_record_cache, - bool print_errors, bool disable_rr_cache); -void init_read_record_idx(READ_RECORD *info, THD *thd, TABLE *table, - bool print_error, uint idx); -void end_read_record(READ_RECORD *info); ha_rows filesort(THD *thd, TABLE *form,struct st_sort_field *sortorder, uint s_length, SQL_SELECT *select, ha_rows max_rows, bool sort_positions, diff --git a/sql/mysqld.cc b/sql/mysqld.cc index e2d4de4dc56..e21453ce15c 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -572,6 +572,7 @@ const char *log_output_str= "FILE"; time_t server_start_time, flush_status_time; char mysql_home[FN_REFLEN], pidfile_name[FN_REFLEN], system_time_zone[30]; +char default_logfile_name[FN_REFLEN]; char *default_tz_name; char log_error_file[FN_REFLEN], glob_hostname[FN_REFLEN]; char mysql_real_data_home[FN_REFLEN], @@ -635,7 +636,7 @@ MY_LOCALE *my_default_lc_time_names; SHOW_COMP_OPTION have_ssl, have_symlink, have_dlopen, have_query_cache; SHOW_COMP_OPTION have_geometry, have_rtree_keys; SHOW_COMP_OPTION have_crypt, have_compress; -SHOW_COMP_OPTION have_community_features; +SHOW_COMP_OPTION have_profiling; /* Thread specific variables */ @@ -3168,10 +3169,13 @@ static int init_common_variables(const char *conf_file_name, int argc, strmake(glob_hostname, STRING_WITH_LEN("localhost")); sql_print_warning("gethostname failed, using '%s' as hostname", glob_hostname); - strmake(pidfile_name, STRING_WITH_LEN("mysql")); + strmake(default_logfile_name, STRING_WITH_LEN("mysql")); } else - strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5); + strmake(default_logfile_name, glob_hostname, + sizeof(default_logfile_name)-5); + + strmake(pidfile_name, default_logfile_name, sizeof(pidfile_name)-5); strmov(fn_ext(pidfile_name),".pid"); // Add proper extension /* @@ -3450,7 +3454,7 @@ static int init_common_variables(const char *conf_file_name, int argc, if (opt_slow_log && opt_slow_logname && !(log_output_options & LOG_FILE) && !(log_output_options & LOG_NONE)) sql_print_warning("Although a path was specified for the " - "--log_slow_queries option, log tables are used. " + "--log-slow-queries option, log tables are used. " "To enable logging to files use the --log-output=file option."); s= opt_logname ? opt_logname : make_default_log_name(buff, ".log"); @@ -4892,9 +4896,6 @@ static void create_new_thread(THD *thd) NET *net=&thd->net; DBUG_ENTER("create_new_thread"); - if (protocol_version > 9) - net->return_errno=1; - /* Don't allow too many connections. We roughly check here that we allow only (max_connections + 1) connections. @@ -5804,10 +5805,6 @@ struct my_option my_long_options[] = "Set the default storage engine (table type) for tables.", (uchar**)&default_storage_engine_str, (uchar**)&default_storage_engine_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"default-table-type", OPT_STORAGE_ENGINE, - "(deprecated) Use --default-storage-engine.", - (uchar**)&default_storage_engine_str, (uchar**)&default_storage_engine_str, - 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"default-time-zone", OPT_DEFAULT_TIME_ZONE, "Set the default time zone.", (uchar**) &default_tz_name, (uchar**) &default_tz_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, @@ -5988,14 +5985,14 @@ Disable with --skip-super-large-pages.", (uchar**) &opt_log_slow_slave_statements, (uchar**) &opt_log_slow_slave_statements, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"log_slow_queries", OPT_SLOW_QUERY_LOG, - "Log slow queries to a table or log file. Defaults logging to table " - "mysql.slow_log or hostname-slow.log if --log-output=file is used. " - "Must be enabled to activate other slow log options. " - "(deprecated option, use --slow_query_log/--slow_query_log_file instead)", + {"log-slow-queries", OPT_SLOW_QUERY_LOG, + "Log slow queries to a table or log file. Defaults logging to table " + "mysql.slow_log or hostname-slow.log if --log-output=file is used. " + "Must be enabled to activate other slow log options. " + "Deprecated option, use --slow-query-log/--slow-query-log-file instead.", (uchar**) &opt_slow_logname, (uchar**) &opt_slow_logname, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"slow_query_log_file", OPT_SLOW_QUERY_LOG_FILE, + {"slow-query-log-file", OPT_SLOW_QUERY_LOG_FILE, "Log slow queries to given log file. Defaults logging to hostname-slow.log. Must be enabled to activate other slow log options.", (uchar**) &opt_slow_logname, (uchar**) &opt_slow_logname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -6233,7 +6230,7 @@ master-ssl", "Maximum time in seconds to wait for the port to become free. " "(Default: no wait)", (uchar**) &mysqld_port_timeout, (uchar**) &mysqld_port_timeout, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, -#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER) +#if defined(ENABLED_PROFILING) {"profiling_history_size", OPT_PROFILING, "Limit of query profiling memory", (uchar**) &global_system_variables.profiling_history_size, (uchar**) &max_system_variables.profiling_history_size, @@ -6708,7 +6705,7 @@ The minimum value for this variable is 4096.", (uchar**) &max_write_lock_count, (uchar**) &max_write_lock_count, 0, GET_ULONG, REQUIRED_ARG, ULONG_MAX, 1, ULONG_MAX, 0, 1, 0}, {"min_examined_row_limit", OPT_MIN_EXAMINED_ROW_LIMIT, - "Don't log queries which examine less than min_examined_row_limit rows to file.", + "Don't write queries to slow log that examine fewer than min_examined_row_limit rows.", (uchar**) &global_system_variables.min_examined_row_limit, (uchar**) &max_system_variables.min_examined_row_limit, 0, GET_ULONG, REQUIRED_ARG, 0, 0, ULONG_MAX, 0, 1L, 0}, @@ -7031,7 +7028,7 @@ static int show_starttime(THD *thd, SHOW_VAR *var, char *buff) return 0; } -#ifdef COMMUNITY_SERVER +#ifdef ENABLED_PROFILING static int show_flushstatustime(THD *thd, SHOW_VAR *var, char *buff) { var->type= SHOW_LONG; @@ -7489,7 +7486,7 @@ SHOW_VAR status_vars[]= { {"Threads_created", (char*) &thread_created, SHOW_LONG_NOFLUSH}, {"Threads_running", (char*) &thread_running, SHOW_INT}, {"Uptime", (char*) &show_starttime, SHOW_FUNC}, -#ifdef COMMUNITY_SERVER +#ifdef ENABLED_PROFILING {"Uptime_since_flush_status",(char*) &show_flushstatustime, SHOW_FUNC}, #endif {NullS, NullS, SHOW_LONG} @@ -7722,10 +7719,10 @@ static int mysql_init_variables(void) "d:t:i:o,/tmp/mysqld.trace"); #endif opt_error_log= IF_WIN(1,0); -#ifdef COMMUNITY_SERVER - have_community_features = SHOW_OPTION_YES; +#ifdef ENABLED_PROFILING + have_profiling = SHOW_OPTION_YES; #else - have_community_features = SHOW_OPTION_NO; + have_profiling = SHOW_OPTION_NO; #endif global_system_variables.ndb_index_stat_enable=FALSE; max_system_variables.ndb_index_stat_enable=TRUE; @@ -7843,7 +7840,7 @@ mysqld_get_one_option(int optid, default_collation_name= 0; break; case 'l': - WARN_DEPRECATED(NULL, "7.0", "--log", "'--general_log'/'--general_log_file'"); + WARN_DEPRECATED(NULL, "7.0", "--log", "'--general-log'/'--general-log-file'"); opt_log=1; break; case 'h': @@ -8017,7 +8014,8 @@ mysqld_get_one_option(int optid, } #endif /* HAVE_REPLICATION */ case (int) OPT_SLOW_QUERY_LOG: - WARN_DEPRECATED(NULL, "7.0", "--log_slow_queries", "'--slow_query_log'/'--slow_query_log_file'"); + WARN_DEPRECATED(NULL, "7.0", "--log-slow-queries", + "'--slow-query-log'/'--slow-query-log-file'"); opt_slow_log= 1; break; #ifdef WITH_CSV_STORAGE_ENGINE @@ -8829,9 +8827,7 @@ void refresh_status(THD *thd) /* Reset the counters of all key caches (default and named). */ process_key_caches(reset_key_cache_counters); -#ifdef COMMUNITY_SERVER flush_status_time= time((time_t*) 0); -#endif pthread_mutex_unlock(&LOCK_status); /* diff --git a/sql/net_serv.cc b/sql/net_serv.cc index 7ff26c50afc..4945ee8d94f 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -95,8 +95,8 @@ extern pthread_mutex_t LOCK_bytes_sent , LOCK_bytes_received; #ifndef MYSQL_INSTANCE_MANAGER #ifdef HAVE_QUERY_CACHE #define USE_QUERY_CACHE -extern void query_cache_init_query(NET *net); -extern void query_cache_insert(NET *net, const char *packet, ulong length); +extern void query_cache_insert(const char *packet, ulong length, + unsigned pkt_nr); #endif // HAVE_QUERY_CACHE #define update_statistics(A) A #endif /* MYSQL_INSTANCE_MANGER */ @@ -125,18 +125,14 @@ my_bool my_net_init(NET *net, Vio* vio) MYF(MY_WME)))) DBUG_RETURN(1); net->buff_end=net->buff+net->max_packet; - net->error=0; net->return_errno=0; net->return_status=0; + net->error=0; net->return_status=0; net->pkt_nr=net->compress_pkt_nr=0; net->write_pos=net->read_pos = net->buff; net->last_error[0]=0; net->compress=0; net->reading_or_writing=0; net->where_b = net->remain_in_buf=0; net->last_errno=0; -#ifdef USE_QUERY_CACHE - query_cache_init_query(net); -#else - net->query_cache_query= 0; -#endif + net->unused= 0; if (vio != 0) /* If real connection */ { @@ -586,7 +582,7 @@ net_real_write(NET *net,const uchar *packet, size_t len) DBUG_ENTER("net_real_write"); #if defined(MYSQL_SERVER) && defined(USE_QUERY_CACHE) - query_cache_insert(net, (char*) packet, len); + query_cache_insert((char*) packet, len, net->pkt_nr); #endif if (net->error == 2) diff --git a/sql/protocol.cc b/sql/protocol.cc index 7abc051af68..86f95755bd9 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -394,27 +394,19 @@ bool net_send_error_packet(THD *thd, uint sql_errno, const char *err, DBUG_RETURN(FALSE); } - if (net->return_errno) - { // new client code; Add errno before message - int2store(buff,sql_errno); - pos= buff+2; - if (thd->client_capabilities & CLIENT_PROTOCOL_41) - { - /* The first # is to make the protocol backward compatible */ - buff[2]= '#'; - pos= (uchar*) strmov((char*) buff+3, sqlstate); - } - length= (uint) (strmake((char*) pos, err, MYSQL_ERRMSG_SIZE-1) - - (char*) buff); - err= (char*) buff; - } - else + int2store(buff,sql_errno); + pos= buff+2; + if (thd->client_capabilities & CLIENT_PROTOCOL_41) { - length=(uint) strlen(err); - set_if_smaller(length,MYSQL_ERRMSG_SIZE-1); + /* The first # is to make the protocol backward compatible */ + buff[2]= '#'; + pos= (uchar*) strmov((char*) buff+3, sqlstate); } + length= (uint) (strmake((char*) pos, err, MYSQL_ERRMSG_SIZE-1) - + (char*) buff); + err= (char*) buff; DBUG_RETURN(net_write_command(net,(uchar) 255, (uchar*) "", 0, (uchar*) err, - length)); + length)); } #endif /* EMBEDDED_LIBRARY */ diff --git a/sql/records.cc b/sql/records.cc index 9e040de3fda..9b5ea40478e 100644 --- a/sql/records.cc +++ b/sql/records.cc @@ -13,6 +13,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifdef USE_PRAGMA_INTERFACE +#pragma implementation /* gcc class implementation */ +#endif /** @file @@ -21,8 +24,10 @@ Functions for easy reading of records, possible through a cache */ +#include "records.h" #include "mysql_priv.h" + static int rr_quick(READ_RECORD *info); int rr_sequential(READ_RECORD *info); static int rr_from_tempfile(READ_RECORD *info); diff --git a/sql/records.h b/sql/records.h new file mode 100644 index 00000000000..9207a05f826 --- /dev/null +++ b/sql/records.h @@ -0,0 +1,75 @@ +#ifndef SQL_RECORDS_H +#define SQL_RECORDS_H +/* Copyright (C) 2008 Sun/MySQL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifdef USE_PRAGMA_INTERFACE +#pragma interface /* gcc class implementation */ +#endif +#include <my_global.h> /* for uint typedefs */ + +struct st_join_table; +class handler; +struct TABLE; +class THD; +class SQL_SELECT; + +/** + A context for reading through a single table using a chosen access method: + index read, scan, etc, use of cache, etc. + + Use by: + READ_RECORD read_record; + init_read_record(&read_record, ...); + while (read_record.read_record()) + { + ... + } + end_read_record(); +*/ + +struct READ_RECORD +{ + typedef int (*Read_func)(READ_RECORD*); + typedef int (*Setup_func)(struct st_join_table*); + + TABLE *table; /* Head-form */ + handler *file; + TABLE **forms; /* head and ref forms */ + Read_func read_record; + THD *thd; + SQL_SELECT *select; + uint cache_records; + uint ref_length,struct_length,reclength,rec_cache_size,error_offset; + uint index; + uchar *ref_pos; /* pointer to form->refpos */ + uchar *record; + uchar *rec_buf; /* to read field values after filesort */ + uchar *cache,*cache_pos,*cache_end,*read_positions; + struct st_io_cache *io_cache; + bool print_error, ignore_not_found_rows; + +public: + READ_RECORD() {} +}; + +void init_read_record(READ_RECORD *info, THD *thd, TABLE *reg_form, + SQL_SELECT *select, int use_record_cache, + bool print_errors, bool disable_rr_cache); +void init_read_record_idx(READ_RECORD *info, THD *thd, TABLE *table, + bool print_error, uint idx); +void end_read_record(READ_RECORD *info); + +#endif /* SQL_RECORDS_H */ diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc index e470317abef..aa8618399f8 100644 --- a/sql/repl_failsafe.cc +++ b/sql/repl_failsafe.cc @@ -146,10 +146,10 @@ void unregister_slave(THD* thd, bool only_mine, bool need_mutex) pthread_mutex_lock(&LOCK_slave_list); SLAVE_INFO* old_si; - if ((old_si = (SLAVE_INFO*)hash_search(&slave_list, - (uchar*)&thd->server_id, 4)) && + if ((old_si = (SLAVE_INFO*)my_hash_search(&slave_list, + (uchar*)&thd->server_id, 4)) && (!only_mine || old_si->thd == thd)) - hash_delete(&slave_list, (uchar*)old_si); + my_hash_delete(&slave_list, (uchar*)old_si); if (need_mutex) pthread_mutex_unlock(&LOCK_slave_list); @@ -221,17 +221,18 @@ extern "C" void slave_info_free(void *s) void init_slave_list() { - hash_init(&slave_list, system_charset_info, SLAVE_LIST_CHUNK, 0, 0, - (hash_get_key) slave_list_key, (hash_free_key) slave_info_free, 0); + my_hash_init(&slave_list, system_charset_info, SLAVE_LIST_CHUNK, 0, 0, + (my_hash_get_key) slave_list_key, + (my_hash_free_key) slave_info_free, 0); pthread_mutex_init(&LOCK_slave_list, MY_MUTEX_INIT_FAST); } void end_slave_list() { /* No protection by a mutex needed as we are only called at shutdown */ - if (hash_inited(&slave_list)) + if (my_hash_inited(&slave_list)) { - hash_free(&slave_list); + my_hash_free(&slave_list); pthread_mutex_destroy(&LOCK_slave_list); } } @@ -547,8 +548,8 @@ HOSTS"; uint32 log_server_id; SLAVE_INFO* si, *old_si; log_server_id = atoi(row[0]); - if ((old_si= (SLAVE_INFO*)hash_search(&slave_list, - (uchar*)&log_server_id,4))) + if ((old_si= (SLAVE_INFO*)my_hash_search(&slave_list, + (uchar*)&log_server_id,4))) si = old_si; else { @@ -682,7 +683,7 @@ bool show_slave_hosts(THD* thd) for (uint i = 0; i < slave_list.records; ++i) { - SLAVE_INFO* si = (SLAVE_INFO*) hash_element(&slave_list, i); + SLAVE_INFO* si = (SLAVE_INFO*) my_hash_element(&slave_list, i); protocol->prepare_for_resend(); protocol->store((uint32) si->server_id); protocol->store(si->host, &my_charset_bin); diff --git a/sql/rpl_filter.cc b/sql/rpl_filter.cc index 68272c58bb1..392d8baf50e 100644 --- a/sql/rpl_filter.cc +++ b/sql/rpl_filter.cc @@ -32,9 +32,9 @@ Rpl_filter::Rpl_filter() : Rpl_filter::~Rpl_filter() { if (do_table_inited) - hash_free(&do_table); + my_hash_free(&do_table); if (ignore_table_inited) - hash_free(&ignore_table); + my_hash_free(&ignore_table); if (wild_do_table_inited) free_string_array(&wild_do_table); if (wild_ignore_table_inited) @@ -103,12 +103,12 @@ Rpl_filter::tables_ok(const char* db, TABLE_LIST* tables) len= (uint) (strmov(end, tables->table_name) - hash_key); if (do_table_inited) // if there are any do's { - if (hash_search(&do_table, (uchar*) hash_key, len)) + if (my_hash_search(&do_table, (uchar*) hash_key, len)) DBUG_RETURN(1); } if (ignore_table_inited) // if there are any ignores { - if (hash_search(&ignore_table, (uchar*) hash_key, len)) + if (my_hash_search(&ignore_table, (uchar*) hash_key, len)) DBUG_RETURN(0); } if (wild_do_table_inited && @@ -387,7 +387,7 @@ void free_table_ent(void* a) void Rpl_filter::init_table_rule_hash(HASH* h, bool* h_inited) { - hash_init(h, system_charset_info,TABLE_RULE_HASH_SIZE,0,0, + my_hash_init(h, system_charset_info,TABLE_RULE_HASH_SIZE,0,0, get_table_key, free_table_ent, 0); *h_inited = 1; } @@ -458,7 +458,7 @@ Rpl_filter::table_rule_ent_hash_to_str(String* s, HASH* h, bool inited) { for (uint i= 0; i < h->records; i++) { - TABLE_RULE_ENT* e= (TABLE_RULE_ENT*) hash_element(h, i); + TABLE_RULE_ENT* e= (TABLE_RULE_ENT*) my_hash_element(h, i); if (s->length()) s->append(','); s->append(e->db,e->key_len); diff --git a/sql/rpl_injector.h b/sql/rpl_injector.h index 4ece092c5b8..a0c71fee099 100644 --- a/sql/rpl_injector.h +++ b/sql/rpl_injector.h @@ -25,9 +25,8 @@ /* Forward declarations */ class handler; class MYSQL_BIN_LOG; -struct st_table; +struct TABLE; -typedef st_table TABLE; /* Injector to inject rows into the MySQL server. diff --git a/sql/rpl_tblmap.cc b/sql/rpl_tblmap.cc index a004c354263..8b7fea3b40e 100644 --- a/sql/rpl_tblmap.cc +++ b/sql/rpl_tblmap.cc @@ -34,10 +34,10 @@ table_mapping::table_mapping() No "free_element" function for entries passed here, as the entries are allocated in a MEM_ROOT (freed as a whole in the destructor), they cannot be freed one by one. - Note that below we don't test if hash_init() succeeded. This constructor - is called at startup only. + Note that below we don't test if my_hash_init() succeeded. This + constructor is called at startup only. */ - (void) hash_init(&m_table_ids,&my_charset_bin,TABLE_ID_HASH_SIZE, + (void) my_hash_init(&m_table_ids,&my_charset_bin,TABLE_ID_HASH_SIZE, offsetof(entry,table_id),sizeof(ulong), 0,0,0); /* We don't preallocate any block, this is consistent with m_free=0 above */ @@ -49,7 +49,7 @@ table_mapping::~table_mapping() #ifdef MYSQL_CLIENT clear_tables(); #endif - hash_free(&m_table_ids); + my_hash_free(&m_table_ids); free_root(&m_mem_root, MYF(0)); } @@ -115,7 +115,7 @@ int table_mapping::set_table(ulong table_id, TABLE* table) #ifdef MYSQL_CLIENT free_table_map_log_event(e->table); #endif - hash_delete(&m_table_ids,(uchar *)e); + my_hash_delete(&m_table_ids,(uchar *)e); } e->table_id= table_id; e->table= table; @@ -132,7 +132,7 @@ int table_mapping::remove_table(ulong table_id) entry *e= find_entry(table_id); if (e) { - hash_delete(&m_table_ids,(uchar *)e); + my_hash_delete(&m_table_ids,(uchar *)e); /* we add this entry to the chain of free (free for use) entries */ e->next= m_free; m_free= e; @@ -150,7 +150,7 @@ void table_mapping::clear_tables() DBUG_ENTER("table_mapping::clear_tables()"); for (uint i= 0; i < m_table_ids.records; i++) { - entry *e= (entry *)hash_element(&m_table_ids, i); + entry *e= (entry *)my_hash_element(&m_table_ids, i); #ifdef MYSQL_CLIENT free_table_map_log_event(e->table); #endif diff --git a/sql/rpl_tblmap.h b/sql/rpl_tblmap.h index 3b5b10be580..a6ec8bcbc9b 100644 --- a/sql/rpl_tblmap.h +++ b/sql/rpl_tblmap.h @@ -18,8 +18,7 @@ /* Forward declarations */ #ifndef MYSQL_CLIENT -struct st_table; -typedef st_table TABLE; +struct TABLE; #else class Table_map_log_event; typedef Table_map_log_event TABLE; @@ -91,9 +90,9 @@ private: entry *find_entry(ulong table_id) { - return (entry *)hash_search(&m_table_ids, - (uchar*)&table_id, - sizeof(table_id)); + return (entry *) my_hash_search(&m_table_ids, + (uchar*)&table_id, + sizeof(table_id)); } int expand(); diff --git a/sql/set_var.cc b/sql/set_var.cc index 2e2bb369af1..1a0f63f3d4f 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -762,7 +762,7 @@ static sys_var_thd_bit sys_unique_checks(&vars, "unique_checks", 0, OPTION_RELAXED_UNIQUE_CHECKS, 1, sys_var::SESSION_VARIABLE_IN_BINLOG); -#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER) +#if defined(ENABLED_PROFILING) static sys_var_thd_bit sys_profiling(&vars, "profiling", NULL, set_option_bit, ulonglong(OPTION_PROFILING)); @@ -864,9 +864,9 @@ static sys_var_have_plugin sys_have_ndbcluster(&vars, "have_ndbcluster", C_STRIN static sys_var_have_variable sys_have_openssl(&vars, "have_openssl", &have_ssl); static sys_var_have_variable sys_have_ssl(&vars, "have_ssl", &have_ssl); static sys_var_have_plugin sys_have_partition_db(&vars, "have_partitioning", C_STRING_WITH_LEN("partition"), MYSQL_STORAGE_ENGINE_PLUGIN); +static sys_var_have_variable sys_have_profiling(&vars, "have_profiling", &have_profiling); static sys_var_have_variable sys_have_query_cache(&vars, "have_query_cache", &have_query_cache); -static sys_var_have_variable sys_have_community_features(&vars, "have_community_features", &have_community_features); static sys_var_have_variable sys_have_rtree_keys(&vars, "have_rtree_keys", &have_rtree_keys); static sys_var_have_variable sys_have_symlink(&vars, "have_symlink", &have_symlink); /* Global read-only variable describing server license */ @@ -1796,7 +1796,7 @@ bool sys_var::check_enum(THD *thd, set_var *var, const TYPELIB *enum_names) if (!(res=var->value->val_str(&str)) || ((long) (var->save_result.ulong_value= (ulong) find_type(enum_names, res->ptr(), - res->length(),1)-1)) < 0) + res->length(), FALSE) - 1)) < 0) { value= res ? res->c_ptr() : "NULL"; goto err; @@ -2535,9 +2535,20 @@ bool update_sys_var_str_path(THD *thd, sys_var_str *var_str, { MYSQL_QUERY_LOG *file_log; char buff[FN_REFLEN]; - char *res= 0, *old_value=(char *)(var ? var->value->str_value.ptr() : 0); + char *res= 0, *old_value= 0; bool result= 0; - uint str_length= (var ? var->value->str_value.length() : 0); + uint str_length= 0; + + if (var) + { + String str(buff, sizeof(buff), system_charset_info), *newval; + + newval= var->value->val_str(&str); + old_value= newval->c_ptr_safe(); + str_length= strlen(old_value); + } + + switch (log_type) { case QUERY_LOG_SLOW: @@ -3249,7 +3260,7 @@ int mysql_add_sys_var_chain(sys_var *first, struct my_option *long_options) error: for (; first != var; first= first->next) - hash_delete(&system_variable_hash, (uchar*) first); + my_hash_delete(&system_variable_hash, (uchar*) first); return 1; } @@ -3273,7 +3284,7 @@ int mysql_del_sys_var_chain(sys_var *first) /* A write lock should be held on LOCK_system_variables_hash */ for (sys_var *var= first; var; var= var->next) - result|= hash_delete(&system_variable_hash, (uchar*) var); + result|= my_hash_delete(&system_variable_hash, (uchar*) var); return result; } @@ -3310,7 +3321,7 @@ SHOW_VAR* enumerate_sys_vars(THD *thd, bool sorted) for (i= 0; i < count; i++) { - sys_var *var= (sys_var*) hash_element(&system_variable_hash, i); + sys_var *var= (sys_var*) my_hash_element(&system_variable_hash, i); show->name= var->name; show->value= (char*) var; show->type= SHOW_SYS; @@ -3347,8 +3358,8 @@ int set_var_init() for (sys_var *var=vars.first; var; var= var->next, count++); - if (hash_init(&system_variable_hash, system_charset_info, count, 0, - 0, (hash_get_key) get_sys_var_length, 0, HASH_UNIQUE)) + if (my_hash_init(&system_variable_hash, system_charset_info, count, 0, + 0, (my_hash_get_key) get_sys_var_length, 0, HASH_UNIQUE)) goto error; vars.last->next= NULL; @@ -3373,7 +3384,7 @@ error: void set_var_free() { - hash_free(&system_variable_hash); + my_hash_free(&system_variable_hash); } @@ -3399,7 +3410,7 @@ sys_var *intern_find_sys_var(const char *str, uint length, bool no_error) This function is only called from the sql_plugin.cc. A lock on LOCK_system_variable_hash should be held */ - var= (sys_var*) hash_search(&system_variable_hash, + var= (sys_var*) my_hash_search(&system_variable_hash, (uchar*) str, length ? length : strlen(str)); if (!(var || no_error)) my_error(ER_UNKNOWN_SYSTEM_VARIABLE, MYF(0), (char*) str); @@ -3913,7 +3924,8 @@ ulong fix_sql_mode(ulong sql_mode) if (sql_mode & MODE_TRADITIONAL) sql_mode|= (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES | MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE | - MODE_ERROR_FOR_DIVISION_BY_ZERO | MODE_NO_AUTO_CREATE_USER); + MODE_ERROR_FOR_DIVISION_BY_ZERO | MODE_NO_AUTO_CREATE_USER | + MODE_NO_ENGINE_SUBSTITUTION); return sql_mode; } diff --git a/sql/sp.cc b/sql/sp.cc index 5898e553320..9d5efe227dc 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -1500,11 +1500,11 @@ static bool add_used_routine(LEX *lex, Query_arena *arena, const LEX_STRING *key, TABLE_LIST *belong_to_view) { - hash_init_opt(&lex->sroutines, system_charset_info, - Query_tables_list::START_SROUTINES_HASH_SIZE, - 0, 0, sp_sroutine_key, 0, 0); + my_hash_init_opt(&lex->sroutines, system_charset_info, + Query_tables_list::START_SROUTINES_HASH_SIZE, + 0, 0, sp_sroutine_key, 0, 0); - if (!hash_search(&lex->sroutines, (uchar *)key->str, key->length)) + if (!my_hash_search(&lex->sroutines, (uchar *)key->str, key->length)) { Sroutine_hash_entry *rn= (Sroutine_hash_entry *)arena->alloc(sizeof(Sroutine_hash_entry) + @@ -1569,7 +1569,7 @@ void sp_remove_not_own_routines(LEX *lex) but we want to be more future-proof. */ next_rt= not_own_rt->next; - hash_delete(&lex->sroutines, (uchar *)not_own_rt); + my_hash_delete(&lex->sroutines, (uchar *)not_own_rt); } *(Sroutine_hash_entry **)lex->sroutines_list_own_last= NULL; @@ -1598,8 +1598,8 @@ void sp_update_sp_used_routines(HASH *dst, HASH *src) { for (uint i=0 ; i < src->records ; i++) { - Sroutine_hash_entry *rt= (Sroutine_hash_entry *)hash_element(src, i); - if (!hash_search(dst, (uchar *)rt->key.str, rt->key.length)) + Sroutine_hash_entry *rt= (Sroutine_hash_entry *)my_hash_element(src, i); + if (!my_hash_search(dst, (uchar *)rt->key.str, rt->key.length)) my_hash_insert(dst, (uchar *)rt); } } @@ -1625,7 +1625,7 @@ sp_update_stmt_used_routines(THD *thd, LEX *lex, HASH *src, { for (uint i=0 ; i < src->records ; i++) { - Sroutine_hash_entry *rt= (Sroutine_hash_entry *)hash_element(src, i); + Sroutine_hash_entry *rt= (Sroutine_hash_entry *)my_hash_element(src, i); (void)add_used_routine(lex, thd->stmt_arena, &rt->key, belong_to_view); } } diff --git a/sql/sp_cache.cc b/sql/sp_cache.cc index 64898915b7e..d9a23d2be4e 100644 --- a/sql/sp_cache.cc +++ b/sql/sp_cache.cc @@ -44,7 +44,8 @@ public: inline sp_head *lookup(char *name, uint namelen) { - return (sp_head *)hash_search(&m_hashtable, (const uchar *)name, namelen); + return (sp_head *) my_hash_search(&m_hashtable, (const uchar *)name, + namelen); } #ifdef NOT_USED @@ -255,15 +256,15 @@ sp_cache::sp_cache() sp_cache::~sp_cache() { - hash_free(&m_hashtable); + my_hash_free(&m_hashtable); } void sp_cache::init() { - hash_init(&m_hashtable, system_charset_info, 0, 0, 0, - hash_get_key_for_sp_head, hash_free_sp_head, 0); + my_hash_init(&m_hashtable, system_charset_info, 0, 0, 0, + hash_get_key_for_sp_head, hash_free_sp_head, 0); version= 0; } @@ -271,5 +272,5 @@ sp_cache::init() void sp_cache::cleanup() { - hash_free(&m_hashtable); + my_hash_free(&m_hashtable); } diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 62e6b8b2e1f..a61f097ed1d 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -531,8 +531,9 @@ sp_head::sp_head() m_backpatch.empty(); m_cont_backpatch.empty(); m_lex.empty(); - hash_init(&m_sptabs, system_charset_info, 0, 0, 0, sp_table_key, 0, 0); - hash_init(&m_sroutines, system_charset_info, 0, 0, 0, sp_sroutine_key, 0, 0); + my_hash_init(&m_sptabs, system_charset_info, 0, 0, 0, sp_table_key, 0, 0); + my_hash_init(&m_sroutines, system_charset_info, 0, 0, 0, sp_sroutine_key, + 0, 0); m_body_utf8.str= NULL; m_body_utf8.length= 0; @@ -781,8 +782,8 @@ sp_head::destroy() m_thd->lex= lex; } - hash_free(&m_sptabs); - hash_free(&m_sroutines); + my_hash_free(&m_sptabs); + my_hash_free(&m_sroutines); DBUG_VOID_RETURN; } @@ -1207,7 +1208,7 @@ sp_head::execute(THD *thd) */ thd->spcont->callers_arena= &backup_arena; -#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER) +#if defined(ENABLED_PROFILING) /* Discard the initial part of executing routines. */ thd->profiling.discard_current_query(); #endif @@ -1216,7 +1217,7 @@ sp_head::execute(THD *thd) sp_instr *i; uint hip; // Handler ip -#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER) +#if defined(ENABLED_PROFILING) /* Treat each "instr" of a routine as discrete unit that could be profiled. Profiling only records information for segments of code that set the @@ -1229,7 +1230,7 @@ sp_head::execute(THD *thd) i = get_instr(ip); // Returns NULL when we're done. if (i == NULL) { -#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER) +#if defined(ENABLED_PROFILING) thd->profiling.discard_current_query(); #endif break; @@ -1312,7 +1313,7 @@ sp_head::execute(THD *thd) } } while (!err_status && !thd->killed && !thd->is_fatal_error); -#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER) +#if defined(ENABLED_PROFILING) thd->profiling.finish_current_query(); thd->profiling.start_new_query("tail end of routine"); #endif @@ -1957,15 +1958,19 @@ sp_head::execute_procedure(THD *thd, List<Item> *args) } } - /* - Okay, got values for all arguments. Close tables that might be used by - arguments evaluation. If arguments evaluation required prelocking mode, + /* + Okay, got values for all arguments. Close tables that might be used by + arguments evaluation. If arguments evaluation required prelocking mode, we'll leave it here. */ if (!thd->in_sub_stmt) { thd->lex->unit.cleanup(); - close_thread_tables(thd); + + thd_proc_info(thd, "closing tables"); + close_thread_tables(thd); + thd_proc_info(thd, 0); + thd->rollback_item_tree_changes(); } @@ -2845,7 +2850,7 @@ sp_instr_stmt::execute(THD *thd, uint *nextp) query= thd->query; query_length= thd->query_length; -#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER) +#if defined(ENABLED_PROFILING) /* This s-p instr is profilable and will be captured. */ thd->profiling.set_query_source(m_query.str, m_query.length); #endif @@ -3821,7 +3826,7 @@ sp_head::merge_table_list(THD *thd, TABLE_LIST *table, LEX *lex_for_tmp_check) for (uint i= 0 ; i < m_sptabs.records ; i++) { - tab= (SP_TABLE *)hash_element(&m_sptabs, i); + tab= (SP_TABLE*) my_hash_element(&m_sptabs, i); tab->query_lock_count= 0; } @@ -3855,8 +3860,8 @@ sp_head::merge_table_list(THD *thd, TABLE_LIST *table, LEX *lex_for_tmp_check) (and therefore should not be prelocked). Otherwise we will erroneously treat table with same name but with different alias as non-temporary. */ - if ((tab= (SP_TABLE *)hash_search(&m_sptabs, (uchar *)tname, tlen)) || - ((tab= (SP_TABLE *)hash_search(&m_sptabs, (uchar *)tname, + if ((tab= (SP_TABLE*) my_hash_search(&m_sptabs, (uchar *)tname, tlen)) || + ((tab= (SP_TABLE*) my_hash_search(&m_sptabs, (uchar *)tname, tlen - alen - 1)) && tab->temp)) { @@ -3941,7 +3946,7 @@ sp_head::add_used_tables_to_table_list(THD *thd, { char *tab_buff, *key_buff; TABLE_LIST *table; - SP_TABLE *stab= (SP_TABLE *)hash_element(&m_sptabs, i); + SP_TABLE *stab= (SP_TABLE*) my_hash_element(&m_sptabs, i); if (stab->temp) continue; diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index a82efbd9f34..84b3e96ec20 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -261,8 +261,8 @@ my_bool acl_init(bool dont_read_acl_tables) DBUG_ENTER("acl_init"); acl_cache= new hash_filo(ACL_CACHE_SIZE, 0, 0, - (hash_get_key) acl_entry_get_key, - (hash_free_key) free, + (my_hash_get_key) acl_entry_get_key, + (my_hash_free_key) free, lower_case_file_system ? system_charset_info : &my_charset_bin); if (dont_read_acl_tables) @@ -638,7 +638,7 @@ void acl_free(bool end) delete_dynamic(&acl_users); delete_dynamic(&acl_dbs); delete_dynamic(&acl_wild_hosts); - hash_free(&acl_check_hosts); + my_hash_free(&acl_check_hosts); if (!end) acl_cache->clear(1); /* purecov: inspected */ else @@ -714,7 +714,7 @@ my_bool acl_reload(THD *thd) old_acl_dbs=acl_dbs; old_mem=mem; delete_dynamic(&acl_wild_hosts); - hash_free(&acl_check_hosts); + my_hash_free(&acl_check_hosts); if ((return_val= acl_load(thd, tables))) { // Error. Revert to old list @@ -1429,8 +1429,8 @@ static void init_check_host(void) DBUG_ENTER("init_check_host"); VOID(my_init_dynamic_array(&acl_wild_hosts,sizeof(struct acl_host_and_ip), acl_users.elements,1)); - VOID(hash_init(&acl_check_hosts,system_charset_info,acl_users.elements,0,0, - (hash_get_key) check_get_key,0,0)); + VOID(my_hash_init(&acl_check_hosts,system_charset_info,acl_users.elements,0,0, + (my_hash_get_key) check_get_key,0,0)); if (!allow_all_hosts) { for (uint i=0 ; i < acl_users.elements ; i++) @@ -1452,8 +1452,9 @@ static void init_check_host(void) if (j == acl_wild_hosts.elements) // If new (void) push_dynamic(&acl_wild_hosts,(uchar*) &acl_user->host); } - else if (!hash_search(&acl_check_hosts,(uchar*) acl_user->host.hostname, - strlen(acl_user->host.hostname))) + else if (!my_hash_search(&acl_check_hosts,(uchar*) + acl_user->host.hostname, + strlen(acl_user->host.hostname))) { if (my_hash_insert(&acl_check_hosts,(uchar*) acl_user)) { // End of memory @@ -1480,7 +1481,7 @@ static void init_check_host(void) void rebuild_check_host(void) { delete_dynamic(&acl_wild_hosts); - hash_free(&acl_check_hosts); + my_hash_free(&acl_check_hosts); init_check_host(); } @@ -1493,8 +1494,8 @@ bool acl_check_host(const char *host, const char *ip) return 0; VOID(pthread_mutex_lock(&acl_cache->lock)); - if ((host && hash_search(&acl_check_hosts,(uchar*) host,strlen(host))) || - (ip && hash_search(&acl_check_hosts,(uchar*) ip, strlen(ip)))) + if ((host && my_hash_search(&acl_check_hosts,(uchar*) host,strlen(host))) || + (ip && my_hash_search(&acl_check_hosts,(uchar*) ip, strlen(ip)))) { VOID(pthread_mutex_unlock(&acl_cache->lock)); return 0; // Found host @@ -2298,8 +2299,8 @@ GRANT_TABLE::GRANT_TABLE(const char *h, const char *d,const char *u, const char *t, ulong p, ulong c) :GRANT_NAME(h,d,u,t,p), cols(c) { - (void) hash_init2(&hash_columns,4,system_charset_info, - 0,0,0, (hash_get_key) get_key_column,0,0); + (void) my_hash_init2(&hash_columns,4,system_charset_info, + 0,0,0, (my_hash_get_key) get_key_column,0,0); } @@ -2339,15 +2340,15 @@ GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs) if (!db || !tname) { /* Wrong table row; Ignore it */ - hash_clear(&hash_columns); /* allow for destruction */ + my_hash_clear(&hash_columns); /* allow for destruction */ cols= 0; return; } cols= (ulong) form->field[7]->val_int(); cols = fix_rights_for_column(cols); - (void) hash_init2(&hash_columns,4,system_charset_info, - 0,0,0, (hash_get_key) get_key_column,0,0); + (void) my_hash_init2(&hash_columns,4,system_charset_info, + 0,0,0, (my_hash_get_key) get_key_column,0,0); if (cols) { uint key_prefix_len; @@ -2399,7 +2400,7 @@ GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs) GRANT_TABLE::~GRANT_TABLE() { - hash_free(&hash_columns); + my_hash_free(&hash_columns); } @@ -2413,7 +2414,7 @@ static uchar* get_grant_table(GRANT_NAME *buff, size_t *length, void free_grant_table(GRANT_TABLE *grant_table) { - hash_free(&grant_table->hash_columns); + my_hash_free(&grant_table->hash_columns); } @@ -2431,11 +2432,11 @@ static GRANT_NAME *name_hash_search(HASH *name_hash, HASH_SEARCH_STATE state; len = (uint) (strmov(strmov(strmov(helping,user)+1,db)+1,tname)-helping)+ 1; - for (grant_name= (GRANT_NAME*) hash_first(name_hash, (uchar*) helping, - len, &state); + for (grant_name= (GRANT_NAME*) my_hash_first(name_hash, (uchar*) helping, + len, &state); grant_name ; - grant_name= (GRANT_NAME*) hash_next(name_hash,(uchar*) helping, - len, &state)) + grant_name= (GRANT_NAME*) my_hash_next(name_hash,(uchar*) helping, + len, &state)) { if (exact) { @@ -2479,7 +2480,8 @@ table_hash_search(const char *host, const char *ip, const char *db, inline GRANT_COLUMN * column_hash_search(GRANT_TABLE *t, const char *cname, uint length) { - return (GRANT_COLUMN*) hash_search(&t->hash_columns, (uchar*) cname,length); + return (GRANT_COLUMN*) my_hash_search(&t->hash_columns, + (uchar*) cname, length); } @@ -2659,7 +2661,7 @@ static int replace_column_table(GRANT_TABLE *g_t, goto end; /* purecov: deadcode */ } if (grant_column) - hash_delete(&g_t->hash_columns,(uchar*) grant_column); + my_hash_delete(&g_t->hash_columns,(uchar*) grant_column); } } } while (!table->file->index_next(table->record[0]) && @@ -2785,7 +2787,7 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table, } else { - hash_delete(&column_priv_hash,(uchar*) grant_table); + my_hash_delete(&column_priv_hash,(uchar*) grant_table); } DBUG_RETURN(0); @@ -2906,7 +2908,8 @@ static int replace_routine_table(THD *thd, GRANT_NAME *grant_name, } else { - hash_delete(is_proc ? &proc_priv_hash : &func_priv_hash,(uchar*) grant_name); + my_hash_delete(is_proc ? &proc_priv_hash : &func_priv_hash,(uchar*) + grant_name); } DBUG_RETURN(0); @@ -3147,8 +3150,8 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list, column_priv= 0; for (uint idx=0 ; idx < grant_table->hash_columns.records ; idx++) { - grant_column= (GRANT_COLUMN*) hash_element(&grant_table->hash_columns, - idx); + grant_column= (GRANT_COLUMN*) + my_hash_element(&grant_table->hash_columns, idx); grant_column->rights&= ~rights; // Fix other columns column_priv|= grant_column->rights; } @@ -3479,9 +3482,9 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list, void grant_free(void) { DBUG_ENTER("grant_free"); - hash_free(&column_priv_hash); - hash_free(&proc_priv_hash); - hash_free(&func_priv_hash); + my_hash_free(&column_priv_hash); + my_hash_free(&proc_priv_hash); + my_hash_free(&func_priv_hash); free_root(&memex,MYF(0)); DBUG_VOID_RETURN; } @@ -3538,12 +3541,12 @@ static my_bool grant_load_procs_priv(TABLE *p_table) MEM_ROOT **save_mem_root_ptr= my_pthread_getspecific_ptr(MEM_ROOT**, THR_MALLOC); DBUG_ENTER("grant_load_procs_priv"); - (void) hash_init(&proc_priv_hash,system_charset_info, - 0,0,0, (hash_get_key) get_grant_table, - 0,0); - (void) hash_init(&func_priv_hash,system_charset_info, - 0,0,0, (hash_get_key) get_grant_table, - 0,0); + (void) my_hash_init(&proc_priv_hash,system_charset_info, + 0,0,0, (my_hash_get_key) get_grant_table, + 0,0); + (void) my_hash_init(&func_priv_hash,system_charset_info, + 0,0,0, (my_hash_get_key) get_grant_table, + 0,0); p_table->file->ha_index_init(0, 1); p_table->use_all_columns(); @@ -3639,9 +3642,9 @@ static my_bool grant_load(THD *thd, TABLE_LIST *tables) thd->variables.sql_mode&= ~MODE_PAD_CHAR_TO_FULL_LENGTH; - (void) hash_init(&column_priv_hash,system_charset_info, - 0,0,0, (hash_get_key) get_grant_table, - (hash_free_key) free_grant_table,0); + (void) my_hash_init(&column_priv_hash,system_charset_info, + 0,0,0, (my_hash_get_key) get_grant_table, + (my_hash_free_key) free_grant_table,0); t_table = tables[0].table; c_table = tables[1].table; @@ -3744,8 +3747,8 @@ static my_bool grant_reload_procs_priv(THD *thd) } else { - hash_free(&old_proc_priv_hash); - hash_free(&old_func_priv_hash); + my_hash_free(&old_proc_priv_hash); + my_hash_free(&old_func_priv_hash); } rw_unlock(&LOCK_grant); @@ -3814,7 +3817,7 @@ my_bool grant_reload(THD *thd) } else { - hash_free(&old_column_priv_hash); + my_hash_free(&old_column_priv_hash); free_root(&old_mem,MYF(0)); } rw_unlock(&LOCK_grant); @@ -4319,7 +4322,7 @@ static bool check_grant_db_routine(THD *thd, const char *db, HASH *hash) for (uint idx= 0; idx < hash->records; ++idx) { - GRANT_NAME *item= (GRANT_NAME*) hash_element(hash, idx); + GRANT_NAME *item= (GRANT_NAME*) my_hash_element(hash, idx); if (strcmp(item->user, sctx->priv_user) == 0 && strcmp(item->db, db) == 0 && @@ -4352,8 +4355,9 @@ bool check_grant_db(THD *thd,const char *db) for (uint idx=0 ; idx < column_priv_hash.records ; idx++) { - GRANT_TABLE *grant_table= (GRANT_TABLE*) hash_element(&column_priv_hash, - idx); + GRANT_TABLE *grant_table= (GRANT_TABLE*) + my_hash_element(&column_priv_hash, + idx); if (len < grant_table->key_length && !memcmp(grant_table->hash_key,helping,len) && compare_hostname(&grant_table->host, sctx->host, sctx->ip)) @@ -4576,13 +4580,13 @@ static const char *command_array[]= "ALTER", "SHOW DATABASES", "SUPER", "CREATE TEMPORARY TABLES", "LOCK TABLES", "EXECUTE", "REPLICATION SLAVE", "REPLICATION CLIENT", "CREATE VIEW", "SHOW VIEW", "CREATE ROUTINE", "ALTER ROUTINE", - "CREATE USER", "EVENT", "TRIGGER" + "CREATE USER", "EVENT", "TRIGGER", "CREATE TABLESPACE" }; static uint command_lengths[]= { 6, 6, 6, 6, 6, 4, 6, 8, 7, 4, 5, 10, 5, 5, 14, 5, 23, 11, 7, 17, 18, 11, 9, - 14, 13, 11, 5, 7 + 14, 13, 11, 5, 7, 17 }; @@ -4825,8 +4829,8 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user) for (index=0 ; index < column_priv_hash.records ; index++) { const char *user, *host; - GRANT_TABLE *grant_table= (GRANT_TABLE*) hash_element(&column_priv_hash, - index); + GRANT_TABLE *grant_table= (GRANT_TABLE*) + my_hash_element(&column_priv_hash, index); if (!(user=grant_table->user)) user= ""; @@ -4879,7 +4883,7 @@ bool mysql_show_grants(THD *thd,LEX_USER *lex_user) col_index++) { GRANT_COLUMN *grant_column = (GRANT_COLUMN*) - hash_element(&grant_table->hash_columns,col_index); + my_hash_element(&grant_table->hash_columns,col_index); if (grant_column->rights & j) { if (!found_col) @@ -4969,7 +4973,7 @@ static int show_routine_grants(THD* thd, LEX_USER *lex_user, HASH *hash, for (index=0 ; index < hash->records ; index++) { const char *user, *host; - GRANT_NAME *grant_proc= (GRANT_NAME*) hash_element(hash, index); + GRANT_NAME *grant_proc= (GRANT_NAME*) my_hash_element(hash, index); if (!(user=grant_proc->user)) user= ""; @@ -5482,13 +5486,13 @@ static int handle_grant_struct(uint struct_no, bool drop, break; case 2: - grant_name= (GRANT_NAME*) hash_element(&column_priv_hash, idx); + grant_name= (GRANT_NAME*) my_hash_element(&column_priv_hash, idx); user= grant_name->user; host= grant_name->host.hostname; break; case 3: - grant_name= (GRANT_NAME*) hash_element(&proc_priv_hash, idx); + grant_name= (GRANT_NAME*) my_hash_element(&proc_priv_hash, idx); user= grant_name->user; host= grant_name->host.hostname; break; @@ -5521,11 +5525,11 @@ static int handle_grant_struct(uint struct_no, bool drop, break; case 2: - hash_delete(&column_priv_hash, (uchar*) grant_name); + my_hash_delete(&column_priv_hash, (uchar*) grant_name); break; case 3: - hash_delete(&proc_priv_hash, (uchar*) grant_name); + my_hash_delete(&proc_priv_hash, (uchar*) grant_name); break; } elements--; @@ -6039,8 +6043,8 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list) for (counter= 0, revoked= 0 ; counter < column_priv_hash.records ; ) { const char *user,*host; - GRANT_TABLE *grant_table= (GRANT_TABLE*)hash_element(&column_priv_hash, - counter); + GRANT_TABLE *grant_table= + (GRANT_TABLE*) my_hash_element(&column_priv_hash, counter); if (!(user=grant_table->user)) user= ""; if (!(host=grant_table->host.hostname)) @@ -6086,7 +6090,7 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list) for (counter= 0, revoked= 0 ; counter < hash->records ; ) { const char *user,*host; - GRANT_NAME *grant_proc= (GRANT_NAME*) hash_element(hash, counter); + GRANT_NAME *grant_proc= (GRANT_NAME*) my_hash_element(hash, counter); if (!(user=grant_proc->user)) user= ""; if (!(host=grant_proc->host.hostname)) @@ -6234,7 +6238,7 @@ bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name, { for (counter= 0, revoked= 0 ; counter < hash->records ; ) { - GRANT_NAME *grant_proc= (GRANT_NAME*) hash_element(hash, counter); + GRANT_NAME *grant_proc= (GRANT_NAME*) my_hash_element(hash, counter); if (!my_strcasecmp(system_charset_info, grant_proc->db, sp_db) && !my_strcasecmp(system_charset_info, grant_proc->tname, sp_name)) { @@ -6624,7 +6628,7 @@ int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond) for (index=0 ; index < column_priv_hash.records ; index++) { const char *user, *host, *is_grantable= "YES"; - GRANT_TABLE *grant_table= (GRANT_TABLE*) hash_element(&column_priv_hash, + GRANT_TABLE *grant_table= (GRANT_TABLE*) my_hash_element(&column_priv_hash, index); if (!(user=grant_table->user)) user= ""; @@ -6707,7 +6711,7 @@ int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond) for (index=0 ; index < column_priv_hash.records ; index++) { const char *user, *host, *is_grantable= "YES"; - GRANT_TABLE *grant_table= (GRANT_TABLE*) hash_element(&column_priv_hash, + GRANT_TABLE *grant_table= (GRANT_TABLE*) my_hash_element(&column_priv_hash, index); if (!(user=grant_table->user)) user= ""; @@ -6742,7 +6746,7 @@ int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond) col_index++) { GRANT_COLUMN *grant_column = (GRANT_COLUMN*) - hash_element(&grant_table->hash_columns,col_index); + my_hash_element(&grant_table->hash_columns,col_index); if ((grant_column->rights & j) && (table_access & j)) { if (update_schema_privilege(thd, table, buff, grant_table->db, diff --git a/sql/sql_acl.h b/sql/sql_acl.h index fd7824dc961..eb0b83e0620 100644 --- a/sql/sql_acl.h +++ b/sql/sql_acl.h @@ -43,6 +43,7 @@ #define CREATE_USER_ACL (1L << 25) #define EVENT_ACL (1L << 26) #define TRIGGER_ACL (1L << 27) +#define CREATE_TABLESPACE_ACL (1L << 28) /* don't forget to update 1. static struct show_privileges_st sys_privileges[] @@ -78,7 +79,8 @@ REFERENCES_ACL | INDEX_ACL | ALTER_ACL | SHOW_DB_ACL | SUPER_ACL | \ CREATE_TMP_ACL | LOCK_TABLES_ACL | REPL_SLAVE_ACL | REPL_CLIENT_ACL | \ EXECUTE_ACL | CREATE_VIEW_ACL | SHOW_VIEW_ACL | CREATE_PROC_ACL | \ - ALTER_PROC_ACL | CREATE_USER_ACL | EVENT_ACL | TRIGGER_ACL) + ALTER_PROC_ACL | CREATE_USER_ACL | EVENT_ACL | TRIGGER_ACL | \ + CREATE_TABLESPACE_ACL) #define DEFAULT_CREATE_PROC_ACLS \ (ALTER_PROC_ACL | EXECUTE_ACL) diff --git a/sql/sql_base.cc b/sql/sql_base.cc index d02a917644a..df6d1f803cb 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -126,9 +126,9 @@ extern "C" uchar *table_cache_key(const uchar *record, size_t *length, bool table_cache_init(void) { - return hash_init(&open_cache, &my_charset_bin, table_cache_size+16, - 0, 0, table_cache_key, - (hash_free_key) free_cache_entry, 0) != 0; + return my_hash_init(&open_cache, &my_charset_bin, table_cache_size+16, + 0, 0, table_cache_key, + (my_hash_free_key) free_cache_entry, 0) != 0; } void table_cache_free(void) @@ -138,7 +138,7 @@ void table_cache_free(void) { close_cached_tables(NULL, NULL, FALSE, FALSE, FALSE); if (!open_cache.records) // Safety first - hash_free(&open_cache); + my_hash_free(&open_cache); } DBUG_VOID_RETURN; } @@ -173,7 +173,7 @@ static void check_unused(void) } for (idx=0 ; idx < open_cache.records ; idx++) { - TABLE *entry=(TABLE*) hash_element(&open_cache,idx); + TABLE *entry=(TABLE*) my_hash_element(&open_cache,idx); if (!entry->in_use) count--; if (entry->file) @@ -286,9 +286,9 @@ bool table_def_init(void) oldest_unused_share= &end_of_unused_share; end_of_unused_share.prev= &oldest_unused_share; - return hash_init(&table_def_cache, &my_charset_bin, table_def_size, - 0, 0, table_def_key, - (hash_free_key) table_def_free_entry, 0) != 0; + return my_hash_init(&table_def_cache, &my_charset_bin, table_def_size, + 0, 0, table_def_key, + (my_hash_free_key) table_def_free_entry, 0) != 0; } @@ -299,7 +299,7 @@ void table_def_free(void) { table_def_inited= 0; pthread_mutex_destroy(&LOCK_table_share); - hash_free(&table_def_cache); + my_hash_free(&table_def_cache); } DBUG_VOID_RETURN; } @@ -345,8 +345,8 @@ TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key, *error= 0; /* Read table definition from cache */ - if ((share= (TABLE_SHARE*) hash_search(&table_def_cache,(uchar*) key, - key_length))) + if ((share= (TABLE_SHARE*) my_hash_search(&table_def_cache,(uchar*) key, + key_length))) goto found; if (!(share= alloc_table_share(table_list, key, key_length))) @@ -383,7 +383,7 @@ TABLE_SHARE *get_table_share(THD *thd, TABLE_LIST *table_list, char *key, if (open_table_def(thd, share, db_flags)) { *error= share->error; - (void) hash_delete(&table_def_cache, (uchar*) share); + (void) my_hash_delete(&table_def_cache, (uchar*) share); DBUG_RETURN(0); } share->ref_count++; // Mark in use @@ -435,7 +435,7 @@ found: oldest_unused_share->next) { pthread_mutex_lock(&oldest_unused_share->mutex); - VOID(hash_delete(&table_def_cache, (uchar*) oldest_unused_share)); + VOID(my_hash_delete(&table_def_cache, (uchar*) oldest_unused_share)); } DBUG_PRINT("exit", ("share: 0x%lx ref_count: %u", @@ -590,7 +590,7 @@ void release_table_share(TABLE_SHARE *share, enum release_type type) if (to_be_deleted) { DBUG_PRINT("info", ("Deleting share")); - hash_delete(&table_def_cache, (uchar*) share); + my_hash_delete(&table_def_cache, (uchar*) share); DBUG_VOID_RETURN; } pthread_mutex_unlock(&share->mutex); @@ -621,7 +621,8 @@ TABLE_SHARE *get_cached_table_share(const char *db, const char *table_name) table_list.db= (char*) db; table_list.table_name= (char*) table_name; key_length= create_table_def_key((THD*) 0, key, &table_list, 0); - return (TABLE_SHARE*) hash_search(&table_def_cache,(uchar*) key, key_length); + return (TABLE_SHARE*) my_hash_search(&table_def_cache, + (uchar*) key, key_length); } @@ -718,7 +719,7 @@ OPEN_TABLE_LIST *list_open_tables(THD *thd, const char *db, const char *wild) for (uint idx=0 ; result == 0 && idx < open_cache.records; idx++) { OPEN_TABLE_LIST *table; - TABLE *entry=(TABLE*) hash_element(&open_cache,idx); + TABLE *entry=(TABLE*) my_hash_element(&open_cache,idx); TABLE_SHARE *share= entry->s; if (db && my_strcasecmp(system_charset_info, db, share->db.str)) @@ -867,17 +868,17 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool have_lock, while (unused_tables) { #ifdef EXTRA_DEBUG - if (hash_delete(&open_cache,(uchar*) unused_tables)) + if (my_hash_delete(&open_cache,(uchar*) unused_tables)) printf("Warning: Couldn't delete open table from hash\n"); #else - VOID(hash_delete(&open_cache,(uchar*) unused_tables)); + VOID(my_hash_delete(&open_cache,(uchar*) unused_tables)); #endif } /* Free table shares */ while (oldest_unused_share->next) { pthread_mutex_lock(&oldest_unused_share->mutex); - VOID(hash_delete(&table_def_cache, (uchar*) oldest_unused_share)); + VOID(my_hash_delete(&table_def_cache, (uchar*) oldest_unused_share)); } DBUG_PRINT("tcache", ("incremented global refresh_version to: %lu", refresh_version)); @@ -922,7 +923,7 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool have_lock, */ for (uint idx=0 ; idx < open_cache.records ; idx++) { - TABLE *table=(TABLE*) hash_element(&open_cache,idx); + TABLE *table=(TABLE*) my_hash_element(&open_cache,idx); if (table->in_use) table->in_use->some_tables_deleted= 1; } @@ -966,7 +967,7 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables, bool have_lock, found=0; for (uint idx=0 ; idx < open_cache.records ; idx++) { - TABLE *table=(TABLE*) hash_element(&open_cache,idx); + TABLE *table=(TABLE*) my_hash_element(&open_cache,idx); /* Avoid a self-deadlock. */ if (table->in_use == thd) continue; @@ -1048,7 +1049,7 @@ bool close_cached_connection_tables(THD *thd, bool if_wait_for_refresh, for (idx= 0; idx < table_def_cache.records; idx++) { - TABLE_SHARE *share= (TABLE_SHARE *) hash_element(&table_def_cache, idx); + TABLE_SHARE *share= (TABLE_SHARE *) my_hash_element(&table_def_cache, idx); /* Ignore if table is not open or does not have a connect_string */ if (!share->connect_string.length || !share->ref_count) @@ -1204,7 +1205,7 @@ static void close_open_tables(THD *thd) /* Free tables to hold down open files */ while (open_cache.records > table_cache_size && unused_tables) - VOID(hash_delete(&open_cache,(uchar*) unused_tables)); /* purecov: tested */ + VOID(my_hash_delete(&open_cache,(uchar*) unused_tables)); /* purecov: tested */ check_unused(); if (found_old_table) { @@ -1390,7 +1391,7 @@ bool close_thread_table(THD *thd, TABLE **table_ptr) if (table->needs_reopen_or_name_lock() || thd->version != refresh_version || !table->db_stat) { - VOID(hash_delete(&open_cache,(uchar*) table)); + VOID(my_hash_delete(&open_cache,(uchar*) table)); found_old_table=1; } else @@ -2093,7 +2094,7 @@ void unlink_open_table(THD *thd, TABLE *find, bool unlock) /* Remove table from open_tables list. */ *prev= list->next; /* Close table. */ - VOID(hash_delete(&open_cache,(uchar*) list)); // Close table + VOID(my_hash_delete(&open_cache,(uchar*) list)); // Close table } else { @@ -2398,7 +2399,7 @@ bool lock_table_name_if_not_cached(THD *thd, const char *db, key_length= (uint)(strmov(strmov(key, db) + 1, table_name) - key) + 1; VOID(pthread_mutex_lock(&LOCK_open)); - if (hash_search(&open_cache, (uchar *)key, key_length)) + if (my_hash_search(&open_cache, (uchar *)key, key_length)) { VOID(pthread_mutex_unlock(&LOCK_open)); DBUG_PRINT("info", ("Table is cached, name-lock is not obtained")); @@ -2753,11 +2754,11 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, an implicit "pending locks queue" - see wait_for_locked_table_names for details. */ - for (table= (TABLE*) hash_first(&open_cache, (uchar*) key, key_length, - &state); + for (table= (TABLE*) my_hash_first(&open_cache, (uchar*) key, key_length, + &state); table && table->in_use ; - table= (TABLE*) hash_next(&open_cache, (uchar*) key, key_length, - &state)) + table= (TABLE*) my_hash_next(&open_cache, (uchar*) key, key_length, + &state)) { DBUG_PRINT("tcache", ("in_use table: '%s'.'%s' 0x%lx", table->s->db.str, table->s->table_name.str, (long) table)); @@ -2869,7 +2870,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, DBUG_PRINT("tcache", ("opening new table")); /* Free cache if too big */ while (open_cache.records > table_cache_size && unused_tables) - VOID(hash_delete(&open_cache,(uchar*) unused_tables)); /* purecov: tested */ + VOID(my_hash_delete(&open_cache,(uchar*) unused_tables)); /* purecov: tested */ if (table_list->create) { @@ -2927,7 +2928,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root, Set 1 as a flag here */ if (error < 0) - table_list->view= (st_lex*)1; + table_list->view= (LEX*)1; my_free((uchar*)table, MYF(0)); VOID(pthread_mutex_unlock(&LOCK_open)); @@ -3326,7 +3327,7 @@ bool reopen_tables(THD *thd, bool get_locks, bool mark_share_as_old) */ if (table->child_l || table->parent) detach_merge_children(table, TRUE); - VOID(hash_delete(&open_cache,(uchar*) table)); + VOID(my_hash_delete(&open_cache,(uchar*) table)); error=1; } else @@ -3355,7 +3356,7 @@ bool reopen_tables(THD *thd, bool get_locks, bool mark_share_as_old) { while (err_tables) { - VOID(hash_delete(&open_cache, (uchar*) err_tables)); + VOID(my_hash_delete(&open_cache, (uchar*) err_tables)); err_tables= err_tables->next; } } @@ -3507,11 +3508,11 @@ bool table_is_used(TABLE *table, bool wait_for_name_lock) DBUG_PRINT("loop", ("table_name: %s", table->alias)); HASH_SEARCH_STATE state; - for (TABLE *search= (TABLE*) hash_first(&open_cache, (uchar*) key, - key_length, &state); + for (TABLE *search= (TABLE*) my_hash_first(&open_cache, (uchar*) key, + key_length, &state); search ; - search= (TABLE*) hash_next(&open_cache, (uchar*) key, - key_length, &state)) + search= (TABLE*) my_hash_next(&open_cache, (uchar*) key, + key_length, &state)) { DBUG_PRINT("info", ("share: 0x%lx " "open_placeholder: %d locked_by_name: %d " @@ -3637,7 +3638,7 @@ TABLE *drop_locked_tables(THD *thd,const char *db, const char *table_name) else { /* We already have a name lock, remove copy */ - VOID(hash_delete(&open_cache,(uchar*) table)); + VOID(my_hash_delete(&open_cache,(uchar*) table)); } } else @@ -4611,7 +4612,7 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags) Let us free memory used by 'sroutines' hash here since we never call destructor for this LEX. */ - hash_free(&tables->view->sroutines); + my_hash_free(&tables->view->sroutines); goto process_view_routines; } @@ -5875,8 +5876,8 @@ find_field_in_table(THD *thd, TABLE *table, const char *name, uint length, field_ptr= table->field + cached_field_index; else if (table->s->name_hash.records) { - field_ptr= (Field**) hash_search(&table->s->name_hash, (uchar*) name, - length); + field_ptr= (Field**) my_hash_search(&table->s->name_hash, (uchar*) name, + length); if (field_ptr) { /* @@ -6122,8 +6123,8 @@ Field *find_field_in_table_sef(TABLE *table, const char *name) Field **field_ptr; if (table->s->name_hash.records) { - field_ptr= (Field**)hash_search(&table->s->name_hash,(uchar*) name, - strlen(name)); + field_ptr= (Field**)my_hash_search(&table->s->name_hash,(uchar*) name, + strlen(name)); if (field_ptr) { /* @@ -8365,7 +8366,7 @@ void remove_db_from_cache(const char *db) { for (uint idx=0 ; idx < open_cache.records ; idx++) { - TABLE *table=(TABLE*) hash_element(&open_cache,idx); + TABLE *table=(TABLE*) my_hash_element(&open_cache,idx); if (!strcmp(table->s->db.str, db)) { table->s->version= 0L; /* Free when thread is ready */ @@ -8374,7 +8375,7 @@ void remove_db_from_cache(const char *db) } } while (unused_tables && !unused_tables->s->version) - VOID(hash_delete(&open_cache,(uchar*) unused_tables)); + VOID(my_hash_delete(&open_cache,(uchar*) unused_tables)); } @@ -8390,7 +8391,7 @@ void flush_tables() { (void) pthread_mutex_lock(&LOCK_open); while (unused_tables) - hash_delete(&open_cache,(uchar*) unused_tables); + my_hash_delete(&open_cache,(uchar*) unused_tables); (void) pthread_mutex_unlock(&LOCK_open); } @@ -8427,11 +8428,11 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name, HASH_SEARCH_STATE state; result= signalled= 0; - for (table= (TABLE*) hash_first(&open_cache, (uchar*) key, key_length, - &state); + for (table= (TABLE*) my_hash_first(&open_cache, (uchar*) key, key_length, + &state); table; - table= (TABLE*) hash_next(&open_cache, (uchar*) key, key_length, - &state)) + table= (TABLE*) my_hash_next(&open_cache, (uchar*) key, key_length, + &state)) { THD *in_use; DBUG_PRINT("tcache", ("found table: '%s'.'%s' 0x%lx", table->s->db.str, @@ -8498,12 +8499,12 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name, } } while (unused_tables && !unused_tables->s->version) - VOID(hash_delete(&open_cache,(uchar*) unused_tables)); + VOID(my_hash_delete(&open_cache,(uchar*) unused_tables)); DBUG_PRINT("info", ("Removing table from table_def_cache")); /* Remove table from table definition cache if it's not in use */ - if ((share= (TABLE_SHARE*) hash_search(&table_def_cache,(uchar*) key, - key_length))) + if ((share= (TABLE_SHARE*) my_hash_search(&table_def_cache,(uchar*) key, + key_length))) { DBUG_PRINT("info", ("share version: %lu ref_count: %u", share->version, share->ref_count)); @@ -8511,7 +8512,7 @@ bool remove_table_from_cache(THD *thd, const char *db, const char *table_name, if (share->ref_count == 0) { pthread_mutex_lock(&share->mutex); - VOID(hash_delete(&table_def_cache, (uchar*) share)); + VOID(my_hash_delete(&table_def_cache, (uchar*) share)); } } @@ -8759,11 +8760,11 @@ void mysql_wait_completed_table(ALTER_PARTITION_PARAM_TYPE *lpt, TABLE *my_table key_length=(uint) (strmov(strmov(key,lpt->db)+1,lpt->table_name)-key)+1; VOID(pthread_mutex_lock(&LOCK_open)); HASH_SEARCH_STATE state; - for (table= (TABLE*) hash_first(&open_cache,(uchar*) key,key_length, - &state) ; + for (table= (TABLE*) my_hash_first(&open_cache,(uchar*) key,key_length, + &state) ; table; - table= (TABLE*) hash_next(&open_cache,(uchar*) key,key_length, - &state)) + table= (TABLE*) my_hash_next(&open_cache,(uchar*) key,key_length, + &state)) { THD *in_use= table->in_use; table->s->version= 0L; diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index e4eb1e012b5..aed32497009 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -789,19 +789,20 @@ uchar *query_cache_query_get_key(const uchar *record, size_t *length, Note on double-check locking (DCL) usage. Below, in query_cache_insert(), query_cache_abort() and - query_cache_end_of_result() we use what is called double-check - locking (DCL) for NET::query_cache_query. I.e. we test it first - without a lock, and, if positive, test again under the lock. + Query_cache::end_of_result() we use what is called double-check + locking (DCL) for Query_cache_tls::first_query_block. + I.e. we test it first without a lock, and, if positive, test again + under the lock. - This means that if we see 'NET::query_cache_query == 0' without a + This means that if we see 'first_query_block == 0' without a lock we will skip the operation. But this is safe here: when we started to cache a query, we called Query_cache::store_query(), and - NET::query_cache_query was set to non-zero in this thread (and the + 'first_query_block' was set to non-zero in this thread (and the thread always sees results of its memory operations, mutex or not). - If later we see 'NET::query_cache_query == 0' without locking a + If later we see 'first_query_block == 0' without locking a mutex, that may only mean that some other thread have reset it by invalidating the query. Skipping the operation in this case is the - right thing to do, as NET::query_cache_query won't get non-zero for + right thing to do, as first_query_block won't get non-zero for this query again. See also comments in Query_cache::store_query() and @@ -810,56 +811,71 @@ uchar *query_cache_query_get_key(const uchar *record, size_t *length, NOTE, however, that double-check locking is not applicable in 'invalidate' functions, as we may erroneously skip invalidation, because the thread doing invalidation may never see non-zero - NET::query_cache_query. + 'first_query_block'. */ -void query_cache_init_query(NET *net) +/** + libmysql convenience wrapper to insert data into query cache. +*/ +void query_cache_insert(const char *packet, ulong length, + unsigned pkt_nr) { + THD *thd= current_thd; + /* - It is safe to initialize 'NET::query_cache_query' without a lock - here, because before it will be accessed from different threads it - will be set in this thread under a lock, and access from the same - thread is always safe. + Current_thd can be NULL when a new connection is immediately ended + due to "Too many connections". thd->store_globals() has not been + called at this time and hence my_pthread_setspecific_ptr(THR_THD, + this) has not been called for this thread. */ - net->query_cache_query= 0; + + if (!thd) + return; + + query_cache.insert(&thd->query_cache_tls, + packet, length, + pkt_nr); } -/* +/** Insert the packet into the query cache. */ -void query_cache_insert(NET *net, const char *packet, ulong length) +void +Query_cache::insert(Query_cache_tls *query_cache_tls, + const char *packet, ulong length, + unsigned pkt_nr) { - DBUG_ENTER("query_cache_insert"); + DBUG_ENTER("Query_cache::insert"); /* See the comment on double-check locking usage above. */ - if (net->query_cache_query == 0) + if (query_cache_tls->first_query_block == NULL) DBUG_VOID_RETURN; DBUG_EXECUTE_IF("wait_in_query_cache_insert", debug_wait_for_kill("wait_in_query_cache_insert"); ); - if (query_cache.try_lock()) + + if (try_lock()) DBUG_VOID_RETURN; - Query_cache_block *query_block= (Query_cache_block*)net->query_cache_query; - if (!query_block) + Query_cache_block *query_block = query_cache_tls->first_query_block; + if (query_block == NULL) { /* We lost the writer and the currently processed query has been invalidated; there is nothing left to do. */ - query_cache.unlock(); + unlock(); DBUG_VOID_RETURN; } - BLOCK_LOCK_WR(query_block); Query_cache_query *header= query_block->query(); Query_cache_block *result= header->result(); - DUMP(&query_cache); + DUMP(this); DBUG_PRINT("qcache", ("insert packet %lu bytes long",length)); /* @@ -867,8 +883,8 @@ void query_cache_insert(NET *net, const char *packet, ulong length) still need structure_guard_mutex to free the query, and therefore unlock it later in this function. */ - if (!query_cache.append_result_data(&result, length, (uchar*) packet, - query_block)) + if (!append_result_data(&result, length, (uchar*) packet, + query_block)) { DBUG_PRINT("warning", ("Can't append data")); header->result(result); @@ -877,60 +893,63 @@ void query_cache_insert(NET *net, const char *packet, ulong length) query_cache.free_query(query_block); query_cache.refused++; // append_result_data no success => we need unlock - query_cache.unlock(); + unlock(); DBUG_VOID_RETURN; } header->result(result); - header->last_pkt_nr= net->pkt_nr; + header->last_pkt_nr= pkt_nr; BLOCK_UNLOCK_WR(query_block); - DBUG_EXECUTE("check_querycache",query_cache.check_integrity(0);); + DBUG_EXECUTE("check_querycache",check_integrity(0);); DBUG_VOID_RETURN; } -void query_cache_abort(NET *net) +void +Query_cache::abort(Query_cache_tls *query_cache_tls) { DBUG_ENTER("query_cache_abort"); THD *thd= current_thd; /* See the comment on double-check locking usage above. */ - if (net->query_cache_query == 0) + if (query_cache_tls->first_query_block == NULL) DBUG_VOID_RETURN; - if (query_cache.try_lock()) + if (try_lock()) DBUG_VOID_RETURN; /* While we were waiting another thread might have changed the status of the writer. Make sure the writer still exists before continue. */ - Query_cache_block *query_block= ((Query_cache_block*) - net->query_cache_query); + Query_cache_block *query_block= query_cache_tls->first_query_block; if (query_block) { thd_proc_info(thd, "storing result in query cache"); - DUMP(&query_cache); + DUMP(this); BLOCK_LOCK_WR(query_block); // The following call will remove the lock on query_block - query_cache.free_query(query_block); - net->query_cache_query= 0; - DBUG_EXECUTE("check_querycache",query_cache.check_integrity(1);); + free_query(query_block); + query_cache_tls->first_query_block= NULL; + DBUG_EXECUTE("check_querycache", check_integrity(1);); } - query_cache.unlock(); + unlock(); + DBUG_VOID_RETURN; } -void query_cache_end_of_result(THD *thd) +void Query_cache::end_of_result(THD *thd) { Query_cache_block *query_block; - DBUG_ENTER("query_cache_end_of_result"); + Query_cache_tls *query_cache_tls= &thd->query_cache_tls; + ulonglong limit_found_rows= thd->limit_found_rows; + DBUG_ENTER("Query_cache::end_of_result"); /* See the comment on double-check locking usage above. */ - if (thd->net.query_cache_query == 0) + if (query_cache_tls->first_query_block == NULL) DBUG_VOID_RETURN; /* Ensure that only complete results are cached. */ @@ -938,19 +957,19 @@ void query_cache_end_of_result(THD *thd) if (thd->killed) { - query_cache_abort(&thd->net); + query_cache_abort(&thd->query_cache_tls); DBUG_VOID_RETURN; } #ifdef EMBEDDED_LIBRARY - query_cache_insert(&thd->net, (char*)thd, - emb_count_querycache_size(thd)); + insert(query_cache_tls, (char*)thd, + emb_count_querycache_size(thd), 0); #endif - if (query_cache.try_lock()) + if (try_lock()) DBUG_VOID_RETURN; - query_block= ((Query_cache_block*) thd->net.query_cache_query); + query_block= query_cache_tls->first_query_block; if (query_block) { /* @@ -959,7 +978,7 @@ void query_cache_end_of_result(THD *thd) block, the writer should be dropped. */ thd_proc_info(thd, "storing result in query cache"); - DUMP(&query_cache); + DUMP(this); BLOCK_LOCK_WR(query_block); Query_cache_query *header= query_block->query(); Query_cache_block *last_result_block; @@ -976,8 +995,8 @@ void query_cache_end_of_result(THD *thd) and removed from QC. */ DBUG_ASSERT(0); - query_cache.free_query(query_block); - query_cache.unlock(); + free_query(query_block); + unlock(); DBUG_VOID_RETURN; } last_result_block= header->result()->prev; @@ -986,17 +1005,17 @@ void query_cache_end_of_result(THD *thd) if (last_result_block->length >= query_cache.min_allocation_unit + len) query_cache.split_block(last_result_block,len); - header->found_rows(current_thd->limit_found_rows); + header->found_rows(limit_found_rows); header->result()->type= Query_cache_block::RESULT; /* Drop the writer. */ header->writer(0); - thd->net.query_cache_query= 0; + query_cache_tls->first_query_block= NULL; BLOCK_UNLOCK_WR(query_block); - DBUG_EXECUTE("check_querycache",query_cache.check_integrity(1);); - + DBUG_EXECUTE("check_querycache", check_integrity(1);); } - query_cache.unlock(); + + unlock(); DBUG_VOID_RETURN; } @@ -1074,7 +1093,7 @@ ulong Query_cache::resize(ulong query_cache_size_arg) Drop the writer; this will cancel any attempts to store the processed statement associated with this writer. */ - query->writer()->query_cache_query= 0; + query->writer()->first_query_block= NULL; query->writer(0); refused++; } @@ -1230,7 +1249,7 @@ def_week_frmt: %lu, in_trans: %d, autocommit: %d", /* Check if another thread is processing the same query? */ Query_cache_block *competitor = (Query_cache_block *) - hash_search(&queries, (uchar*) thd->query, tot_length); + my_hash_search(&queries, (uchar*) thd->query, tot_length); DBUG_PRINT("qcache", ("competitor 0x%lx", (ulong) competitor)); if (competitor == 0) { @@ -1259,7 +1278,7 @@ def_week_frmt: %lu, in_trans: %d, autocommit: %d", { refused++; DBUG_PRINT("warning", ("tables list including failed")); - hash_delete(&queries, (uchar *) query_block); + my_hash_delete(&queries, (uchar *) query_block); header->unlock_n_destroy(); free_memory_block(query_block); unlock(); @@ -1268,8 +1287,8 @@ def_week_frmt: %lu, in_trans: %d, autocommit: %d", double_linked_list_simple_include(query_block, &queries_blocks); inserts++; queries_in_cache++; - net->query_cache_query= (uchar*) query_block; - header->writer(net); + thd->query_cache_tls.first_query_block= query_block; + header->writer(&thd->query_cache_tls); header->tables_type(tables_type); unlock(); @@ -1325,7 +1344,10 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length) { ulonglong engine_data; Query_cache_query *query; - Query_cache_block *first_result_block, *result_block; +#ifndef EMBEDDED_LIBRARY + Query_cache_block *first_result_block; +#endif + Query_cache_block *result_block; Query_cache_block_table *block_table, *block_table_end; ulong tot_length; Query_cache_query_flags flags; @@ -1396,12 +1418,6 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length) if (query_cache_size == 0) goto err_unlock; - /* - Check that we haven't forgot to reset the query cache variables; - make sure there are no attached query cache writer to this thread. - */ - DBUG_ASSERT(thd->net.query_cache_query == 0); - Query_cache_block *query_block; tot_length= query_length + thd->db_length + 1 + QUERY_CACHE_FLAGS_SIZE; @@ -1467,8 +1483,8 @@ def_week_frmt: %lu, in_trans: %d, autocommit: %d", (int)flags.autocommit)); memcpy((uchar *)(sql + (tot_length - QUERY_CACHE_FLAGS_SIZE)), (uchar*) &flags, QUERY_CACHE_FLAGS_SIZE); - query_block = (Query_cache_block *) hash_search(&queries, (uchar*) sql, - tot_length); + query_block = (Query_cache_block *) my_hash_search(&queries, (uchar*) sql, + tot_length); /* Quick abort on unlocked data */ if (query_block == 0 || query_block->query()->result() == 0 || @@ -1483,7 +1499,10 @@ def_week_frmt: %lu, in_trans: %d, autocommit: %d", BLOCK_LOCK_RD(query_block); query = query_block->query(); - result_block= first_result_block= query->result(); + result_block= query->result(); +#ifndef EMBEDDED_LIBRARY + first_result_block= result_block; +#endif if (result_block == 0 || result_block->type != Query_cache_block::RESULT) { @@ -2073,8 +2092,8 @@ ulong Query_cache::init_cache() DUMP(this); - VOID(hash_init(&queries, &my_charset_bin, def_query_hash_size, 0, 0, - query_cache_query_get_key, 0, 0)); + VOID(my_hash_init(&queries, &my_charset_bin, def_query_hash_size, 0, 0, + query_cache_query_get_key, 0, 0)); #ifndef FN_NO_CASE_SENCE /* If lower_case_table_names!=0 then db and table names are already @@ -2084,8 +2103,8 @@ ulong Query_cache::init_cache() lower_case_table_names == 0 then we should distinguish my_table and MY_TABLE cases and so again can use binary collation. */ - VOID(hash_init(&tables, &my_charset_bin, def_table_hash_size, 0, 0, - query_cache_table_get_key, 0, 0)); + VOID(my_hash_init(&tables, &my_charset_bin, def_table_hash_size, 0, 0, + query_cache_table_get_key, 0, 0)); #else /* On windows, OS/2, MacOS X with HFS+ or any other case insensitive @@ -2095,10 +2114,10 @@ ulong Query_cache::init_cache() file system) and so should use case insensitive collation for comparison. */ - VOID(hash_init(&tables, - lower_case_table_names ? &my_charset_bin : - files_charset_info, - def_table_hash_size, 0, 0,query_cache_table_get_key, 0, 0)); + VOID(my_hash_init(&tables, + lower_case_table_names ? &my_charset_bin : + files_charset_info, + def_table_hash_size, 0, 0,query_cache_table_get_key, 0, 0)); #endif queries_in_cache = 0; @@ -2148,8 +2167,8 @@ void Query_cache::free_cache() my_free((uchar*) cache, MYF(MY_ALLOW_ZERO_PTR)); make_disabled(); - hash_free(&queries); - hash_free(&tables); + my_hash_free(&queries); + my_hash_free(&tables); DBUG_VOID_RETURN; } @@ -2261,7 +2280,7 @@ void Query_cache::free_query_internal(Query_cache_block *query_block) if (query->writer() != 0) { /* Tell MySQL that this query should not be cached anymore */ - query->writer()->query_cache_query= 0; + query->writer()->first_query_block= NULL; query->writer(0); } double_linked_list_exclude(query_block, &queries_blocks); @@ -2324,7 +2343,7 @@ void Query_cache::free_query(Query_cache_block *query_block) (ulong) query_block, query_block->query()->length() )); - hash_delete(&queries,(uchar *) query_block); + my_hash_delete(&queries,(uchar *) query_block); free_query_internal(query_block); DBUG_VOID_RETURN; @@ -2653,7 +2672,7 @@ void Query_cache::invalidate_table_internal(THD *thd, uchar *key, uint32 key_length) { Query_cache_block *table_block= - (Query_cache_block*)hash_search(&tables, key, key_length); + (Query_cache_block*)my_hash_search(&tables, key, key_length); if (table_block) { Query_cache_block_table *list_root= table_block->table(0); @@ -2851,7 +2870,7 @@ Query_cache::insert_table(uint key_len, char *key, THD *thd= current_thd; Query_cache_block *table_block= - (Query_cache_block *)hash_search(&tables, (uchar*) key, key_len); + (Query_cache_block *) my_hash_search(&tables, (uchar*) key, key_len); if (table_block && table_block->table()->engine_data() != engine_data) @@ -2967,7 +2986,7 @@ void Query_cache::unlink_table(Query_cache_block_table *node) Query_cache_block *table_block= neighbour->block(); double_linked_list_exclude(table_block, &tables_blocks); - hash_delete(&tables,(uchar *) table_block); + my_hash_delete(&tables,(uchar *) table_block); free_memory_block(table_block); } DBUG_VOID_RETURN; @@ -3474,7 +3493,8 @@ Query_cache::process_and_count_tables(THD *thd, TABLE_LIST *tables_used, */ TABLE_COUNTER_TYPE -Query_cache::is_cacheable(THD *thd, uint32 query_len, char *query, LEX *lex, +Query_cache::is_cacheable(THD *thd, size_t query_len, const char *query, + LEX *lex, TABLE_LIST *tables_used, uint8 *tables_type) { TABLE_COUNTER_TYPE table_count; @@ -3651,7 +3671,7 @@ my_bool Query_cache::move_by_type(uchar **border, uchar *key; size_t key_length; key=query_cache_table_get_key((uchar*) block, &key_length, 0); - hash_first(&tables, (uchar*) key, key_length, &record_idx); + my_hash_first(&tables, (uchar*) key, key_length, &record_idx); block->destroy(); new_block->init(len); @@ -3685,7 +3705,7 @@ my_bool Query_cache::move_by_type(uchar **border, /* Fix pointer to table name */ new_block->table()->table(new_block->table()->db() + tablename_offset); /* Fix hash to point at moved block */ - hash_replace(&tables, &record_idx, (uchar*) new_block); + my_hash_replace(&tables, &record_idx, (uchar*) new_block); DBUG_PRINT("qcache", ("moved %lu bytes to 0x%lx, new gap at 0x%lx", len, (ulong) new_block, (ulong) *border)); @@ -3711,7 +3731,7 @@ my_bool Query_cache::move_by_type(uchar **border, uchar *key; size_t key_length; key=query_cache_query_get_key((uchar*) block, &key_length, 0); - hash_first(&queries, (uchar*) key, key_length, &record_idx); + my_hash_first(&queries, (uchar*) key, key_length, &record_idx); // Move table of used tables memmove((char*) new_block->table(0), (char*) block->table(0), ALIGN_SIZE(n_tables*sizeof(Query_cache_block_table))); @@ -3773,13 +3793,13 @@ my_bool Query_cache::move_by_type(uchar **border, If someone is writing to this block, inform the writer that the block has been moved. */ - NET *net = new_block->query()->writer(); - if (net != 0) + Query_cache_tls *query_cache_tls= new_block->query()->writer(); + if (query_cache_tls != NULL) { - net->query_cache_query= (uchar*) new_block; + query_cache_tls->first_query_block= new_block; } /* Fix hash to point at moved block */ - hash_replace(&queries, &record_idx, (uchar*) new_block); + my_hash_replace(&queries, &record_idx, (uchar*) new_block); DBUG_PRINT("qcache", ("moved %lu bytes to 0x%lx, new gap at 0x%lx", len, (ulong) new_block, (ulong) *border)); break; @@ -4190,13 +4210,13 @@ my_bool Query_cache::check_integrity(bool locked) if (!locked) lock_and_suspend(); - if (hash_check(&queries)) + if (my_hash_check(&queries)) { DBUG_PRINT("error", ("queries hash is damaged")); result = 1; } - if (hash_check(&tables)) + if (my_hash_check(&tables)) { DBUG_PRINT("error", ("tables hash is damaged")); result = 1; @@ -4363,7 +4383,7 @@ my_bool Query_cache::check_integrity(bool locked) (ulong) block, (uint) block->type)); size_t length; uchar *key = query_cache_query_get_key((uchar*) block, &length, 0); - uchar* val = hash_search(&queries, key, length); + uchar* val = my_hash_search(&queries, key, length); if (((uchar*)block) != val) { DBUG_PRINT("error", ("block 0x%lx found in queries hash like 0x%lx", @@ -4398,7 +4418,7 @@ my_bool Query_cache::check_integrity(bool locked) (ulong) block, (uint) block->type)); size_t length; uchar *key = query_cache_table_get_key((uchar*) block, &length, 0); - uchar* val = hash_search(&tables, key, length); + uchar* val = my_hash_search(&tables, key, length); if (((uchar*)block) != val) { DBUG_PRINT("error", ("block 0x%lx found in tables hash like 0x%lx", diff --git a/sql/sql_cache.h b/sql/sql_cache.h index 777ddd39280..5a5f936c188 100644 --- a/sql/sql_cache.h +++ b/sql/sql_cache.h @@ -64,6 +64,8 @@ struct Query_cache_table; struct Query_cache_query; struct Query_cache_result; class Query_cache; +struct Query_cache_tls; +struct LEX; /** This class represents a node in the linked chain of queries @@ -137,7 +139,7 @@ struct Query_cache_query ulonglong limit_found_rows; rw_lock_t lock; Query_cache_block *res; - NET *wri; + Query_cache_tls *wri; ulong len; uint8 tbls_type; unsigned int last_pkt_nr; @@ -149,8 +151,8 @@ struct Query_cache_query inline void found_rows(ulonglong rows) { limit_found_rows= rows; } inline Query_cache_block *result() { return res; } inline void result(Query_cache_block *p) { res= p; } - inline NET *writer() { return wri; } - inline void writer(NET *p) { wri= p; } + inline Query_cache_tls *writer() { return wri; } + inline void writer(Query_cache_tls *p) { wri= p; } inline uint8 tables_type() { return tbls_type; } inline void tables_type(uint8 type) { tbls_type= type; } inline ulong length() { return len; } @@ -407,7 +409,8 @@ protected: If query is cacheable return number tables in query (query without tables not cached) */ - TABLE_COUNTER_TYPE is_cacheable(THD *thd, uint32 query_len, char *query, + TABLE_COUNTER_TYPE is_cacheable(THD *thd, size_t query_len, + const char *query, LEX *lex, TABLE_LIST *tables_used, uint8 *tables_type); TABLE_COUNTER_TYPE process_and_count_tables(THD *thd, @@ -462,10 +465,13 @@ protected: void destroy(); - friend void query_cache_init_query(NET *net); - friend void query_cache_insert(NET *net, const char *packet, ulong length); - friend void query_cache_end_of_result(THD *thd); - friend void query_cache_abort(NET *net); + void insert(Query_cache_tls *query_cache_tls, + const char *packet, + ulong length, + unsigned pkt_nr); + + void end_of_result(THD *thd); + void abort(Query_cache_tls *query_cache_tls); /* The following functions are only used when debugging @@ -493,9 +499,4 @@ protected: extern Query_cache query_cache; extern TYPELIB query_cache_type_typelib; -void query_cache_init_query(NET *net); -void query_cache_insert(NET *net, const char *packet, ulong length); -void query_cache_end_of_result(THD *thd); -void query_cache_abort(NET *net); - #endif diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 01a1fff3048..456ff0cb3c5 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -90,7 +90,9 @@ extern "C" void free_user_var(user_var_entry *entry) bool Key_part_spec::operator==(const Key_part_spec& other) const { - return length == other.length && !strcmp(field_name, other.field_name); + return length == other.length && + !my_strcasecmp(system_charset_info, field_name.str, + other.field_name.str); } /** @@ -257,7 +259,7 @@ const char *set_thd_proc_info(THD *thd, const char *info, const char *old_info= thd->proc_info; DBUG_PRINT("proc_info", ("%s:%d %s", calling_file, calling_line, (info != NULL) ? info : "(null)")); -#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER) +#if defined(ENABLED_PROFILING) thd->profiling.status_change(info, calling_function, calling_file, calling_line); #endif thd->proc_info= info; @@ -463,7 +465,7 @@ THD::THD() killed= NOT_KILLED; col_access=0; is_slave_error= thread_specific_used= FALSE; - hash_clear(&handler_tables_hash); + my_hash_clear(&handler_tables_hash); tmp_table=0; used_tables=0; cuted_fields= 0L; @@ -499,9 +501,6 @@ THD::THD() net.vio=0; #endif client_capabilities= 0; // minimalistic client -#ifdef HAVE_QUERY_CACHE - query_cache_init_query(&net); // If error on boot -#endif ull=0; system_thread= NON_SYSTEM_THREAD; cleanup_done= abort_on_warning= no_warnings_for_error= 0; @@ -522,13 +521,13 @@ THD::THD() *scramble= '\0'; init(); -#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER) +#if defined(ENABLED_PROFILING) profiling.set_thd(this); #endif user_connect=(USER_CONN *)0; - hash_init(&user_vars, system_charset_info, USER_VARS_HASH_SIZE, 0, 0, - (hash_get_key) get_var_key, - (hash_free_key) free_user_var, 0); + my_hash_init(&user_vars, system_charset_info, USER_VARS_HASH_SIZE, 0, 0, + (my_hash_get_key) get_var_key, + (my_hash_free_key) free_user_var, 0); sp_proc_cache= NULL; sp_func_cache= NULL; @@ -794,7 +793,7 @@ THD::raise_condition_no_handler(uint sql_errno, MYSQL_ERROR *cond= NULL; DBUG_ENTER("THD::raise_condition_no_handler"); - query_cache_abort(& net); + query_cache_abort(&query_cache_tls); /* FIXME: broken special case */ if (no_warnings_for_error && (level == MYSQL_ERROR::WARN_LEVEL_ERROR)) @@ -943,9 +942,9 @@ void THD::change_user(void) cleanup_done= 0; init(); stmt_map.reset(); - hash_init(&user_vars, system_charset_info, USER_VARS_HASH_SIZE, 0, 0, - (hash_get_key) get_var_key, - (hash_free_key) free_user_var, 0); + my_hash_init(&user_vars, system_charset_info, USER_VARS_HASH_SIZE, 0, 0, + (my_hash_get_key) get_var_key, + (my_hash_free_key) free_user_var, 0); sp_cache_clear(&sp_proc_cache); sp_cache_clear(&sp_func_cache); } @@ -976,7 +975,7 @@ void THD::cleanup(void) } mysql_ha_cleanup(this); delete_dynamic(&user_var_events); - hash_free(&user_vars); + my_hash_free(&user_vars); close_temporary_tables(this); my_free((char*) variables.time_format, MYF(MY_ALLOW_ZERO_PTR)); my_free((char*) variables.date_format, MYF(MY_ALLOW_ZERO_PTR)); @@ -2603,12 +2602,12 @@ Statement_map::Statement_map() : START_STMT_HASH_SIZE = 16, START_NAME_HASH_SIZE = 16 }; - hash_init(&st_hash, &my_charset_bin, START_STMT_HASH_SIZE, 0, 0, - get_statement_id_as_hash_key, - delete_statement_as_hash_key, MYF(0)); - hash_init(&names_hash, system_charset_info, START_NAME_HASH_SIZE, 0, 0, - (hash_get_key) get_stmt_name_hash_key, - NULL,MYF(0)); + my_hash_init(&st_hash, &my_charset_bin, START_STMT_HASH_SIZE, 0, 0, + get_statement_id_as_hash_key, + delete_statement_as_hash_key, MYF(0)); + my_hash_init(&names_hash, system_charset_info, START_NAME_HASH_SIZE, 0, 0, + (my_hash_get_key) get_stmt_name_hash_key, + NULL,MYF(0)); } @@ -2673,9 +2672,9 @@ int Statement_map::insert(THD *thd, Statement *statement) err_max: if (statement->name.str) - hash_delete(&names_hash, (uchar*) statement); + my_hash_delete(&names_hash, (uchar*) statement); err_names_hash: - hash_delete(&st_hash, (uchar*) statement); + my_hash_delete(&st_hash, (uchar*) statement); err_st_hash: return 1; } @@ -2696,9 +2695,9 @@ void Statement_map::erase(Statement *statement) if (statement == last_found_statement) last_found_statement= 0; if (statement->name.str) - hash_delete(&names_hash, (uchar *) statement); + my_hash_delete(&names_hash, (uchar *) statement); - hash_delete(&st_hash, (uchar *) statement); + my_hash_delete(&st_hash, (uchar *) statement); pthread_mutex_lock(&LOCK_prepared_stmt_count); DBUG_ASSERT(prepared_stmt_count > 0); prepared_stmt_count--; @@ -2728,8 +2727,8 @@ Statement_map::~Statement_map() prepared_stmt_count-= st_hash.records; pthread_mutex_unlock(&LOCK_prepared_stmt_count); - hash_free(&names_hash); - hash_free(&st_hash); + my_hash_free(&names_hash); + my_hash_free(&st_hash); } bool select_dumpvar::send_data(List<Item> &items) @@ -3266,15 +3265,15 @@ void xid_free_hash(void *ptr) bool xid_cache_init() { pthread_mutex_init(&LOCK_xid_cache, MY_MUTEX_INIT_FAST); - return hash_init(&xid_cache, &my_charset_bin, 100, 0, 0, - xid_get_hash_key, xid_free_hash, 0) != 0; + return my_hash_init(&xid_cache, &my_charset_bin, 100, 0, 0, + xid_get_hash_key, xid_free_hash, 0) != 0; } void xid_cache_free() { - if (hash_inited(&xid_cache)) + if (my_hash_inited(&xid_cache)) { - hash_free(&xid_cache); + my_hash_free(&xid_cache); pthread_mutex_destroy(&LOCK_xid_cache); } } @@ -3282,7 +3281,8 @@ void xid_cache_free() XID_STATE *xid_cache_search(XID *xid) { pthread_mutex_lock(&LOCK_xid_cache); - XID_STATE *res=(XID_STATE *)hash_search(&xid_cache, xid->key(), xid->key_length()); + XID_STATE *res=(XID_STATE *)my_hash_search(&xid_cache, xid->key(), + xid->key_length()); pthread_mutex_unlock(&LOCK_xid_cache); return res; } @@ -3293,7 +3293,7 @@ bool xid_cache_insert(XID *xid, enum xa_states xa_state) XID_STATE *xs; my_bool res; pthread_mutex_lock(&LOCK_xid_cache); - if (hash_search(&xid_cache, xid->key(), xid->key_length())) + if (my_hash_search(&xid_cache, xid->key(), xid->key_length())) res=0; else if (!(xs=(XID_STATE *)my_malloc(sizeof(*xs), MYF(MY_WME)))) res=1; @@ -3312,8 +3312,8 @@ bool xid_cache_insert(XID *xid, enum xa_states xa_state) bool xid_cache_insert(XID_STATE *xid_state) { pthread_mutex_lock(&LOCK_xid_cache); - DBUG_ASSERT(hash_search(&xid_cache, xid_state->xid.key(), - xid_state->xid.key_length())==0); + DBUG_ASSERT(my_hash_search(&xid_cache, xid_state->xid.key(), + xid_state->xid.key_length())==0); my_bool res=my_hash_insert(&xid_cache, (uchar*)xid_state); pthread_mutex_unlock(&LOCK_xid_cache); return res; @@ -3323,7 +3323,7 @@ bool xid_cache_insert(XID_STATE *xid_state) void xid_cache_delete(XID_STATE *xid_state) { pthread_mutex_lock(&LOCK_xid_cache); - hash_delete(&xid_cache, (uchar *)xid_state); + my_hash_delete(&xid_cache, (uchar *)xid_state); pthread_mutex_unlock(&LOCK_xid_cache); } diff --git a/sql/sql_class.h b/sql/sql_class.h index 4874801e380..558de19b7af 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -145,9 +145,14 @@ typedef struct st_copy_info { class Key_part_spec :public Sql_alloc { public: - const char *field_name; + LEX_STRING field_name; uint length; - Key_part_spec(const char *name,uint len=0) :field_name(name), length(len) {} + Key_part_spec(const LEX_STRING &name, uint len) + : field_name(name), length(len) + {} + Key_part_spec(const char *name, const size_t name_len, uint len) + : length(len) + { field_name.str= (char *)name; field_name.length= name_len; } bool operator==(const Key_part_spec& other) const; /** Construct a copy of this Key_part_spec. field_name is copied @@ -200,15 +205,24 @@ public: enum Keytype type; KEY_CREATE_INFO key_create_info; List<Key_part_spec> columns; - const char *name; + LEX_STRING name; bool generated; - Key(enum Keytype type_par, const char *name_arg, + Key(enum Keytype type_par, const LEX_STRING &name_arg, KEY_CREATE_INFO *key_info_arg, bool generated_arg, List<Key_part_spec> &cols) :type(type_par), key_create_info(*key_info_arg), columns(cols), name(name_arg), generated(generated_arg) {} + Key(enum Keytype type_par, const char *name_arg, size_t name_len_arg, + KEY_CREATE_INFO *key_info_arg, bool generated_arg, + List<Key_part_spec> &cols) + :type(type_par), key_create_info(*key_info_arg), columns(cols), + generated(generated_arg) + { + name.str= (char *)name_arg; + name.length= name_len_arg; + } Key(const Key &rhs, MEM_ROOT *mem_root); virtual ~Key() {} /* Equality comparison of keys (ignoring name) */ @@ -233,7 +247,7 @@ public: Table_ident *ref_table; List<Key_part_spec> ref_columns; uint delete_opt, update_opt, match_opt; - Foreign_key(const char *name_arg, List<Key_part_spec> &cols, + Foreign_key(const LEX_STRING &name_arg, List<Key_part_spec> &cols, Table_ident *table, List<Key_part_spec> &ref_cols, uint delete_opt_arg, uint update_opt_arg, uint match_opt_arg) :Key(FOREIGN_KEY, name_arg, &default_key_create_info, 0, cols), @@ -266,6 +280,27 @@ public: LEX_COLUMN (const String& x,const uint& y ): column (x),rights (y) {} }; +/** + Query_cache_tls -- query cache thread local data. +*/ + +struct Query_cache_block; + +struct Query_cache_tls +{ + /* + 'first_query_block' should be accessed only via query cache + functions and methods to maintain proper locking. + */ + Query_cache_block *first_query_block; + void set_first_query_block(Query_cache_block *first_query_block_arg) + { + first_query_block= first_query_block_arg; + } + + Query_cache_tls() :first_query_block(NULL) {} +}; + /* SIGNAL / RESIGNAL / GET DIAGNOSTICS */ /** @@ -737,8 +772,8 @@ public: Statement *find_by_name(LEX_STRING *name) { Statement *stmt; - stmt= (Statement*)hash_search(&names_hash, (uchar*)name->str, - name->length); + stmt= (Statement*)my_hash_search(&names_hash, (uchar*)name->str, + name->length); return stmt; } @@ -747,7 +782,7 @@ public: if (last_found_statement == 0 || id != last_found_statement->id) { Statement *stmt; - stmt= (Statement *) hash_search(&st_hash, (uchar *) &id, sizeof(id)); + stmt= (Statement *) my_hash_search(&st_hash, (uchar *) &id, sizeof(id)); if (stmt && stmt->name.str) return NULL; last_found_statement= stmt; @@ -1226,6 +1261,9 @@ public: */ struct st_mysql_stmt *current_stmt; #endif +#ifdef HAVE_QUERY_CACHE + Query_cache_tls query_cache_tls; +#endif NET net; // client connection descriptor Protocol *protocol; // Current protocol Protocol_text protocol_text; // Normal protocol @@ -1644,7 +1682,7 @@ public: CHARSET_INFO *db_charset; Warning_info *warning_info; Diagnostics_area *stmt_da; -#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER) +#if defined(ENABLED_PROFILING) PROFILING profiling; #endif diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index 4ae267a880c..6ff5e8666d7 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -61,7 +61,7 @@ static int get_or_create_user_conn(THD *thd, const char *user, user_len= strlen(user); temp_len= (strmov(strmov(temp_user, user)+1, host) - temp_user)+1; (void) pthread_mutex_lock(&LOCK_user_conn); - if (!(uc = (struct user_conn *) hash_search(&hash_user_connections, + if (!(uc = (struct user_conn *) my_hash_search(&hash_user_connections, (uchar*) temp_user, temp_len))) { /* First connection for user; Create a user connection object */ @@ -151,7 +151,15 @@ int check_for_max_user_connections(THD *thd, USER_CONN *uc) end: if (error) + { uc->connections--; // no need for decrease_user_connections() here + /* + The thread may returned back to the pool and assigned to a user + that doesn't have a limit. Ensure the user is not using resources + of someone else. + */ + thd->user_connect= NULL; + } (void) pthread_mutex_unlock(&LOCK_user_conn); DBUG_RETURN(error); } @@ -183,7 +191,7 @@ void decrease_user_connections(USER_CONN *uc) if (!--uc->connections && !mqh_used) { /* Last connection for user; Delete it */ - (void) hash_delete(&hash_user_connections,(uchar*) uc); + (void) my_hash_delete(&hash_user_connections,(uchar*) uc); } (void) pthread_mutex_unlock(&LOCK_user_conn); DBUG_VOID_RETURN; @@ -462,7 +470,10 @@ check_user(THD *thd, enum enum_server_command command, { /* mysql_change_db() has pushed the error message. */ if (thd->user_connect) + { decrease_user_connections(thd->user_connect); + thd->user_connect= 0; + } DBUG_RETURN(1); } } @@ -513,10 +524,10 @@ extern "C" void free_user(struct user_conn *uc) void init_max_user_conn(void) { #ifndef NO_EMBEDDED_ACCESS_CHECKS - (void) hash_init(&hash_user_connections,system_charset_info,max_connections, - 0,0, - (hash_get_key) get_key_conn, (hash_free_key) free_user, - 0); + (void) + my_hash_init(&hash_user_connections,system_charset_info,max_connections, + 0,0, (my_hash_get_key) get_key_conn, + (my_hash_free_key) free_user, 0); #endif } @@ -524,7 +535,7 @@ void init_max_user_conn(void) void free_max_user_conn(void) { #ifndef NO_EMBEDDED_ACCESS_CHECKS - hash_free(&hash_user_connections); + my_hash_free(&hash_user_connections); #endif /* NO_EMBEDDED_ACCESS_CHECKS */ } @@ -542,8 +553,9 @@ void reset_mqh(LEX_USER *lu, bool get_them= 0) memcpy(temp_user,lu->user.str,lu->user.length); memcpy(temp_user+lu->user.length+1,lu->host.str,lu->host.length); temp_user[lu->user.length]='\0'; temp_user[temp_len-1]=0; - if ((uc = (struct user_conn *) hash_search(&hash_user_connections, - (uchar*) temp_user, temp_len))) + if ((uc = (struct user_conn *) my_hash_search(&hash_user_connections, + (uchar*) temp_user, + temp_len))) { uc->questions=0; get_mqh(temp_user,&temp_user[lu->user.length+1],uc); @@ -556,8 +568,8 @@ void reset_mqh(LEX_USER *lu, bool get_them= 0) /* for FLUSH PRIVILEGES and FLUSH USER_RESOURCES */ for (uint idx=0;idx < hash_user_connections.records; idx++) { - USER_CONN *uc=(struct user_conn *) hash_element(&hash_user_connections, - idx); + USER_CONN *uc=(struct user_conn *) + my_hash_element(&hash_user_connections, idx); if (get_them) get_mqh(uc->user,uc->host,uc); uc->questions=0; @@ -975,7 +987,15 @@ static void end_connection(THD *thd) NET *net= &thd->net; plugin_thdvar_cleanup(thd); if (thd->user_connect) + { decrease_user_connections(thd->user_connect); + /* + The thread may returned back to the pool and assigned to a user + that doesn't have a limit. Ensure the user is not using resources + of someone else. + */ + thd->user_connect= NULL; + } if (thd->killed || net->error && net->vio != 0) { diff --git a/sql/sql_db.cc b/sql/sql_db.cc index bcc8fcf54fc..389c772aa75 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -105,8 +105,8 @@ static my_bool lock_db_insert(const char *dbname, uint length) safe_mutex_assert_owner(&LOCK_lock_db); - if (!(opt= (my_dblock_t*) hash_search(&lock_db_cache, - (uchar*) dbname, length))) + if (!(opt= (my_dblock_t*) my_hash_search(&lock_db_cache, + (uchar*) dbname, length))) { /* Db is not in the hash, insert it */ char *tmp_name; @@ -139,9 +139,9 @@ void lock_db_delete(const char *name, uint length) { my_dblock_t *opt; safe_mutex_assert_owner(&LOCK_lock_db); - if ((opt= (my_dblock_t *)hash_search(&lock_db_cache, - (const uchar*) name, length))) - hash_delete(&lock_db_cache, (uchar*) opt); + if ((opt= (my_dblock_t *)my_hash_search(&lock_db_cache, + (const uchar*) name, length))) + my_hash_delete(&lock_db_cache, (uchar*) opt); } @@ -221,14 +221,14 @@ bool my_database_names_init(void) if (!dboptions_init) { dboptions_init= 1; - error= hash_init(&dboptions, lower_case_table_names ? - &my_charset_bin : system_charset_info, - 32, 0, 0, (hash_get_key) dboptions_get_key, - free_dbopt,0) || - hash_init(&lock_db_cache, lower_case_table_names ? - &my_charset_bin : system_charset_info, - 32, 0, 0, (hash_get_key) lock_db_get_key, - lock_db_free_element,0); + error= my_hash_init(&dboptions, lower_case_table_names ? + &my_charset_bin : system_charset_info, + 32, 0, 0, (my_hash_get_key) dboptions_get_key, + free_dbopt,0) || + my_hash_init(&lock_db_cache, lower_case_table_names ? + &my_charset_bin : system_charset_info, + 32, 0, 0, (my_hash_get_key) lock_db_get_key, + lock_db_free_element,0); } return error; @@ -245,9 +245,9 @@ void my_database_names_free(void) if (dboptions_init) { dboptions_init= 0; - hash_free(&dboptions); + my_hash_free(&dboptions); (void) rwlock_destroy(&LOCK_dboptions); - hash_free(&lock_db_cache); + my_hash_free(&lock_db_cache); } } @@ -259,11 +259,11 @@ void my_database_names_free(void) void my_dbopt_cleanup(void) { rw_wrlock(&LOCK_dboptions); - hash_free(&dboptions); - hash_init(&dboptions, lower_case_table_names ? - &my_charset_bin : system_charset_info, - 32, 0, 0, (hash_get_key) dboptions_get_key, - free_dbopt,0); + my_hash_free(&dboptions); + my_hash_init(&dboptions, lower_case_table_names ? + &my_charset_bin : system_charset_info, + 32, 0, 0, (my_hash_get_key) dboptions_get_key, + free_dbopt,0); rw_unlock(&LOCK_dboptions); } @@ -289,7 +289,7 @@ static my_bool get_dbopt(const char *dbname, HA_CREATE_INFO *create) length= (uint) strlen(dbname); rw_rdlock(&LOCK_dboptions); - if ((opt= (my_dbopt_t*) hash_search(&dboptions, (uchar*) dbname, length))) + if ((opt= (my_dbopt_t*) my_hash_search(&dboptions, (uchar*) dbname, length))) { create->default_table_charset= opt->charset; error= 0; @@ -321,7 +321,8 @@ static my_bool put_dbopt(const char *dbname, HA_CREATE_INFO *create) length= (uint) strlen(dbname); rw_wrlock(&LOCK_dboptions); - if (!(opt= (my_dbopt_t*) hash_search(&dboptions, (uchar*) dbname, length))) + if (!(opt= (my_dbopt_t*) my_hash_search(&dboptions, (uchar*) dbname, + length))) { /* Options are not in the hash, insert them */ char *tmp_name; @@ -361,9 +362,9 @@ void del_dbopt(const char *path) { my_dbopt_t *opt; rw_wrlock(&LOCK_dboptions); - if ((opt= (my_dbopt_t *)hash_search(&dboptions, (const uchar*) path, - strlen(path)))) - hash_delete(&dboptions, (uchar*) opt); + if ((opt= (my_dbopt_t *)my_hash_search(&dboptions, (const uchar*) path, + strlen(path)))) + my_hash_delete(&dboptions, (uchar*) opt); rw_unlock(&LOCK_dboptions); } @@ -1027,7 +1028,7 @@ exit: SELECT DATABASE() in the future). For this we free() thd->db and set it to 0. */ - if (thd->db && !strcmp(thd->db, db)) + if (thd->db && !strcmp(thd->db, db) && error == 0) mysql_change_db_impl(thd, NULL, 0, thd->variables.collation_server); VOID(pthread_mutex_unlock(&LOCK_mysql_create_db)); start_waiting_global_read_lock(thd); @@ -1719,8 +1720,8 @@ lock_databases(THD *thd, const char *db1, uint length1, { pthread_mutex_lock(&LOCK_lock_db); while (!thd->killed && - (hash_search(&lock_db_cache,(uchar*) db1, length1) || - hash_search(&lock_db_cache,(uchar*) db2, length2))) + (my_hash_search(&lock_db_cache,(uchar*) db1, length1) || + my_hash_search(&lock_db_cache,(uchar*) db2, length2))) { wait_for_condition(thd, &LOCK_lock_db, &COND_refresh); pthread_mutex_lock(&LOCK_lock_db); diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index 1e92d95573a..ae07e648921 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -207,21 +207,21 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen) DBUG_RETURN(TRUE); } - if (! hash_inited(&thd->handler_tables_hash)) + if (! my_hash_inited(&thd->handler_tables_hash)) { /* HASH entries are of type TABLE_LIST. */ - if (hash_init(&thd->handler_tables_hash, &my_charset_latin1, - HANDLER_TABLES_HASH_SIZE, 0, 0, - (hash_get_key) mysql_ha_hash_get_key, - (hash_free_key) mysql_ha_hash_free, 0)) + if (my_hash_init(&thd->handler_tables_hash, &my_charset_latin1, + HANDLER_TABLES_HASH_SIZE, 0, 0, + (my_hash_get_key) mysql_ha_hash_get_key, + (my_hash_free_key) mysql_ha_hash_free, 0)) goto err; } else if (! reopen) /* Otherwise we have 'tables' already. */ { - if (hash_search(&thd->handler_tables_hash, (uchar*) tables->alias, - strlen(tables->alias) + 1)) + if (my_hash_search(&thd->handler_tables_hash, (uchar*) tables->alias, + strlen(tables->alias) + 1)) { DBUG_PRINT("info",("duplicate '%s'", tables->alias)); my_error(ER_NONUNIQ_TABLE, MYF(0), tables->alias); @@ -367,12 +367,12 @@ bool mysql_ha_close(THD *thd, TABLE_LIST *tables) DBUG_PRINT("enter",("'%s'.'%s' as '%s'", tables->db, tables->table_name, tables->alias)); - if ((hash_tables= (TABLE_LIST*) hash_search(&thd->handler_tables_hash, - (uchar*) tables->alias, - strlen(tables->alias) + 1))) + if ((hash_tables= (TABLE_LIST*) my_hash_search(&thd->handler_tables_hash, + (uchar*) tables->alias, + strlen(tables->alias) + 1))) { mysql_ha_close_table(thd, hash_tables, FALSE); - hash_delete(&thd->handler_tables_hash, (uchar*) hash_tables); + my_hash_delete(&thd->handler_tables_hash, (uchar*) hash_tables); } else { @@ -439,9 +439,9 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables, it++; retry: - if ((hash_tables= (TABLE_LIST*) hash_search(&thd->handler_tables_hash, - (uchar*) tables->alias, - strlen(tables->alias) + 1))) + if ((hash_tables= (TABLE_LIST*) my_hash_search(&thd->handler_tables_hash, + (uchar*) tables->alias, + strlen(tables->alias) + 1))) { table= hash_tables->table; DBUG_PRINT("info-in-hash",("'%s'.'%s' as '%s' table: 0x%lx", @@ -719,7 +719,7 @@ static TABLE_LIST *mysql_ha_find(THD *thd, TABLE_LIST *tables) /* search for all handlers with matching table names */ for (uint i= 0; i < thd->handler_tables_hash.records; i++) { - hash_tables= (TABLE_LIST*) hash_element(&thd->handler_tables_hash, i); + hash_tables= (TABLE_LIST*) my_hash_element(&thd->handler_tables_hash, i); for (tables= first; tables; tables= tables->next_local) { if ((! *tables->db || @@ -763,7 +763,7 @@ void mysql_ha_rm_tables(THD *thd, TABLE_LIST *tables, bool is_locked) next= hash_tables->next_local; if (hash_tables->table) mysql_ha_close_table(thd, hash_tables, is_locked); - hash_delete(&thd->handler_tables_hash, (uchar*) hash_tables); + my_hash_delete(&thd->handler_tables_hash, (uchar*) hash_tables); hash_tables= next; } @@ -789,7 +789,7 @@ void mysql_ha_flush(THD *thd) for (uint i= 0; i < thd->handler_tables_hash.records; i++) { - hash_tables= (TABLE_LIST*) hash_element(&thd->handler_tables_hash, i); + hash_tables= (TABLE_LIST*) my_hash_element(&thd->handler_tables_hash, i); if (hash_tables->table && hash_tables->table->needs_reopen_or_name_lock()) mysql_ha_close_table(thd, hash_tables, TRUE); } @@ -813,12 +813,12 @@ void mysql_ha_cleanup(THD *thd) for (uint i= 0; i < thd->handler_tables_hash.records; i++) { - hash_tables= (TABLE_LIST*) hash_element(&thd->handler_tables_hash, i); + hash_tables= (TABLE_LIST*) my_hash_element(&thd->handler_tables_hash, i); if (hash_tables->table) mysql_ha_close_table(thd, hash_tables, FALSE); - } + } - hash_free(&thd->handler_tables_hash); + my_hash_free(&thd->handler_tables_hash); DBUG_VOID_RETURN; } diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 1ef4d5827ec..e9b8254aeb3 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -2729,6 +2729,12 @@ bool Delayed_insert::handle_inserts(void) thread_safe_increment(delayed_insert_writes,&LOCK_delayed_status); pthread_mutex_lock(&mutex); + /* + Reset the table->auto_increment_field_not_null as it is valid for + only one row. + */ + table->auto_increment_field_not_null= FALSE; + delete row; /* Let READ clients do something once in a while @@ -3837,6 +3843,7 @@ void select_create::abort() { table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY); table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE); + table->auto_increment_field_not_null= FALSE; if (!create_info->table_existed) drop_open_table(thd, table, create_table->db, create_table->table_name); table=0; // Safety diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 2adbc44eb12..61c8e8d123a 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -31,7 +31,13 @@ sys_var *trg_new_row_fake_var= (sys_var*) 0x01; +/** + LEX_STRING constant for null-string to be used in parser and other places. +*/ +const LEX_STRING null_lex_str= {NULL, 0}; + /* Longest standard keyword name */ + #define TOCK_NAME_LENGTH 24 /* @@ -2091,7 +2097,7 @@ void st_select_lex::print_limit(THD *thd, to implement the clean up. */ -void st_lex::cleanup_lex_after_parse_error(THD *thd) +void LEX::cleanup_lex_after_parse_error(THD *thd) { /* Delete sphead for the side effect of restoring of the original @@ -2150,7 +2156,7 @@ void Query_tables_list::reset_query_tables_list(bool init) We delay real initialization of hash (and therefore related memory allocation) until first insertion into this hash. */ - hash_clear(&sroutines); + my_hash_clear(&sroutines); } else if (sroutines.records) { @@ -2173,7 +2179,7 @@ void Query_tables_list::reset_query_tables_list(bool init) void Query_tables_list::destroy_query_tables_list() { - hash_free(&sroutines); + my_hash_free(&sroutines); } @@ -2181,7 +2187,7 @@ void Query_tables_list::destroy_query_tables_list() Initialize LEX object. SYNOPSIS - st_lex::st_lex() + LEX::LEX() NOTE LEX object initialized with this constructor can be used as part of @@ -2191,7 +2197,7 @@ void Query_tables_list::destroy_query_tables_list() for this. */ -st_lex::st_lex() +LEX::LEX() :result(0), sql_command(SQLCOM_END), option_type(OPT_DEFAULT), is_lex_started(0) { @@ -2208,7 +2214,7 @@ st_lex::st_lex() Check whether the merging algorithm can be used on this VIEW SYNOPSIS - st_lex::can_be_merged() + LEX::can_be_merged() DESCRIPTION We can apply merge algorithm if it is single SELECT view with @@ -2222,7 +2228,7 @@ st_lex::st_lex() TRUE - merge algorithm can be used */ -bool st_lex::can_be_merged() +bool LEX::can_be_merged() { // TODO: do not forget implement case when select_lex.table_list.elements==0 @@ -2259,19 +2265,19 @@ bool st_lex::can_be_merged() check if command can use VIEW with MERGE algorithm (for top VIEWs) SYNOPSIS - st_lex::can_use_merged() + LEX::can_use_merged() DESCRIPTION Only listed here commands can use merge algorithm in top level SELECT_LEX (for subqueries will be used merge algorithm if - st_lex::can_not_use_merged() is not TRUE). + LEX::can_not_use_merged() is not TRUE). RETURN FALSE - command can't use merged VIEWs TRUE - VIEWs with MERGE algorithms can be used */ -bool st_lex::can_use_merged() +bool LEX::can_use_merged() { switch (sql_command) { @@ -2296,18 +2302,18 @@ bool st_lex::can_use_merged() Check if command can't use merged views in any part of command SYNOPSIS - st_lex::can_not_use_merged() + LEX::can_not_use_merged() DESCRIPTION Temporary table algorithm will be used on all SELECT levels for queries - listed here (see also st_lex::can_use_merged()). + listed here (see also LEX::can_use_merged()). RETURN FALSE - command can't use merged VIEWs TRUE - VIEWs with MERGE algorithms can be used */ -bool st_lex::can_not_use_merged() +bool LEX::can_not_use_merged() { switch (sql_command) { @@ -2336,7 +2342,7 @@ bool st_lex::can_not_use_merged() FALSE no, we need data */ -bool st_lex::only_view_structure() +bool LEX::only_view_structure() { switch (sql_command) { case SQLCOM_SHOW_CREATE: @@ -2365,7 +2371,7 @@ bool st_lex::only_view_structure() */ -bool st_lex::need_correct_ident() +bool LEX::need_correct_ident() { switch(sql_command) { @@ -2395,7 +2401,7 @@ bool st_lex::need_correct_ident() VIEW_CHECK_CASCADED CHECK OPTION CASCADED */ -uint8 st_lex::get_effective_with_check(TABLE_LIST *view) +uint8 LEX::get_effective_with_check(TABLE_LIST *view) { if (view->select_lex->master_unit() == &unit && which_check_option_applicable()) @@ -2424,7 +2430,7 @@ uint8 st_lex::get_effective_with_check(TABLE_LIST *view) */ bool -st_lex::copy_db_to(char **p_db, size_t *p_db_length) const +LEX::copy_db_to(char **p_db, size_t *p_db_length) const { if (sphead) { @@ -2501,7 +2507,7 @@ void st_select_lex_unit::set_limit(st_select_lex *sl) clause. */ -void st_lex::set_trg_event_type_for_tables() +void LEX::set_trg_event_type_for_tables() { uint8 new_trg_event_map= 0; @@ -2644,7 +2650,7 @@ void st_lex::set_trg_event_type_for_tables() In this case link_to_local is set. */ -TABLE_LIST *st_lex::unlink_first_table(bool *link_to_local) +TABLE_LIST *LEX::unlink_first_table(bool *link_to_local) { TABLE_LIST *first; if ((first= query_tables)) @@ -2684,7 +2690,7 @@ TABLE_LIST *st_lex::unlink_first_table(bool *link_to_local) table list SYNOPSYS - st_lex::first_lists_tables_same() + LEX::first_lists_tables_same() NOTES In many cases (for example, usual INSERT/DELETE/...) the first table of @@ -2695,7 +2701,7 @@ TABLE_LIST *st_lex::unlink_first_table(bool *link_to_local) the global list first. */ -void st_lex::first_lists_tables_same() +void LEX::first_lists_tables_same() { TABLE_LIST *first_table= (TABLE_LIST*) select_lex.table_list.first; if (query_tables != first_table && first_table != 0) @@ -2731,7 +2737,7 @@ void st_lex::first_lists_tables_same() global list */ -void st_lex::link_first_table_back(TABLE_LIST *first, +void LEX::link_first_table_back(TABLE_LIST *first, bool link_to_local) { if (first) @@ -2758,7 +2764,7 @@ void st_lex::link_first_table_back(TABLE_LIST *first, cleanup lex for case when we open table by table for processing SYNOPSIS - st_lex::cleanup_after_one_table_open() + LEX::cleanup_after_one_table_open() NOTE This method is mostly responsible for cleaning up of selects lists and @@ -2766,7 +2772,7 @@ void st_lex::link_first_table_back(TABLE_LIST *first, to call Query_tables_list::reset_query_tables_list(FALSE). */ -void st_lex::cleanup_after_one_table_open() +void LEX::cleanup_after_one_table_open() { /* thd->lex->derived_tables & additional units may be set if we open @@ -2801,7 +2807,7 @@ void st_lex::cleanup_after_one_table_open() backup Pointer to Query_tables_list instance to be used for backup */ -void st_lex::reset_n_backup_query_tables_list(Query_tables_list *backup) +void LEX::reset_n_backup_query_tables_list(Query_tables_list *backup) { backup->set_query_tables_list(this); /* @@ -2820,7 +2826,7 @@ void st_lex::reset_n_backup_query_tables_list(Query_tables_list *backup) backup Pointer to Query_tables_list instance used for backup */ -void st_lex::restore_backup_query_tables_list(Query_tables_list *backup) +void LEX::restore_backup_query_tables_list(Query_tables_list *backup) { this->destroy_query_tables_list(); this->set_query_tables_list(backup); @@ -2831,14 +2837,14 @@ void st_lex::restore_backup_query_tables_list(Query_tables_list *backup) Checks for usage of routines and/or tables in a parsed statement SYNOPSIS - st_lex:table_or_sp_used() + LEX:table_or_sp_used() RETURN FALSE No routines and tables used TRUE Either or both routines and tables are used. */ -bool st_lex::table_or_sp_used() +bool LEX::table_or_sp_used() { DBUG_ENTER("table_or_sp_used"); @@ -2999,7 +3005,7 @@ bool st_select_lex::add_index_hint (THD *thd, char *str, uint length) @retval FALSE No, not a management partition command */ -bool st_lex::is_partition_management() const +bool LEX::is_partition_management() const { return (sql_command == SQLCOM_ALTER_TABLE && (alter_info.flags == ALTER_ADD_PARTITION || diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 47f66faf048..1fc7cb2a948 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -395,7 +395,7 @@ public: Base class for st_select_lex (SELECT_LEX) & st_select_lex_unit (SELECT_LEX_UNIT) */ -struct st_lex; +struct LEX; class st_select_lex; class st_select_lex_unit; class st_select_lex_node { @@ -465,7 +465,7 @@ public: virtual void set_lock_for_tables(thr_lock_type lock_type) {} friend class st_select_lex_unit; - friend bool mysql_new_select(struct st_lex *lex, bool move_down); + friend bool mysql_new_select(LEX *lex, bool move_down); friend bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table, uint flags); private: @@ -585,7 +585,7 @@ public: /* Saved values of the WHERE and HAVING clauses*/ Item::cond_result cond_value, having_value; /* point on lex in which it was created, used in view subquery detection */ - st_lex *parent_lex; + LEX *parent_lex; enum olap_type olap; /* FROM clause - points to the beginning of the TABLE_LIST::next_local list. */ SQL_LIST table_list; @@ -951,6 +951,8 @@ extern sys_var *trg_new_row_fake_var; enum xa_option_words {XA_NONE, XA_JOIN, XA_RESUME, XA_ONE_PHASE, XA_SUSPEND, XA_FOR_MIGRATE}; +extern const LEX_STRING null_lex_str; + /* Class representing list of all tables used by statement. @@ -959,7 +961,7 @@ enum xa_option_words {XA_NONE, XA_JOIN, XA_RESUME, XA_ONE_PHASE, stored functions/triggers to this list in order to pre-open and lock them. - Also used by st_lex::reset_n_backup/restore_backup_query_tables_list() + Also used by LEX::reset_n_backup/restore_backup_query_tables_list() methods to save and restore this information. */ @@ -1548,7 +1550,7 @@ protected: Constructor. @param lex the LEX structure that represents parts of this statement. */ - Sql_statement(struct st_lex *lex) + Sql_statement(LEX *lex) : m_lex(lex) {} @@ -1573,12 +1575,12 @@ protected: with the minimum set of attributes, instead of a LEX structure that contains the collection of every possible attribute. */ - struct st_lex *m_lex; + LEX *m_lex; }; /* The state of the lex parsing. This is saved in the THD struct */ -typedef struct st_lex : public Query_tables_list +struct LEX: public Query_tables_list { SELECT_LEX_UNIT unit; /* most upper unit */ SELECT_LEX select_lex; /* first SELECT_LEX */ @@ -1835,9 +1837,9 @@ typedef struct st_lex : public Query_tables_list */ bool protect_against_global_read_lock; - st_lex(); + LEX(); - virtual ~st_lex() + virtual ~LEX() { destroy_query_tables_list(); plugin_unlock_list(NULL, (plugin_ref *)plugins.buffer, plugins.elements); @@ -1879,7 +1881,7 @@ typedef struct st_lex : public Query_tables_list Is this update command where 'WHITH CHECK OPTION' clause is important SYNOPSIS - st_lex::which_check_option_applicable() + LEX::which_check_option_applicable() RETURN TRUE have to take 'WHITH CHECK OPTION' clause into account @@ -1951,7 +1953,7 @@ typedef struct st_lex : public Query_tables_list } return FALSE; } -} LEX; +}; /** @@ -2042,7 +2044,7 @@ public: }; -struct st_lex_local: public st_lex +struct st_lex_local: public LEX { static void *operator new(size_t size) throw() { diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index e44a40c9e59..95ad59d2388 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -374,7 +374,7 @@ void execute_init_command(THD *thd, sys_var_str *init_command_var, Vio* save_vio; ulong save_client_capabilities; -#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER) +#if defined(ENABLED_PROFILING) thd->profiling.start_new_query(); thd->profiling.set_query_source(init_command_var->value, init_command_var->value_length); @@ -402,7 +402,7 @@ void execute_init_command(THD *thd, sys_var_str *init_command_var, thd->client_capabilities= save_client_capabilities; thd->net.vio= save_vio; -#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER) +#if defined(ENABLED_PROFILING) thd->profiling.finish_current_query(); #endif } @@ -478,7 +478,7 @@ static void handle_bootstrap_impl(THD *thd) QUERY_CACHE_FLAGS_SIZE); thd->set_query(query, length); DBUG_PRINT("query",("%-.4096s",thd->query)); -#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER) +#if defined(ENABLED_PROFILING) thd->profiling.start_new_query(); thd->profiling.set_query_source(thd->query, length); #endif @@ -495,7 +495,7 @@ static void handle_bootstrap_impl(THD *thd) bootstrap_error= thd->is_error(); net_end_statement(thd); -#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER) +#if defined(ENABLED_PROFILING) thd->profiling.finish_current_query(); #endif @@ -805,7 +805,7 @@ bool do_command(THD *thd) net_new_transaction(net); packet_length= my_net_read(net); -#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER) +#if defined(ENABLED_PROFILING) thd->profiling.start_new_query(); #endif if (packet_length == packet_error) @@ -865,7 +865,7 @@ bool do_command(THD *thd) return_value= dispatch_command(command, thd, packet+1, (uint) (packet_length-1)); out: -#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER) +#if defined(ENABLED_PROFILING) thd->profiling.finish_current_query(); #endif DBUG_RETURN(return_value); @@ -1222,7 +1222,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, general_log_write(thd, command, thd->query, thd->query_length); DBUG_PRINT("query",("%-.4096s",thd->query)); -#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER) +#if defined(ENABLED_PROFILING) thd->profiling.set_query_source(thd->query, thd->query_length); #endif @@ -1257,7 +1257,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, MYSQL_QUERY_DONE(thd->is_error()); } -#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER) +#if defined(ENABLED_PROFILING) thd->profiling.finish_current_query(); thd->profiling.start_new_query("continuing"); thd->profiling.set_query_source(beginning_of_next_stmt, length); @@ -1777,7 +1777,7 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident, Mark this current profiling record to be discarded. We don't wish to have SHOW commands show up in profiling. */ -#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER) +#if defined(ENABLED_PROFILING) thd->profiling.discard_current_query(); #endif break; @@ -2339,7 +2339,7 @@ case SQLCOM_PREPARE: } case SQLCOM_SHOW_PROFILES: { -#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER) +#if defined(ENABLED_PROFILING) thd->profiling.discard_current_query(); res= thd->profiling.show_profiles(); if (res) @@ -4950,7 +4950,7 @@ create_sp_error: res= mysql_xa_recover(thd); break; case SQLCOM_ALTER_TABLESPACE: - if (check_access(thd, ALTER_ACL, thd->db, 0, 1, 0, thd->db ? is_schema_db(thd->db) : 0)) + if (check_global_access(thd, CREATE_TABLESPACE_ACL)) break; if (!(res= mysql_alter_tablespace(thd, lex->alter_tablespace_info))) my_ok(thd); @@ -6167,7 +6167,7 @@ void mysql_parse(THD *thd, const char *inBuf, uint length, DBUG_PRINT("info",("Command aborted. Fatal_error: %d", thd->is_fatal_error)); - query_cache_abort(&thd->net); + query_cache_abort(&thd->query_cache_tls); } if (thd->lex->sphead) { @@ -6251,8 +6251,8 @@ bool add_field_to_list(THD *thd, LEX_STRING *field_name, enum_field_types type, if (type_modifier & PRI_KEY_FLAG) { Key *key; - lex->col_list.push_back(new Key_part_spec(field_name->str, 0)); - key= new Key(Key::PRIMARY, NullS, + lex->col_list.push_back(new Key_part_spec(*field_name, 0)); + key= new Key(Key::PRIMARY, null_lex_str, &default_key_create_info, 0, lex->col_list); lex->alter_info.key_list.push_back(key); @@ -6261,8 +6261,8 @@ bool add_field_to_list(THD *thd, LEX_STRING *field_name, enum_field_types type, if (type_modifier & (UNIQUE_FLAG | UNIQUE_KEY_FLAG)) { Key *key; - lex->col_list.push_back(new Key_part_spec(field_name->str, 0)); - key= new Key(Key::UNIQUE, NullS, + lex->col_list.push_back(new Key_part_spec(*field_name, 0)); + key= new Key(Key::UNIQUE, null_lex_str, &default_key_create_info, 0, lex->col_list); lex->alter_info.key_list.push_back(key); diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index f6a8e895fdc..a67ed1cf3af 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -6850,7 +6850,7 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info, /* See get_part_iter_for_interval_via_walking for definition of what this is */ -#define MAX_RANGE_TO_WALK 10 +#define MAX_RANGE_TO_WALK 32 /* @@ -6886,16 +6886,6 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info, Intervals with +inf/-inf, and [NULL, c1] interval can be processed but that is more tricky and I don't have time to do it right now. - Additionally we have these requirements: - * number of values in the interval must be less then number of - [sub]partitions, and - * Number of values in the interval must be less then MAX_RANGE_TO_WALK. - - The rationale behind these requirements is that if they are not met - we're likely to hit most of the partitions and traversing the interval - will only add overhead. So it's better return "all partitions used" in - that case. - RETURN 0 - No matching partitions, iterator not initialized 1 - Some partitions would match, iterator intialized for traversing them @@ -6989,8 +6979,24 @@ int get_part_iter_for_interval_via_walking(partition_info *part_info, a += test(flags & NEAR_MIN); b += test(!(flags & NEAR_MAX)); ulonglong n_values= b - a; - - if (n_values > total_parts || n_values > MAX_RANGE_TO_WALK) + + /* + Will it pay off to enumerate all values in the [a..b] range and evaluate + the partitioning function for every value? It depends on + 1. whether we'll be able to infer that some partitions are not used + 2. if time savings from not scanning these partitions will be greater + than time spent in enumeration. + We will assume that the cost of accessing one extra partition is greater + than the cost of evaluating the partitioning function O(#partitions). + This means we should jump at any chance to eliminate a partition, which + gives us this logic: + + Do the enumeration if + - the number of values to enumerate is comparable to the number of + partitions, or + - there are not many values to enumerate. + */ + if ((n_values > 2*total_parts) && n_values > MAX_RANGE_TO_WALK) return -1; part_iter->field_vals.start= part_iter->field_vals.cur= a; diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index f1de1e02906..06db45b895d 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -574,14 +574,15 @@ static struct st_plugin_int *plugin_find_internal(const LEX_STRING *name, int ty for (i= 0; i < MYSQL_MAX_PLUGIN_TYPE_NUM; i++) { struct st_plugin_int *plugin= (st_plugin_int *) - hash_search(&plugin_hash[i], (const uchar *)name->str, name->length); + my_hash_search(&plugin_hash[i], (const uchar *)name->str, name->length); if (plugin) DBUG_RETURN(plugin); } } else DBUG_RETURN((st_plugin_int *) - hash_search(&plugin_hash[type], (const uchar *)name->str, name->length)); + my_hash_search(&plugin_hash[type], (const uchar *)name->str, + name->length)); DBUG_RETURN(0); } @@ -858,7 +859,7 @@ static void plugin_del(struct st_plugin_int *plugin) safe_mutex_assert_owner(&LOCK_plugin); /* Free allocated strings before deleting the plugin. */ plugin_vars_free_values(plugin->system_vars); - hash_delete(&plugin_hash[plugin->plugin->type], (uchar*)plugin); + my_hash_delete(&plugin_hash[plugin->plugin->type], (uchar*)plugin); if (plugin->plugin_dl) plugin_dl_del(&plugin->plugin_dl->dl); plugin->state= PLUGIN_IS_FREED; @@ -1133,8 +1134,8 @@ int plugin_init(int *argc, char **argv, int flags) init_alloc_root(&plugin_mem_root, 4096, 4096); init_alloc_root(&tmp_root, 4096, 4096); - if (hash_init(&bookmark_hash, &my_charset_bin, 16, 0, 0, - get_bookmark_hash_key, NULL, HASH_UNIQUE)) + if (my_hash_init(&bookmark_hash, &my_charset_bin, 16, 0, 0, + get_bookmark_hash_key, NULL, HASH_UNIQUE)) goto err; @@ -1148,8 +1149,8 @@ int plugin_init(int *argc, char **argv, int flags) for (i= 0; i < MYSQL_MAX_PLUGIN_TYPE_NUM; i++) { - if (hash_init(&plugin_hash[i], system_charset_info, 16, 0, 0, - get_plugin_hash_key, NULL, HASH_UNIQUE)) + if (my_hash_init(&plugin_hash[i], system_charset_info, 16, 0, 0, + get_plugin_hash_key, NULL, HASH_UNIQUE)) goto err; } @@ -1627,7 +1628,7 @@ void plugin_shutdown(void) /* Dispose of the memory */ for (i= 0; i < MYSQL_MAX_PLUGIN_TYPE_NUM; i++) - hash_free(&plugin_hash[i]); + my_hash_free(&plugin_hash[i]); delete_dynamic(&plugin_array); count= plugin_dl_array.elements; @@ -1639,7 +1640,7 @@ void plugin_shutdown(void) my_afree(dl); delete_dynamic(&plugin_dl_array); - hash_free(&bookmark_hash); + my_hash_free(&bookmark_hash); free_root(&plugin_mem_root, MYF(0)); global_variables_dynamic_size= 0; @@ -1827,7 +1828,7 @@ bool plugin_foreach_with_mask(THD *thd, plugin_foreach_func *func, HASH *hash= plugin_hash + type; for (idx= 0; idx < total; idx++) { - plugin= (struct st_plugin_int *) hash_element(hash, idx); + plugin= (struct st_plugin_int *) my_hash_element(hash, idx); plugins[idx]= !(plugin->state & state_mask) ? plugin : NULL; } } @@ -2226,8 +2227,8 @@ static st_bookmark *find_bookmark(const char *plugin, const char *name, varname[0]= flags & PLUGIN_VAR_TYPEMASK; - result= (st_bookmark*) hash_search(&bookmark_hash, - (const uchar*) varname, length - 1); + result= (st_bookmark*) my_hash_search(&bookmark_hash, + (const uchar*) varname, length - 1); my_afree(varname); return result; @@ -2387,7 +2388,7 @@ static uchar *intern_sys_var_ptr(THD* thd, int offset, bool global_lock) { sys_var_pluginvar *pi; sys_var *var; - st_bookmark *v= (st_bookmark*) hash_element(&bookmark_hash,idx); + st_bookmark *v= (st_bookmark*) my_hash_element(&bookmark_hash,idx); if (v->version <= thd->variables.dynamic_variables_version || !(var= intern_find_sys_var(v->key + 1, v->name_len, true)) || @@ -2481,7 +2482,7 @@ static void cleanup_variables(THD *thd, struct system_variables *vars) rw_rdlock(&LOCK_system_variables_hash); for (idx= 0; idx < bookmark_hash.records; idx++) { - v= (st_bookmark*) hash_element(&bookmark_hash, idx); + v= (st_bookmark*) my_hash_element(&bookmark_hash, idx); if (v->version > vars->dynamic_variables_version || !(var= intern_find_sys_var(v->key + 1, v->name_len, true)) || !(pivar= var->cast_pluginvar()) || diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 8cbdbbcb39a..0494dc695c0 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1027,9 +1027,9 @@ static bool insert_params_from_vars(Prepared_statement *stmt, { Item_param *param= *it; varname= var_it++; - entry= (user_var_entry*)hash_search(&stmt->thd->user_vars, - (uchar*) varname->str, - varname->length); + entry= (user_var_entry*)my_hash_search(&stmt->thd->user_vars, + (uchar*) varname->str, + varname->length); if (param->set_from_user_var(stmt->thd, entry) || param->convert_str_value(stmt->thd)) DBUG_RETURN(1); @@ -1074,8 +1074,8 @@ static bool insert_params_from_vars_with_log(Prepared_statement *stmt, Item_param *param= *it; varname= var_it++; - entry= (user_var_entry *) hash_search(&thd->user_vars, (uchar*) varname->str, - varname->length); + entry= (user_var_entry *) my_hash_search(&thd->user_vars, (uchar*) + varname->str, varname->length); /* We have to call the setup_one_conversion_function() here to set the parameter's members that might be needed further @@ -2152,9 +2152,9 @@ static const char *get_dynamic_sql_string(LEX *lex, uint *query_len) convert it for error messages to be uniform. */ if ((entry= - (user_var_entry*)hash_search(&thd->user_vars, - (uchar*)lex->prepared_stmt_code.str, - lex->prepared_stmt_code.length)) + (user_var_entry*)my_hash_search(&thd->user_vars, + (uchar*)lex->prepared_stmt_code.str, + lex->prepared_stmt_code.length)) && entry->value) { my_bool is_var_null; @@ -2462,7 +2462,7 @@ void mysqld_stmt_execute(THD *thd, char *packet_arg, uint packet_length) DBUG_VOID_RETURN; } -#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER) +#if defined(ENABLED_PROFILING) thd->profiling.set_query_source(stmt->query, stmt->query_length); #endif DBUG_PRINT("exec_query", ("%s", stmt->query)); diff --git a/sql/sql_profile.cc b/sql/sql_profile.cc index 8c9b147089f..3801d9a3f8d 100644 --- a/sql/sql_profile.cc +++ b/sql/sql_profile.cc @@ -47,7 +47,7 @@ const char * const _unknown_func_ = "<unknown>"; int fill_query_profile_statistics_info(THD *thd, TABLE_LIST *tables, Item *cond) { -#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER) +#if defined(ENABLED_PROFILING) return(thd->profiling.fill_statistics_info(thd, tables, cond)); #else my_error(ER_FEATURE_DISABLED, MYF(0), "SHOW PROFILE", "enable-profiling"); @@ -129,7 +129,7 @@ int make_profile_table_for_show(THD *thd, ST_SCHEMA_TABLE *schema_table) } -#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER) +#if defined(ENABLED_PROFILING) #define RUSAGE_USEC(tv) ((tv).tv_sec*1000*1000 + (tv).tv_usec) #define RUSAGE_DIFF_USEC(tv1, tv2) (RUSAGE_USEC((tv1))-RUSAGE_USEC((tv2))) diff --git a/sql/sql_profile.h b/sql/sql_profile.h index 245959e0953..bffe1cb576b 100644 --- a/sql/sql_profile.h +++ b/sql/sql_profile.h @@ -41,7 +41,7 @@ int make_profile_table_for_show(THD *thd, ST_SCHEMA_TABLE *schema_table); #define PROFILE_ALL (uint)(~0) -#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER) +#if defined(ENABLED_PROFILING) #include "mysql_priv.h" #ifdef HAVE_SYS_RESOURCE_H diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 3e2d85e4951..9e94bd59bae 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -991,13 +991,13 @@ JOIN::optimize() } if (const_tables && !thd->locked_tables && !(select_options & SELECT_NO_UNLOCK)) - mysql_unlock_some_tables(thd, table, const_tables); + mysql_unlock_some_tables(thd, all_tables, const_tables); if (!conds && outer_join) { /* Handle the case where we have an OUTER JOIN without a WHERE */ conds=new Item_int((longlong) 1,1); // Always true } - select= make_select(*table, const_table_map, + select= make_select(*all_tables, const_table_map, const_table_map, conds, 1, &error); if (error) { /* purecov: inspected */ @@ -2905,7 +2905,7 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables_arg, COND *conds, join->join_tab=stat; join->map2table=stat_ref; - join->table= join->all_tables=table_vector; + join->all_tables= table_vector; join->const_tables=const_count; join->found_const_table_map=found_const_table_map; @@ -5595,7 +5595,7 @@ get_best_combination(JOIN *join) { TABLE *form; *j= *join->best_positions[tablenr].table; - form=join->table[tablenr]=j->table; + form=join->all_tables[tablenr]=j->table; used_tables|= form->map; form->reginfo.join_tab=j; if (!*j->on_expr_ref) @@ -5867,7 +5867,7 @@ JOIN::make_simple_join(JOIN *parent, TABLE *tmp_table) DBUG_RETURN(TRUE); /* purecov: inspected */ join_tab= parent->join_tab_reexec; - table= &parent->table_reexec[0]; parent->table_reexec[0]= tmp_table; + parent->table_reexec[0]= tmp_table; tables= 1; const_tables= 0; const_table_map= 0; @@ -6899,24 +6899,23 @@ void JOIN::cleanup(bool full) { DBUG_ENTER("JOIN::cleanup"); - if (table) + if (all_tables) { JOIN_TAB *tab,*end; /* Only a sorted table may be cached. This sorted table is always the - first non const table in join->table + first non const table in join->all_tables */ if (tables > const_tables) // Test for not-const tables { - free_io_cache(table[const_tables]); - filesort_free_buffers(table[const_tables],full); + free_io_cache(all_tables[const_tables]); + filesort_free_buffers(all_tables[const_tables],full); } if (full) { for (tab= join_tab, end= tab+tables; tab != end; tab++) tab->cleanup(); - table= 0; } else { @@ -7245,7 +7244,7 @@ static void clear_tables(JOIN *join) are not re-calculated. */ for (uint i=join->const_tables ; i < join->tables ; i++) - mark_as_null_row(join->table[i]); // All fields are NULL + mark_as_null_row(join->all_tables[i]); // All fields are NULL } /***************************************************************************** @@ -9187,7 +9186,7 @@ remove_eq_conds(THD *thd, COND *cond, Item::cond_result *cond_value) thd->substitute_null_with_insert_id)) { #ifdef HAVE_QUERY_CACHE - query_cache_abort(&thd->net); + query_cache_abort(&thd->query_cache_tls); #endif COND *new_cond; if ((new_cond= new Item_func_eq(args[0], @@ -10995,26 +10994,7 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure) if (error == NESTED_LOOP_NO_MORE_ROWS) error= NESTED_LOOP_OK; - if (error == NESTED_LOOP_OK) - { - /* - Sic: this branch works even if rc != 0, e.g. when - send_data above returns an error. - */ - if (!table) // If sending data to client - { - /* - The following will unlock all cursors if the command wasn't an - update command - */ - join->join_free(); // Unlock all cursors - if (join->result->send_eof()) - rc= 1; // Don't send error - } - DBUG_PRINT("info",("%ld records output", (long) join->send_records)); - } - else - rc= -1; + if (table) { int tmp, new_errno= 0; @@ -11031,6 +11011,29 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure) if (new_errno) table->file->print_error(new_errno,MYF(0)); } + else + { + /* + The following will unlock all cursors if the command wasn't an + update command + */ + join->join_free(); // Unlock all cursors + } + if (error == NESTED_LOOP_OK) + { + /* + Sic: this branch works even if rc != 0, e.g. when + send_data above returns an error. + */ + if (!table) // If sending data to client + { + if (join->result->send_eof()) + rc= 1; // Don't send error + } + DBUG_PRINT("info",("%ld records output", (long) join->send_records)); + } + else + rc= -1; #ifndef DBUG_OFF if (rc) { @@ -11878,10 +11881,8 @@ join_init_quick_read_record(JOIN_TAB *tab) } -int rr_sequential(READ_RECORD *info); -int init_read_record_seq(JOIN_TAB *tab) +int read_first_record_seq(JOIN_TAB *tab) { - tab->read_record.read_record= rr_sequential; if (tab->read_record.file->ha_rnd_init(1)) return 1; return (*tab->read_record.read_record)(&tab->read_record); @@ -13891,8 +13892,8 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table, extra_length= ALIGN_SIZE(key_length)-key_length; } - if (hash_init(&hash, &my_charset_bin, (uint) file->stats.records, 0, - key_length, (hash_get_key) 0, 0, 0)) + if (my_hash_init(&hash, &my_charset_bin, (uint) file->stats.records, 0, + key_length, (my_hash_get_key) 0, 0, 0)) { my_free((char*) key_buffer,MYF(0)); DBUG_RETURN(1); @@ -13933,7 +13934,7 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table, key_pos+= *field_length++; } /* Check if it exists before */ - if (hash_search(&hash, org_key_pos, key_length)) + if (my_hash_search(&hash, org_key_pos, key_length)) { /* Duplicated found ; Remove the row */ if ((error=file->ha_delete_row(record))) @@ -13944,14 +13945,14 @@ static int remove_dup_with_hash_index(THD *thd, TABLE *table, key_pos+=extra_length; } my_free((char*) key_buffer,MYF(0)); - hash_free(&hash); + my_hash_free(&hash); file->extra(HA_EXTRA_NO_CACHE); (void) file->ha_rnd_end(); DBUG_RETURN(0); err: my_free((char*) key_buffer,MYF(0)); - hash_free(&hash); + my_hash_free(&hash); file->extra(HA_EXTRA_NO_CACHE); (void) file->ha_rnd_end(); if (error) diff --git a/sql/sql_select.h b/sql/sql_select.h index bb751c600ed..c725316f4dd 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -134,7 +134,6 @@ enum enum_nested_loop_state typedef enum_nested_loop_state (*Next_select_func)(JOIN *, struct st_join_table *, bool); -typedef int (*Read_record_func)(struct st_join_table *tab); Next_select_func setup_end_select_func(JOIN *join); @@ -162,7 +161,7 @@ typedef struct st_join_table { */ uint packed_info; - Read_record_func read_first_record; + READ_RECORD::Setup_func read_first_record; Next_select_func next_select; READ_RECORD read_record; /* @@ -170,8 +169,8 @@ typedef struct st_join_table { if it is executed by an alternative full table scan when the left operand of the subquery predicate is evaluated to NULL. */ - Read_record_func save_read_first_record;/* to save read_first_record */ - int (*save_read_record) (READ_RECORD *);/* to save read_record.read_record */ + READ_RECORD::Setup_func save_read_first_record;/* to save read_first_record */ + READ_RECORD::Read_func save_read_record;/* to save read_record.read_record */ double worst_seeks; key_map const_keys; /**< Keys with constant part */ key_map checked_keys; /**< Keys checked in find_best */ @@ -280,7 +279,7 @@ public: JOIN_TAB *join_tab,**best_ref; JOIN_TAB **map2table; ///< mapping between table indexes and JOIN_TABs JOIN_TAB *join_tab_save; ///< saved join_tab for subquery reexecution - TABLE **table,**all_tables,*sort_by_table; + TABLE **all_tables,*sort_by_table; uint tables,const_tables; uint send_group_parts; bool sort_and_group,first_record,full_join,group, no_field_update; @@ -427,7 +426,7 @@ public: select_result *result_arg) { join_tab= join_tab_save= 0; - table= 0; + all_tables= 0; tables= 0; const_tables= 0; join_list= 0; diff --git a/sql/sql_servers.cc b/sql/sql_servers.cc index 33058887952..e8fa3d984a7 100644 --- a/sql/sql_servers.cc +++ b/sql/sql_servers.cc @@ -120,8 +120,8 @@ bool servers_init(bool dont_read_servers_table) DBUG_RETURN(TRUE); /* initialise our servers cache */ - if (hash_init(&servers_cache, system_charset_info, 32, 0, 0, - (hash_get_key) servers_cache_get_key, 0, 0)) + if (my_hash_init(&servers_cache, system_charset_info, 32, 0, 0, + (my_hash_get_key) servers_cache_get_key, 0, 0)) { return_val= TRUE; /* we failed, out of memory? */ goto end; @@ -646,9 +646,10 @@ delete_server_record_in_cache(LEX_SERVER_OPTIONS *server_options) server_options->server_name_length)); - if (!(server= (FOREIGN_SERVER *) hash_search(&servers_cache, - (uchar*) server_options->server_name, - server_options->server_name_length))) + if (!(server= (FOREIGN_SERVER *) + my_hash_search(&servers_cache, + (uchar*) server_options->server_name, + server_options->server_name_length))) { DBUG_PRINT("info", ("server_name %s length %d not found!", server_options->server_name, @@ -663,7 +664,7 @@ delete_server_record_in_cache(LEX_SERVER_OPTIONS *server_options) server->server_name, server->server_name_length)); - VOID(hash_delete(&servers_cache, (uchar*) server)); + VOID(my_hash_delete(&servers_cache, (uchar*) server)); error= 0; @@ -770,7 +771,7 @@ int update_server_record_in_cache(FOREIGN_SERVER *existing, /* delete the existing server struct from the server cache */ - VOID(hash_delete(&servers_cache, (uchar*)existing)); + VOID(my_hash_delete(&servers_cache, (uchar*)existing)); /* Insert the altered server struct into the server cache @@ -965,8 +966,8 @@ int create_server(THD *thd, LEX_SERVER_OPTIONS *server_options) rw_wrlock(&THR_LOCK_servers); /* hit the memory first */ - if (hash_search(&servers_cache, (uchar*) server_options->server_name, - server_options->server_name_length)) + if (my_hash_search(&servers_cache, (uchar*) server_options->server_name, + server_options->server_name_length)) goto end; @@ -1014,9 +1015,9 @@ int alter_server(THD *thd, LEX_SERVER_OPTIONS *server_options) rw_wrlock(&THR_LOCK_servers); - if (!(existing= (FOREIGN_SERVER *) hash_search(&servers_cache, - (uchar*) name.str, - name.length))) + if (!(existing= (FOREIGN_SERVER *) my_hash_search(&servers_cache, + (uchar*) name.str, + name.length))) goto end; altered= (FOREIGN_SERVER *)alloc_root(&mem, @@ -1195,7 +1196,7 @@ prepare_server_struct_for_update(LEX_SERVER_OPTIONS *server_options, void servers_free(bool end) { DBUG_ENTER("servers_free"); - if (!hash_inited(&servers_cache)) + if (!my_hash_inited(&servers_cache)) DBUG_VOID_RETURN; if (!end) { @@ -1205,7 +1206,7 @@ void servers_free(bool end) } rwlock_destroy(&THR_LOCK_servers); free_root(&mem,MYF(0)); - hash_free(&servers_cache); + my_hash_free(&servers_cache); DBUG_VOID_RETURN; } @@ -1286,9 +1287,9 @@ FOREIGN_SERVER *get_server_by_name(MEM_ROOT *mem, const char *server_name, DBUG_PRINT("info", ("locking servers_cache")); rw_rdlock(&THR_LOCK_servers); - if (!(server= (FOREIGN_SERVER *) hash_search(&servers_cache, - (uchar*) server_name, - server_name_length))) + if (!(server= (FOREIGN_SERVER *) my_hash_search(&servers_cache, + (uchar*) server_name, + server_name_length))) { DBUG_PRINT("info", ("server_name %s length %u not found!", server_name, (unsigned) server_name_length)); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 9a04ca7766a..6672ebc8d79 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -310,6 +310,7 @@ static struct show_privileges_st sys_privileges[]= {"Shutdown","Server Admin", "To shut down the server"}, {"Super","Server Admin","To use KILL thread, SET GLOBAL, CHANGE MASTER, etc."}, {"Trigger","Tables", "To use triggers"}, + {"Create tablespace", "Server Admin", "To create/alter/drop tablespaces"}, {"Update", "Tables", "To update existing rows"}, {"Usage","Server Admin","No privileges - allow connect only"}, {NullS, NullS, NullS} @@ -3078,12 +3079,31 @@ static int fill_schema_table_from_frm(THD *thd,TABLE *table, int error; char key[MAX_DBKEY_LENGTH]; uint key_length; + char db_name_buff[NAME_LEN + 1], table_name_buff[NAME_LEN + 1]; bzero((char*) &table_list, sizeof(TABLE_LIST)); bzero((char*) &tbl, sizeof(TABLE)); - table_list.table_name= table_name->str; - table_list.db= db_name->str; + if (lower_case_table_names) + { + /* + In lower_case_table_names > 0 metadata locking and table definition + cache subsystems require normalized (lowercased) database and table + names as input. + */ + strmov(db_name_buff, db_name->str); + strmov(table_name_buff, table_name->str); + my_casedn_str(files_charset_info, db_name_buff); + my_casedn_str(files_charset_info, table_name_buff); + table_list.db= db_name_buff; + table_list.table_name= table_name_buff; + } + else + { + table_list.table_name= table_name->str; + table_list.db= db_name->str; + } + key_length= create_table_def_key(thd, key, &table_list, 0); pthread_mutex_lock(&LOCK_open); share= get_table_share(thd, &table_list, key, @@ -3121,7 +3141,7 @@ static int fill_schema_table_from_frm(THD *thd,TABLE *table, { tbl.s= share; table_list.table= &tbl; - table_list.view= (st_lex*) share->is_view; + table_list.view= (LEX*) share->is_view; res= schema_table->process_table(thd, &table_list, table, res, db_name, table_name); closefrm(&tbl, true); @@ -6273,7 +6293,7 @@ ST_FIELD_INFO proc_fields_info[]= {"CREATED", 0, MYSQL_TYPE_DATETIME, 0, 0, "Created", SKIP_OPEN_TABLE}, {"LAST_ALTERED", 0, MYSQL_TYPE_DATETIME, 0, 0, "Modified", SKIP_OPEN_TABLE}, {"SQL_MODE", 32*256, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}, - {"ROUTINE_COMMENT", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Comment", + {"ROUTINE_COMMENT", 65535, MYSQL_TYPE_STRING, 0, 0, "Comment", SKIP_OPEN_TABLE}, {"DEFINER", 77, MYSQL_TYPE_STRING, 0, 0, "Definer", SKIP_OPEN_TABLE}, {"CHARACTER_SET_CLIENT", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 37c897aca3b..e6f9bb9e5e3 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2877,9 +2877,8 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, while ((key=key_iterator++)) { - DBUG_PRINT("info", ("key name: '%s' type: %d", key->name ? key->name : + DBUG_PRINT("info", ("key name: '%s' type: %d", key->name.str ? key->name.str : "(none)" , key->type)); - LEX_STRING key_name_str; if (key->type == Key::FOREIGN_KEY) { fk_key_count++; @@ -2888,7 +2887,8 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, fk_key->ref_columns.elements != fk_key->columns.elements) { my_error(ER_WRONG_FK_DEF, MYF(0), - (fk_key->name ? fk_key->name : "foreign key without name"), + (fk_key->name.str ? fk_key->name.str : + "foreign key without name"), ER(ER_KEY_REF_DO_NOT_MATCH_TABLE_REF)); DBUG_RETURN(TRUE); } @@ -2901,12 +2901,10 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, my_error(ER_TOO_MANY_KEY_PARTS,MYF(0),tmp); DBUG_RETURN(TRUE); } - key_name_str.str= (char*) key->name; - key_name_str.length= key->name ? strlen(key->name) : 0; - if (check_string_char_length(&key_name_str, "", NAME_CHAR_LEN, + if (check_string_char_length(&key->name, "", NAME_CHAR_LEN, system_charset_info, 1)) { - my_error(ER_TOO_LONG_IDENT, MYF(0), key->name); + my_error(ER_TOO_LONG_IDENT, MYF(0), key->name.str); DBUG_RETURN(TRUE); } key_iterator2.rewind (); @@ -2920,7 +2918,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, Then we do not need the generated shorter key. */ if ((key2->type != Key::FOREIGN_KEY && - key2->name != ignore_key && + key2->name.str != ignore_key && !foreign_key_prefix(key, key2))) { /* TODO: issue warning message */ @@ -2928,10 +2926,10 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, if (!key2->generated || (key->generated && key->columns.elements < key2->columns.elements)) - key->name= ignore_key; + key->name.str= ignore_key; else { - key2->name= ignore_key; + key2->name.str= ignore_key; key_parts-= key2->columns.elements; (*key_count)--; } @@ -2939,14 +2937,14 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, } } } - if (key->name != ignore_key) + if (key->name.str != ignore_key) key_parts+=key->columns.elements; else (*key_count)--; - if (key->name && !tmp_table && (key->type != Key::PRIMARY) && - !my_strcasecmp(system_charset_info,key->name,primary_key_name)) + if (key->name.str && !tmp_table && (key->type != Key::PRIMARY) && + !my_strcasecmp(system_charset_info, key->name.str, primary_key_name)) { - my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), key->name); + my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), key->name.str); DBUG_RETURN(TRUE); } } @@ -2969,12 +2967,12 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, uint key_length=0; Key_part_spec *column; - if (key->name == ignore_key) + if (key->name.str == ignore_key) { /* ignore redundant keys */ do key=key_iterator++; - while (key && key->name == ignore_key); + while (key && key->name.str == ignore_key); if (!key) break; } @@ -3087,22 +3085,22 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, field=0; while ((sql_field=it++) && my_strcasecmp(system_charset_info, - column->field_name, + column->field_name.str, sql_field->field_name)) field++; if (!sql_field) { - my_error(ER_KEY_COLUMN_DOES_NOT_EXITS, MYF(0), column->field_name); + my_error(ER_KEY_COLUMN_DOES_NOT_EXITS, MYF(0), column->field_name.str); DBUG_RETURN(TRUE); } while ((dup_column= cols2++) != column) { if (!my_strcasecmp(system_charset_info, - column->field_name, dup_column->field_name)) + column->field_name.str, dup_column->field_name.str)) { my_printf_error(ER_DUP_FIELDNAME, ER(ER_DUP_FIELDNAME),MYF(0), - column->field_name); + column->field_name.str); DBUG_RETURN(TRUE); } } @@ -3116,7 +3114,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, sql_field->charset->mbminlen > 1 || // ucs2 doesn't work yet (ft_key_charset && sql_field->charset != ft_key_charset)) { - my_error(ER_BAD_FT_COLUMN, MYF(0), column->field_name); + my_error(ER_BAD_FT_COLUMN, MYF(0), column->field_name.str); DBUG_RETURN(-1); } ft_key_charset=sql_field->charset; @@ -3144,7 +3142,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, { if (!(file->ha_table_flags() & HA_CAN_INDEX_BLOBS)) { - my_error(ER_BLOB_USED_AS_KEY, MYF(0), column->field_name); + my_error(ER_BLOB_USED_AS_KEY, MYF(0), column->field_name.str); DBUG_RETURN(TRUE); } if (f_is_geom(sql_field->pack_flag) && sql_field->geom_type == @@ -3152,7 +3150,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, column->length= 25; if (!column->length) { - my_error(ER_BLOB_KEY_WITHOUT_LENGTH, MYF(0), column->field_name); + my_error(ER_BLOB_KEY_WITHOUT_LENGTH, MYF(0), column->field_name.str); DBUG_RETURN(TRUE); } } @@ -3183,7 +3181,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, key_info->flags|= HA_NULL_PART_KEY; if (!(file->ha_table_flags() & HA_NULL_IN_KEY)) { - my_error(ER_NULL_COLUMN_IN_INDEX, MYF(0), column->field_name); + my_error(ER_NULL_COLUMN_IN_INDEX, MYF(0), column->field_name.str); DBUG_RETURN(TRUE); } if (key->type == Key::SPATIAL) @@ -3233,13 +3231,21 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, } } else if (!f_is_geom(sql_field->pack_flag) && - (column->length > length || - !Field::type_can_have_key_part (sql_field->sql_type) || - ((f_is_packed(sql_field->pack_flag) || - ((file->ha_table_flags() & HA_NO_PREFIX_CHAR_KEYS) && - (key_info->flags & HA_NOSAME))) && - column->length != length))) - { + ((column->length > length && + !Field::type_can_have_key_part (sql_field->sql_type)) || + ((f_is_packed(sql_field->pack_flag) || + ((file->ha_table_flags() & HA_NO_PREFIX_CHAR_KEYS) && + (key_info->flags & HA_NOSAME))) && + column->length != length))) + { + /* Catch invalid uses of partial keys. + A key is identified as 'partial' if column->length != length. + A partial key is invalid if they data type does + not allow it, or the field is packed (as in MyISAM), + or the storage engine doesn't allow prefixed search and + the key is primary key. + */ + my_message(ER_WRONG_SUB_KEY, ER(ER_WRONG_SUB_KEY), MYF(0)); DBUG_RETURN(TRUE); } @@ -3248,7 +3254,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, } else if (length == 0) { - my_error(ER_WRONG_KEY_COLUMN, MYF(0), column->field_name); + my_error(ER_WRONG_KEY_COLUMN, MYF(0), column->field_name.str); DBUG_RETURN(TRUE); } if (length > file->max_key_part_length() && key->type != Key::FULLTEXT) @@ -3306,7 +3312,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, key_name=primary_key_name; primary_key=1; } - else if (!(key_name = key->name)) + else if (!(key_name= key->name.str)) key_name=make_unique_key_name(sql_field->field_name, *key_info_buffer, key_info); if (check_if_keyname_exists(key_name, *key_info_buffer, key_info)) @@ -3844,7 +3850,7 @@ bool mysql_create_table_no_lock(THD *thd, Then she could create the table. This case is pretty obscure and therefore we don't introduce a new error message only for it. */ - if (get_cached_table_share(db, alias)) + if (get_cached_table_share(db, table_name)) { my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name); goto unlock_and_end; @@ -3978,7 +3984,7 @@ bool mysql_create_table(THD *thd, const char *db, const char *table_name, /* Wait for any database locks */ pthread_mutex_lock(&LOCK_lock_db); while (!thd->killed && - hash_search(&lock_db_cache,(uchar*) db, strlen(db))) + my_hash_search(&lock_db_cache,(uchar*) db, strlen(db))) { wait_for_condition(thd, &LOCK_lock_db, &COND_refresh); pthread_mutex_lock(&LOCK_lock_db); @@ -6236,6 +6242,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, } key_part_length /= key_part->field->charset()->mbmaxlen; key_parts.push_back(new Key_part_spec(cfield->field_name, + strlen(cfield->field_name), key_part_length)); } if (key_parts.elements) @@ -6265,7 +6272,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, else key_type= Key::MULTIPLE; - key= new Key(key_type, key_name, + key= new Key(key_type, key_name, strlen(key_name), &key_create_info, test(key_info->flags & HA_GENERATED_KEY), key_parts); @@ -6278,10 +6285,10 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, { if (key->type != Key::FOREIGN_KEY) new_key_list.push_back(key); - if (key->name && - !my_strcasecmp(system_charset_info,key->name,primary_key_name)) + if (key->name.str && + !my_strcasecmp(system_charset_info, key->name.str, primary_key_name)) { - my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), key->name); + my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), key->name.str); goto err; } } @@ -7470,7 +7477,7 @@ view_err: end_temporary: my_snprintf(tmp_name, sizeof(tmp_name), ER(ER_INSERT_INFO), (ulong) (copied + deleted), (ulong) deleted, - (ulong) thd->cuted_fields); + (ulong) thd->warning_info->statement_warn_count()); my_ok(thd, copied + deleted, 0L, tmp_name); thd->some_tables_deleted=0; DBUG_RETURN(FALSE); diff --git a/sql/sql_test.cc b/sql/sql_test.cc index eeb9a21b6f5..6c0cb08cc79 100644 --- a/sql/sql_test.cc +++ b/sql/sql_test.cc @@ -85,7 +85,7 @@ void print_cached_tables(void) for (idx=unused=0 ; idx < open_cache.records ; idx++) { - TABLE *entry=(TABLE*) hash_element(&open_cache,idx); + TABLE *entry=(TABLE*) my_hash_element(&open_cache,idx); printf("%-14.14s %-32s%6ld%8ld%6d %s\n", entry->s->db.str, entry->s->table_name.str, entry->s->version, entry->in_use ? entry->in_use->thread_id : 0L, @@ -113,7 +113,7 @@ void print_cached_tables(void) if (count != unused) printf("Unused_links (%d) doesn't match open_cache: %d\n", count,unused); printf("\nCurrent refresh version: %ld\n",refresh_version); - if (hash_check(&open_cache)) + if (my_hash_check(&open_cache)) printf("Error: File hash table is corrupted\n"); fflush(stdout); VOID(pthread_mutex_unlock(&LOCK_open)); diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc index c60dac42fb8..141bf76df1a 100644 --- a/sql/sql_udf.cc +++ b/sql/sql_udf.cc @@ -124,10 +124,10 @@ void udf_init() init_sql_alloc(&mem, UDF_ALLOC_BLOCK_SIZE, 0); THD *new_thd = new THD; if (!new_thd || - hash_init(&udf_hash,system_charset_info,32,0,0,get_hash_key, NULL, 0)) + my_hash_init(&udf_hash,system_charset_info,32,0,0,get_hash_key, NULL, 0)) { sql_print_error("Can't allocate memory for udf structures"); - hash_free(&udf_hash); + my_hash_free(&udf_hash); free_root(&mem,MYF(0)); delete new_thd; DBUG_VOID_RETURN; @@ -239,20 +239,20 @@ void udf_free() DBUG_ENTER("udf_free"); for (uint idx=0 ; idx < udf_hash.records ; idx++) { - udf_func *udf=(udf_func*) hash_element(&udf_hash,idx); + udf_func *udf=(udf_func*) my_hash_element(&udf_hash,idx); if (udf->dlhandle) // Not closed before { /* Mark all versions using the same handler as closed */ for (uint j=idx+1 ; j < udf_hash.records ; j++) { - udf_func *tmp=(udf_func*) hash_element(&udf_hash,j); + udf_func *tmp=(udf_func*) my_hash_element(&udf_hash,j); if (udf->dlhandle == tmp->dlhandle) tmp->dlhandle=0; // Already closed } dlclose(udf->dlhandle); } } - hash_free(&udf_hash); + my_hash_free(&udf_hash); free_root(&mem,MYF(0)); if (initialized) { @@ -268,7 +268,7 @@ static void del_udf(udf_func *udf) DBUG_ENTER("del_udf"); if (!--udf->usage_count) { - hash_delete(&udf_hash,(uchar*) udf); + my_hash_delete(&udf_hash,(uchar*) udf); using_udf_functions=udf_hash.records != 0; } else @@ -282,7 +282,7 @@ static void del_udf(udf_func *udf) uint name_length=udf->name.length; udf->name.str=(char*) "*"; udf->name.length=1; - hash_update(&udf_hash,(uchar*) udf,(uchar*) name,name_length); + my_hash_update(&udf_hash,(uchar*) udf,(uchar*) name,name_length); } DBUG_VOID_RETURN; } @@ -302,7 +302,7 @@ void free_udf(udf_func *udf) We come here when someone has deleted the udf function while another thread still was using the udf */ - hash_delete(&udf_hash,(uchar*) udf); + my_hash_delete(&udf_hash,(uchar*) udf); using_udf_functions=udf_hash.records != 0; if (!find_udf_dl(udf->dl)) dlclose(udf->dlhandle); @@ -328,8 +328,8 @@ udf_func *find_udf(const char *name,uint length,bool mark_used) else rw_rdlock(&THR_LOCK_udf); /* Called during parsing */ - if ((udf=(udf_func*) hash_search(&udf_hash,(uchar*) name, - length ? length : (uint) strlen(name)))) + if ((udf=(udf_func*) my_hash_search(&udf_hash,(uchar*) name, + length ? length : (uint) strlen(name)))) { if (!udf->dlhandle) udf=0; // Could not be opened @@ -351,7 +351,7 @@ static void *find_udf_dl(const char *dl) */ for (uint idx=0 ; idx < udf_hash.records ; idx++) { - udf_func *udf=(udf_func*) hash_element(&udf_hash,idx); + udf_func *udf=(udf_func*) my_hash_element(&udf_hash,idx); if (!strcmp(dl, udf->dl) && udf->dlhandle != NULL) DBUG_RETURN(udf->dlhandle); } @@ -441,7 +441,7 @@ int mysql_create_function(THD *thd,udf_func *udf) thd->clear_current_stmt_binlog_row_based(); rw_wrlock(&THR_LOCK_udf); - if ((hash_search(&udf_hash,(uchar*) udf->name.str, udf->name.length))) + if ((my_hash_search(&udf_hash,(uchar*) udf->name.str, udf->name.length))) { my_error(ER_UDF_EXISTS, MYF(0), udf->name.str); goto err; @@ -544,8 +544,8 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name) thd->clear_current_stmt_binlog_row_based(); rw_wrlock(&THR_LOCK_udf); - if (!(udf=(udf_func*) hash_search(&udf_hash,(uchar*) udf_name->str, - (uint) udf_name->length))) + if (!(udf=(udf_func*) my_hash_search(&udf_hash,(uchar*) udf_name->str, + (uint) udf_name->length))) { my_error(ER_FUNCTION_NOT_DEFINED, MYF(0), udf_name->str); goto err; diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 1bc18431cf0..a8da454d416 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -833,7 +833,7 @@ int mysql_update(THD *thd, char buff[STRING_BUFFER_USUAL_SIZE]; my_snprintf(buff, sizeof(buff), ER(ER_UPDATE_INFO), (ulong) found, (ulong) updated, - (ulong) thd->warning_info->statement_warn_count()); + (ulong) thd->warning_info->statement_warn_count()); thd->row_count_func= (thd->client_capabilities & CLIENT_FOUND_ROWS) ? found : updated; my_ok(thd, (ulong) thd->row_count_func, id, buff); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 5a594b4a06a..6fd03b416a6 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -56,8 +56,6 @@ int yylex(void *yylval, void *yythd); -const LEX_STRING null_lex_str= {0,0}; - #define yyoverflow(A,B,C,D,E,F) \ { \ ulong val= *(F); \ @@ -504,7 +502,7 @@ Item* handle_sql2003_note184_exception(THD *thd, Item* left, bool equal, struct sp_cond_type *spcondtype; struct { int vars, conds, hndlrs, curs; } spblock; sp_name *spname; - struct st_lex *lex; + LEX *lex; sp_head *sphead; struct p_elem_val *p_elem_value; enum index_hint_type index_hint; @@ -1147,6 +1145,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); IDENT_sys TEXT_STRING_sys TEXT_STRING_literal NCHAR_STRING opt_component key_cache_name sp_opt_label BIN_NUM label_ident TEXT_STRING_filesystem ident_or_empty + opt_constraint constraint opt_ident %type <lex_str_ptr> opt_table_alias @@ -1155,8 +1154,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); table_ident table_ident_nodb references xid %type <simple_string> - remember_name remember_end opt_ident opt_db text_or_password - opt_constraint constraint + remember_name remember_end opt_db text_or_password %type <string> text_string opt_gconcat_separator @@ -1738,7 +1736,7 @@ create: my_parse_error(ER(ER_SYNTAX_ERROR)); MYSQL_YYABORT; } - key= new Key($2, $4.str, &lex->key_create_info, 0, + key= new Key($2, $4, &lex->key_create_info, 0, lex->col_list); if (key == NULL) MYSQL_YYABORT; @@ -4873,8 +4871,7 @@ key_def: '(' key_list ')' key_options { LEX *lex=Lex; - const char *key_name= $3 ? $3 : $1; - Key *key= new Key($2, key_name, &lex->key_create_info, 0, + Key *key= new Key($2, $3.str ? $3 : $1, &lex->key_create_info, 0, lex->col_list); if (key == NULL) MYSQL_YYABORT; @@ -4884,9 +4881,7 @@ key_def: | opt_constraint FOREIGN KEY_SYM opt_ident '(' key_list ')' references { LEX *lex=Lex; - const char *key_name= $1 ? $1 : $4; - const char *fkey_name = $4 ? $4 : key_name; - Key *key= new Foreign_key(fkey_name, lex->col_list, + Key *key= new Foreign_key($4.str ? $4 : $1, lex->col_list, $8, lex->ref_list, lex->fk_delete_opt, @@ -4895,7 +4890,7 @@ key_def: if (key == NULL) MYSQL_YYABORT; lex->alter_info.key_list.push_back(key); - key= new Key(Key::MULTIPLE, key_name, + key= new Key(Key::MULTIPLE, $1.str ? $1 : $4, &default_key_create_info, 1, lex->col_list); if (key == NULL) @@ -4925,7 +4920,7 @@ check_constraint: ; opt_constraint: - /* empty */ { $$=(char*) 0; } + /* empty */ { $$= null_lex_str; } | constraint { $$= $1; } ; @@ -5430,14 +5425,14 @@ opt_ref_list: ref_list: ref_list ',' ident { - Key_part_spec *key= new Key_part_spec($3.str); + Key_part_spec *key= new Key_part_spec($3, 0); if (key == NULL) MYSQL_YYABORT; Lex->ref_list.push_back(key); } | ident { - Key_part_spec *key= new Key_part_spec($1.str); + Key_part_spec *key= new Key_part_spec($1, 0); if (key == NULL) MYSQL_YYABORT; Lex->ref_list.push_back(key); @@ -5584,7 +5579,7 @@ key_list: key_part: ident { - $$= new Key_part_spec($1.str); + $$= new Key_part_spec($1, 0); if ($$ == NULL) MYSQL_YYABORT; } @@ -5595,15 +5590,15 @@ key_part: { my_error(ER_KEY_PART_0, MYF(0), $1.str); } - $$= new Key_part_spec($1.str,(uint) key_part_len); + $$= new Key_part_spec($1, (uint) key_part_len); if ($$ == NULL) MYSQL_YYABORT; } ; opt_ident: - /* empty */ { $$=(char*) 0; /* Default length */ } - | field_ident { $$=$1.str; } + /* empty */ { $$= null_lex_str; } + | field_ident { $$= $1; } ; opt_component: @@ -12726,6 +12721,7 @@ object_privilege: | CREATE USER { Lex->grant |= CREATE_USER_ACL; } | EVENT_SYM { Lex->grant |= EVENT_ACL;} | TRIGGER_SYM { Lex->grant |= TRIGGER_ACL; } + | CREATE TABLESPACE { Lex->grant |= CREATE_TABLESPACE_ACL; } ; opt_and: diff --git a/sql/structs.h b/sql/structs.h index a58c18f97c5..2c8e1121edc 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -16,8 +16,9 @@ /* The old structures from unireg */ -struct st_table; +struct TABLE; class Field; +class THD; typedef struct st_date_time_format { uchar positions[8]; @@ -97,7 +98,7 @@ typedef struct st_key { union { int bdb_return_if_eq; } handler; - struct st_table *table; + TABLE *table; } KEY; @@ -115,30 +116,6 @@ typedef struct st_reginfo { /* Extra info about reg */ } REGINFO; -struct st_read_record; /* For referense later */ -class SQL_SELECT; -class THD; -class handler; - -typedef struct st_read_record { /* Parameter to read_record */ - struct st_table *table; /* Head-form */ - handler *file; - struct st_table **forms; /* head and ref forms */ - int (*read_record)(struct st_read_record *); - THD *thd; - SQL_SELECT *select; - uint cache_records; - uint ref_length,struct_length,reclength,rec_cache_size,error_offset; - uint index; - uchar *ref_pos; /* pointer to form->refpos */ - uchar *record; - uchar *rec_buf; /* to read field values after filesort */ - uchar *cache,*cache_pos,*cache_end,*read_positions; - IO_CACHE *io_cache; - bool print_error, ignore_not_found_rows; -} READ_RECORD; - - /* Originally MySQL used MYSQL_TIME structure inside server only, but since 4.1 it's exported to user in the new client API. Define aliases for diff --git a/sql/table.cc b/sql/table.cc index d71a3ecd9bb..325e84ca55a 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -423,7 +423,7 @@ void free_table_share(TABLE_SHARE *share) pthread_mutex_destroy(&share->mutex); pthread_cond_destroy(&share->cond); } - hash_free(&share->name_hash); + my_hash_free(&share->name_hash); plugin_unlock(NULL, share->db_plugin); share->db_plugin= NULL; @@ -1147,10 +1147,10 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, use_hash= share->fields >= MAX_FIELDS_BEFORE_HASH; if (use_hash) - use_hash= !hash_init(&share->name_hash, - system_charset_info, - share->fields,0,0, - (hash_get_key) get_field_name,0,0); + use_hash= !my_hash_init(&share->name_hash, + system_charset_info, + share->fields,0,0, + (my_hash_get_key) get_field_name,0,0); for (i=0 ; i < share->fields; i++, strpos+=field_pack_length, field_ptr++) { @@ -1589,7 +1589,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, delete handler_file; #ifndef DBUG_OFF if (use_hash) - (void) hash_check(&share->name_hash); + (void) my_hash_check(&share->name_hash); #endif DBUG_RETURN (0); @@ -1600,7 +1600,9 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, x_free((uchar*) disk_buff); delete crypted; delete handler_file; - hash_free(&share->name_hash); + my_hash_free(&share->name_hash); + if (share->ha_data_destroy) + share->ha_data_destroy(share->ha_data); open_table_error(share, error, share->open_errno, errarg); DBUG_RETURN(error); @@ -2931,7 +2933,7 @@ table_check_intact(TABLE *table, const uint table_f_count, Create Item_field for each column in the table. SYNPOSIS - st_table::fill_item_list() + TABLE::fill_item_list() item_list a pointer to an empty list used to store items DESCRIPTION @@ -2944,7 +2946,7 @@ table_check_intact(TABLE *table, const uint table_f_count, 1 out of memory */ -bool st_table::fill_item_list(List<Item> *item_list) const +bool TABLE::fill_item_list(List<Item> *item_list) const { /* All Item_field's created using a direct pointer to a field @@ -2964,7 +2966,7 @@ bool st_table::fill_item_list(List<Item> *item_list) const Fields of this table. SYNPOSIS - st_table::fill_item_list() + TABLE::fill_item_list() item_list a non-empty list with Item_fields DESCRIPTION @@ -2974,7 +2976,7 @@ bool st_table::fill_item_list(List<Item> *item_list) const is the same as the number of columns in the table. */ -void st_table::reset_item_list(List<Item> *item_list) const +void TABLE::reset_item_list(List<Item> *item_list) const { List_iterator_fast<Item> it(*item_list); for (Field **ptr= field; *ptr; ptr++) @@ -3909,7 +3911,7 @@ const char *Natural_join_column::db_name() return table_ref->view_db.str; /* - Test that TABLE_LIST::db is the same as st_table_share::db to + Test that TABLE_LIST::db is the same as TABLE_SHARE::db to ensure consistency. An exception are I_S schema tables, which are inconsistent in this respect. */ @@ -4128,7 +4130,7 @@ const char *Field_iterator_table_ref::get_db_name() return natural_join_it.column_ref()->db_name(); /* - Test that TABLE_LIST::db is the same as st_table_share::db to + Test that TABLE_LIST::db is the same as TABLE_SHARE::db to ensure consistency. An exception are I_S schema tables, which are inconsistent in this respect. */ @@ -4304,7 +4306,7 @@ Field_iterator_table_ref::get_natural_column_ref() /* Reset all columns bitmaps */ -void st_table::clear_column_bitmaps() +void TABLE::clear_column_bitmaps() { /* Reset column read/write usage. It's identical to: @@ -4325,9 +4327,9 @@ void st_table::clear_column_bitmaps() key fields. */ -void st_table::prepare_for_position() +void TABLE::prepare_for_position() { - DBUG_ENTER("st_table::prepare_for_position"); + DBUG_ENTER("TABLE::prepare_for_position"); if ((file->ha_table_flags() & HA_PRIMARY_KEY_IN_READ_INDEX) && s->primary_key < MAX_KEY) @@ -4346,14 +4348,14 @@ void st_table::prepare_for_position() NOTE: This changes the bitmap to use the tmp bitmap After this, you can't access any other columns in the table until - bitmaps are reset, for example with st_table::clear_column_bitmaps() - or st_table::restore_column_maps_after_mark_index() + bitmaps are reset, for example with TABLE::clear_column_bitmaps() + or TABLE::restore_column_maps_after_mark_index() */ -void st_table::mark_columns_used_by_index(uint index) +void TABLE::mark_columns_used_by_index(uint index) { MY_BITMAP *bitmap= &tmp_set; - DBUG_ENTER("st_table::mark_columns_used_by_index"); + DBUG_ENTER("TABLE::mark_columns_used_by_index"); (void) file->extra(HA_EXTRA_KEYREAD); bitmap_clear_all(bitmap); @@ -4374,9 +4376,9 @@ void st_table::mark_columns_used_by_index(uint index) when calling mark_columns_used_by_index */ -void st_table::restore_column_maps_after_mark_index() +void TABLE::restore_column_maps_after_mark_index() { - DBUG_ENTER("st_table::restore_column_maps_after_mark_index"); + DBUG_ENTER("TABLE::restore_column_maps_after_mark_index"); key_read= 0; (void) file->extra(HA_EXTRA_NO_KEYREAD); @@ -4390,7 +4392,7 @@ void st_table::restore_column_maps_after_mark_index() mark columns used by key, but don't reset other fields */ -void st_table::mark_columns_used_by_index_no_reset(uint index, +void TABLE::mark_columns_used_by_index_no_reset(uint index, MY_BITMAP *bitmap) { KEY_PART_INFO *key_part= key_info[index].key_part; @@ -4409,7 +4411,7 @@ void st_table::mark_columns_used_by_index_no_reset(uint index, always set and sometimes read. */ -void st_table::mark_auto_increment_column() +void TABLE::mark_auto_increment_column() { DBUG_ASSERT(found_next_number_field); /* @@ -4442,7 +4444,7 @@ void st_table::mark_auto_increment_column() retrieve the row again. */ -void st_table::mark_columns_needed_for_delete() +void TABLE::mark_columns_needed_for_delete() { if (triggers) triggers->mark_fields_used(TRG_EVENT_DELETE); @@ -4492,7 +4494,7 @@ void st_table::mark_columns_needed_for_delete() retrieve the row again. */ -void st_table::mark_columns_needed_for_update() +void TABLE::mark_columns_needed_for_update() { DBUG_ENTER("mark_columns_needed_for_update"); if (triggers) @@ -4535,7 +4537,7 @@ void st_table::mark_columns_needed_for_update() as changed. */ -void st_table::mark_columns_needed_for_insert() +void TABLE::mark_columns_needed_for_insert() { if (triggers) { @@ -4565,7 +4567,7 @@ void st_table::mark_columns_needed_for_insert() TABLEs. Each of these TABLEs is called a part of a MERGE table. */ -bool st_table::is_children_attached(void) +bool TABLE::is_children_attached(void) { return((child_l && children_attached) || (parent && parent->children_attached)); @@ -4629,9 +4631,9 @@ Item_subselect *TABLE_LIST::containing_subselect() DESCRIPTION The parser collects the index hints for each table in a "tagged list" (TABLE_LIST::index_hints). Using the information in this tagged list - this function sets the members st_table::keys_in_use_for_query, - st_table::keys_in_use_for_group_by, st_table::keys_in_use_for_order_by, - st_table::force_index and st_table::covering_keys. + this function sets the members TABLE::keys_in_use_for_query, + TABLE::keys_in_use_for_group_by, TABLE::keys_in_use_for_order_by, + TABLE::force_index and TABLE::covering_keys. Current implementation of the runtime does not allow mixing FORCE INDEX and USE INDEX, so this is checked here. Then the FORCE INDEX list diff --git a/sql/table.h b/sql/table.h index 40372fa91cf..6a626421d3a 100644 --- a/sql/table.h +++ b/sql/table.h @@ -290,9 +290,9 @@ TABLE_CATEGORY get_table_category(const LEX_STRING *db, instance of table share per one table in the database. */ -typedef struct st_table_share +struct TABLE_SHARE { - st_table_share() {} /* Remove gcc warning */ + TABLE_SHARE() {} /* Remove gcc warning */ /** Category of this table. */ TABLE_CATEGORY table_category; @@ -305,11 +305,7 @@ typedef struct st_table_share TYPELIB *intervals; /* pointer to interval info */ pthread_mutex_t mutex; /* For locking the share */ pthread_cond_t cond; /* To signal that share is ready */ - struct st_table_share *next, /* Link to unused shares */ - **prev; -#ifdef NOT_YET - struct st_table *open_tables; /* link to open tables */ -#endif + TABLE_SHARE *next, **prev; /* Link to unused shares */ /* The following is copied to each TABLE on OPEN */ Field **field; @@ -423,6 +419,7 @@ typedef struct st_table_share /** place to store storage engine specific data */ void *ha_data; + void (*ha_data_destroy)(void *); /* An optional destructor for ha_data */ /* @@ -592,7 +589,7 @@ typedef struct st_table_share return (tmp_table == SYSTEM_TMP_TABLE || is_view) ? 0 : table_map_id; } -} TABLE_SHARE; +}; extern ulong refresh_version; @@ -605,19 +602,16 @@ enum index_hint_type INDEX_HINT_FORCE }; -struct st_table { - st_table() {} /* Remove gcc warning */ +struct TABLE +{ + TABLE() {} /* Remove gcc warning */ TABLE_SHARE *s; handler *file; -#ifdef NOT_YET - struct st_table *used_next, **used_prev; /* Link to used tables */ - struct st_table *open_next, **open_prev; /* Link to open tables */ -#endif - struct st_table *next, *prev; + TABLE *next, *prev; /* For the below MERGE related members see top comment in ha_myisammrg.cc */ - struct st_table *parent; /* Set in MERGE child. Ptr to parent */ + TABLE *parent; /* Set in MERGE child. Ptr to parent */ TABLE_LIST *child_l; /* Set in MERGE parent. List of children */ TABLE_LIST **child_last_l; /* Set in MERGE parent. End of list */ @@ -999,7 +993,6 @@ typedef struct st_schema_table /** The threshold size a blob field buffer before it is freed */ #define MAX_TDC_BLOB_SIZE 65536 -struct st_lex; class select_union; class TMP_TABLE_PARAM; @@ -1077,6 +1070,7 @@ public: (TABLE_LIST::join_using_fields != NULL) */ +struct LEX; class Index_hint; struct TABLE_LIST { @@ -1197,7 +1191,7 @@ struct TABLE_LIST TMP_TABLE_PARAM *schema_table_param; /* link to select_lex where this table was used */ st_select_lex *select_lex; - st_lex *view; /* link on VIEW lex for merging */ + LEX *view; /* link on VIEW lex for merging */ Field_translator *field_translation; /* array of VIEW fields */ /* pointer to element after last one in translation table above */ Field_translator *field_translation_end; @@ -1412,9 +1406,9 @@ struct TABLE_LIST Item_subselect *containing_subselect(); /* - Compiles the tagged hints list and fills up st_table::keys_in_use_for_query, - st_table::keys_in_use_for_group_by, st_table::keys_in_use_for_order_by, - st_table::force_index and st_table::covering_keys. + Compiles the tagged hints list and fills up TABLE::keys_in_use_for_query, + TABLE::keys_in_use_for_group_by, TABLE::keys_in_use_for_order_by, + TABLE::force_index and TABLE::covering_keys. */ bool process_index_hints(TABLE *table); diff --git a/sql/tztime.cc b/sql/tztime.cc index 6757798ad32..650678c721b 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -1581,17 +1581,17 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap) lex_start(thd); /* Init all memory structures that require explicit destruction */ - if (hash_init(&tz_names, &my_charset_latin1, 20, - 0, 0, (hash_get_key) my_tz_names_get_key, 0, 0)) + if (my_hash_init(&tz_names, &my_charset_latin1, 20, + 0, 0, (my_hash_get_key) my_tz_names_get_key, 0, 0)) { sql_print_error("Fatal error: OOM while initializing time zones"); goto end; } - if (hash_init(&offset_tzs, &my_charset_latin1, 26, 0, 0, - (hash_get_key)my_offset_tzs_get_key, 0, 0)) + if (my_hash_init(&offset_tzs, &my_charset_latin1, 26, 0, 0, + (my_hash_get_key)my_offset_tzs_get_key, 0, 0)) { sql_print_error("Fatal error: OOM while initializing time zones"); - hash_free(&tz_names); + my_hash_free(&tz_names); goto end; } init_alloc_root(&tz_storage, 32 * 1024, 0); @@ -1774,8 +1774,8 @@ void my_tz_free() { tz_inited= 0; VOID(pthread_mutex_destroy(&tz_LOCK)); - hash_free(&offset_tzs); - hash_free(&tz_names); + my_hash_free(&offset_tzs); + my_hash_free(&tz_names); free_root(&tz_storage, MYF(0)); } } @@ -2267,9 +2267,9 @@ my_tz_find(THD *thd, const String *name) if (!str_to_offset(name->ptr(), name->length(), &offset)) { - if (!(result_tz= (Time_zone_offset *)hash_search(&offset_tzs, - (const uchar *)&offset, - sizeof(long)))) + if (!(result_tz= (Time_zone_offset *)my_hash_search(&offset_tzs, + (const uchar *)&offset, + sizeof(long)))) { DBUG_PRINT("info", ("Creating new Time_zone_offset object")); @@ -2285,9 +2285,10 @@ my_tz_find(THD *thd, const String *name) else { result_tz= 0; - if ((tmp_tzname= (Tz_names_entry *)hash_search(&tz_names, - (const uchar *)name->ptr(), - name->length()))) + if ((tmp_tzname= (Tz_names_entry *)my_hash_search(&tz_names, + (const uchar *) + name->ptr(), + name->length()))) result_tz= tmp_tzname->tz; else if (time_zone_tables_exist) { diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index cfa5a721a97..4b4b2620d34 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -172,8 +172,8 @@ int archive_db_init(void *p) if (pthread_mutex_init(&archive_mutex, MY_MUTEX_INIT_FAST)) goto error; - if (hash_init(&archive_open_tables, table_alias_charset, 32, 0, 0, - (hash_get_key) archive_get_key, 0, 0)) + if (my_hash_init(&archive_open_tables, table_alias_charset, 32, 0, 0, + (my_hash_get_key) archive_get_key, 0, 0)) { VOID(pthread_mutex_destroy(&archive_mutex)); } @@ -198,7 +198,7 @@ error: int archive_db_done(void *p) { - hash_free(&archive_open_tables); + my_hash_free(&archive_open_tables); VOID(pthread_mutex_destroy(&archive_mutex)); return 0; @@ -316,9 +316,9 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, int *rc) pthread_mutex_lock(&archive_mutex); length=(uint) strlen(table_name); - if (!(share=(ARCHIVE_SHARE*) hash_search(&archive_open_tables, - (uchar*) table_name, - length))) + if (!(share=(ARCHIVE_SHARE*) my_hash_search(&archive_open_tables, + (uchar*) table_name, + length))) { char *tmp_name; azio_stream archive_tmp; @@ -394,7 +394,7 @@ int ha_archive::free_share() pthread_mutex_lock(&archive_mutex); if (!--share->use_count) { - hash_delete(&archive_open_tables, (uchar*) share); + my_hash_delete(&archive_open_tables, (uchar*) share); thr_lock_delete(&share->lock); VOID(pthread_mutex_destroy(&share->mutex)); /* diff --git a/storage/blackhole/ha_blackhole.cc b/storage/blackhole/ha_blackhole.cc index 03ed57f38e8..e64933f6629 100644 --- a/storage/blackhole/ha_blackhole.cc +++ b/storage/blackhole/ha_blackhole.cc @@ -319,8 +319,9 @@ static st_blackhole_share *get_share(const char *table_name) length= (uint) strlen(table_name); pthread_mutex_lock(&blackhole_mutex); - if (!(share= (st_blackhole_share*) hash_search(&blackhole_open_tables, - (uchar*) table_name, length))) + if (!(share= (st_blackhole_share*) + my_hash_search(&blackhole_open_tables, + (uchar*) table_name, length))) { if (!(share= (st_blackhole_share*) my_malloc(sizeof(st_blackhole_share) + length, @@ -350,7 +351,7 @@ static void free_share(st_blackhole_share *share) { pthread_mutex_lock(&blackhole_mutex); if (!--share->use_count) - hash_delete(&blackhole_open_tables, (uchar*) share); + my_hash_delete(&blackhole_open_tables, (uchar*) share); pthread_mutex_unlock(&blackhole_mutex); } @@ -377,16 +378,16 @@ static int blackhole_init(void *p) blackhole_hton->flags= HTON_CAN_RECREATE; VOID(pthread_mutex_init(&blackhole_mutex, MY_MUTEX_INIT_FAST)); - (void) hash_init(&blackhole_open_tables, system_charset_info,32,0,0, - (hash_get_key) blackhole_get_key, - (hash_free_key) blackhole_free_key, 0); + (void) my_hash_init(&blackhole_open_tables, system_charset_info,32,0,0, + (my_hash_get_key) blackhole_get_key, + (my_hash_free_key) blackhole_free_key, 0); return 0; } static int blackhole_fini(void *p) { - hash_free(&blackhole_open_tables); + my_hash_free(&blackhole_open_tables); pthread_mutex_destroy(&blackhole_mutex); return 0; diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index 63eb572105c..c8777f4477b 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -111,8 +111,8 @@ static int tina_init_func(void *p) tina_hton= (handlerton *)p; VOID(pthread_mutex_init(&tina_mutex,MY_MUTEX_INIT_FAST)); - (void) hash_init(&tina_open_tables,system_charset_info,32,0,0, - (hash_get_key) tina_get_key,0,0); + (void) my_hash_init(&tina_open_tables,system_charset_info,32,0,0, + (my_hash_get_key) tina_get_key,0,0); tina_hton->state= SHOW_OPTION_YES; tina_hton->db_type= DB_TYPE_CSV_DB; tina_hton->create= tina_create_handler; @@ -123,7 +123,7 @@ static int tina_init_func(void *p) static int tina_done_func(void *p) { - hash_free(&tina_open_tables); + my_hash_free(&tina_open_tables); pthread_mutex_destroy(&tina_mutex); return 0; @@ -148,9 +148,9 @@ static TINA_SHARE *get_share(const char *table_name, TABLE *table) If share is not present in the hash, create a new share and initialize its members. */ - if (!(share=(TINA_SHARE*) hash_search(&tina_open_tables, - (uchar*) table_name, - length))) + if (!(share=(TINA_SHARE*) my_hash_search(&tina_open_tables, + (uchar*) table_name, + length))) { if (!my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), &share, sizeof(*share), @@ -377,7 +377,7 @@ static int free_share(TINA_SHARE *share) share->tina_write_opened= FALSE; } - hash_delete(&tina_open_tables, (uchar*) share); + my_hash_delete(&tina_open_tables, (uchar*) share); thr_lock_delete(&share->lock); pthread_mutex_destroy(&share->mutex); my_free((uchar*) share, MYF(0)); @@ -448,6 +448,7 @@ ha_tina::ha_tina(handlerton *hton, TABLE_SHARE *table_arg) buffer.set((char*)byte_buffer, IO_SIZE, &my_charset_bin); chain= chain_buffer; file_buff= new Transparent_file(); + init_alloc_root(&blobroot, BLOB_MEMROOT_ALLOC_SIZE, 0);; } @@ -594,7 +595,7 @@ int ha_tina::find_current_row(uchar *buf) bool read_all; DBUG_ENTER("ha_tina::find_current_row"); - free_root(&blobroot, MYF(MY_MARK_BLOCKS_FREE)); + free_root(&blobroot, MYF(0)); /* We do not read further then local_saved_data_file_length in order @@ -1073,8 +1074,6 @@ int ha_tina::rnd_init(bool scan) records_is_known= 0; chain_ptr= chain; - init_alloc_root(&blobroot, BLOB_MEMROOT_ALLOC_SIZE, 0); - DBUG_RETURN(0); } @@ -1192,6 +1191,7 @@ int ha_tina::extra(enum ha_extra_function operation) DBUG_RETURN(0); } + /* Set end_pos to the last valid byte of continuous area, closest to the given "hole", stored in the buffer. "Valid" here means, @@ -1394,8 +1394,6 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt) /* set current position to the beginning of the file */ current_position= next_position= 0; - init_alloc_root(&blobroot, BLOB_MEMROOT_ALLOC_SIZE, 0); - /* Read the file row-by-row. If everything is ok, repair is not needed. */ while (!(rc= find_current_row(buf))) { @@ -1595,8 +1593,6 @@ int ha_tina::check(THD* thd, HA_CHECK_OPT* check_opt) /* set current position to the beginning of the file */ current_position= next_position= 0; - init_alloc_root(&blobroot, BLOB_MEMROOT_ALLOC_SIZE, 0); - /* Read the file row-by-row. If everything is ok, repair is not needed. */ while (!(rc= find_current_row(buf))) { @@ -1604,7 +1600,7 @@ int ha_tina::check(THD* thd, HA_CHECK_OPT* check_opt) count--; current_position= next_position; } - + free_root(&blobroot, MYF(0)); my_free((char*)buf, MYF(0)); diff --git a/storage/csv/ha_tina.h b/storage/csv/ha_tina.h index 02e0700a825..a246d1858e5 100644 --- a/storage/csv/ha_tina.h +++ b/storage/csv/ha_tina.h @@ -98,6 +98,7 @@ public: my_free(chain, 0); if (file_buff) delete file_buff; + free_root(&blobroot, MYF(0)); } const char *table_type() const { return "CSV"; } const char *index_type(uint inx) { return "NONE"; } diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc index 30fc82c82d2..852dd50cb3e 100644 --- a/storage/example/ha_example.cc +++ b/storage/example/ha_example.cc @@ -133,8 +133,8 @@ static int example_init_func(void *p) example_hton= (handlerton *)p; VOID(pthread_mutex_init(&example_mutex,MY_MUTEX_INIT_FAST)); - (void) hash_init(&example_open_tables,system_charset_info,32,0,0, - (hash_get_key) example_get_key,0,0); + (void) my_hash_init(&example_open_tables,system_charset_info,32,0,0, + (my_hash_get_key) example_get_key,0,0); example_hton->state= SHOW_OPTION_YES; example_hton->create= example_create_handler; @@ -151,7 +151,7 @@ static int example_done_func(void *p) if (example_open_tables.records) error= 1; - hash_free(&example_open_tables); + my_hash_free(&example_open_tables); pthread_mutex_destroy(&example_mutex); DBUG_RETURN(0); @@ -175,9 +175,9 @@ static EXAMPLE_SHARE *get_share(const char *table_name, TABLE *table) pthread_mutex_lock(&example_mutex); length=(uint) strlen(table_name); - if (!(share=(EXAMPLE_SHARE*) hash_search(&example_open_tables, - (uchar*) table_name, - length))) + if (!(share=(EXAMPLE_SHARE*) my_hash_search(&example_open_tables, + (uchar*) table_name, + length))) { if (!(share=(EXAMPLE_SHARE *) my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), @@ -222,7 +222,7 @@ static int free_share(EXAMPLE_SHARE *share) pthread_mutex_lock(&example_mutex); if (!--share->use_count) { - hash_delete(&example_open_tables, (uchar*) share); + my_hash_delete(&example_open_tables, (uchar*) share); thr_lock_delete(&share->lock); pthread_mutex_destroy(&share->mutex); my_free(share, MYF(0)); diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index a3fa42d7d05..05be8b27a8b 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -459,8 +459,8 @@ int federated_db_init(void *p) if (pthread_mutex_init(&federated_mutex, MY_MUTEX_INIT_FAST)) goto error; - if (!hash_init(&federated_open_tables, &my_charset_bin, 32, 0, 0, - (hash_get_key) federated_get_key, 0, 0)) + if (!my_hash_init(&federated_open_tables, &my_charset_bin, 32, 0, 0, + (my_hash_get_key) federated_get_key, 0, 0)) { DBUG_RETURN(FALSE); } @@ -483,7 +483,7 @@ error: int federated_done(void *p) { - hash_free(&federated_open_tables); + my_hash_free(&federated_open_tables); VOID(pthread_mutex_destroy(&federated_mutex)); return 0; @@ -1495,10 +1495,10 @@ static FEDERATED_SHARE *get_share(const char *table_name, TABLE *table) goto error; /* TODO: change tmp_share.scheme to LEX_STRING object */ - if (!(share= (FEDERATED_SHARE *) hash_search(&federated_open_tables, - (uchar*) tmp_share.share_key, - tmp_share. - share_key_length))) + if (!(share= (FEDERATED_SHARE *) my_hash_search(&federated_open_tables, + (uchar*) tmp_share.share_key, + tmp_share. + share_key_length))) { query.set_charset(system_charset_info); query.append(STRING_WITH_LEN("SELECT ")); @@ -1560,7 +1560,7 @@ static int free_share(FEDERATED_SHARE *share) pthread_mutex_lock(&federated_mutex); if (!--share->use_count) { - hash_delete(&federated_open_tables, (uchar*) share); + my_hash_delete(&federated_open_tables, (uchar*) share); thr_lock_delete(&share->lock); VOID(pthread_mutex_destroy(&share->mutex)); free_root(&mem_root, MYF(0)); @@ -2892,7 +2892,7 @@ int ha_federated::info(uint flag) } if (flag & HA_STATUS_AUTO) - stats.auto_increment_value= mysql->last_used_con->insert_id; + stats.auto_increment_value= mysql->insert_id; mysql_free_result(result); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 524bd8ac828..6fdbaaf6af1 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -4497,7 +4497,7 @@ calc_row_difference( upd_t* uvect, /*!< in/out: update vector */ uchar* old_row, /*!< in: old row in MySQL format */ uchar* new_row, /*!< in: new row in MySQL format */ - struct st_table* table, /*!< in: table in MySQL data + TABLE* table, /*!< in: table in MySQL data dictionary */ uchar* upd_buff, /*!< in: buffer to use */ ulint buff_len, /*!< in: buffer length */ diff --git a/storage/innobase/include/handler0alter.h b/storage/innobase/include/handler0alter.h index 985b76f4f50..7f5af6d2e76 100644 --- a/storage/innobase/include/handler0alter.h +++ b/storage/innobase/include/handler0alter.h @@ -27,7 +27,7 @@ UNIV_INTERN void innobase_rec_to_mysql( /*==================*/ - TABLE* table, /*!< in/out: MySQL table */ + struct TABLE* table, /*!< in/out: MySQL table */ const rec_t* rec, /*!< in: record */ const dict_index_t* index, /*!< in: index */ const ulint* offsets); /*!< in: rec_get_offsets( @@ -39,4 +39,4 @@ UNIV_INTERN void innobase_rec_reset( /*===============*/ - TABLE* table); /*!< in/out: MySQL table */ + struct TABLE* table); /*!< in/out: MySQL table */ diff --git a/storage/innobase/include/row0merge.h b/storage/innobase/include/row0merge.h index 62a5efd11f7..fbeb125ce7b 100644 --- a/storage/innobase/include/row0merge.h +++ b/storage/innobase/include/row0merge.h @@ -191,7 +191,7 @@ row_merge_build_indexes( unless creating a PRIMARY KEY */ dict_index_t** indexes, /*!< in: indexes to be created */ ulint n_indexes, /*!< in: size of indexes[] */ - TABLE* table); /*!< in/out: MySQL table, for + struct TABLE* table); /*!< in/out: MySQL table, for reporting erroneous key value if applicable */ #endif /* row0merge.h */ diff --git a/storage/innobase/include/row0types.h b/storage/innobase/include/row0types.h index 7920fd75061..1be729206ba 100644 --- a/storage/innobase/include/row0types.h +++ b/storage/innobase/include/row0types.h @@ -54,6 +54,6 @@ typedef struct purge_node_struct purge_node_t; typedef struct row_ext_struct row_ext_t; /* MySQL data types */ -typedef struct st_table TABLE; +struct TABLE; #endif diff --git a/storage/innobase/row/row0merge.c b/storage/innobase/row/row0merge.c index 05a45dc647c..f48753cd238 100644 --- a/storage/innobase/row/row0merge.c +++ b/storage/innobase/row/row0merge.c @@ -397,7 +397,7 @@ row_merge_buf_add( /** Structure for reporting duplicate records. */ struct row_merge_dup_struct { const dict_index_t* index; /*!< index being sorted */ - TABLE* table; /*!< MySQL table object */ + struct TABLE* table; /*!< MySQL table object */ ulint n_dup; /*!< number of duplicates */ }; @@ -1075,7 +1075,7 @@ ulint row_merge_read_clustered_index( /*===========================*/ trx_t* trx, /*!< in: transaction */ - TABLE* table, /*!< in/out: MySQL table object, + struct TABLE* table, /*!< in/out: MySQL table object, for reporting erroneous records */ const dict_table_t* old_table,/*!< in: table where rows are read from */ @@ -1351,7 +1351,7 @@ row_merge_blocks( ulint* foffs1, /*!< in/out: offset of second source list in the file */ merge_file_t* of, /*!< in/out: output file */ - TABLE* table) /*!< in/out: MySQL table, for + struct TABLE* table) /*!< in/out: MySQL table, for reporting erroneous key value if applicable */ { @@ -1450,7 +1450,7 @@ row_merge( ulint half, /*!< in: half the file */ row_merge_block_t* block, /*!< in/out: 3 buffers */ int* tmpfd, /*!< in/out: temporary file handle */ - TABLE* table) /*!< in/out: MySQL table, for + struct TABLE* table) /*!< in/out: MySQL table, for reporting erroneous key value if applicable */ { @@ -1513,7 +1513,7 @@ row_merge_sort( index entries */ row_merge_block_t* block, /*!< in/out: 3 buffers */ int* tmpfd, /*!< in/out: temporary file handle */ - TABLE* table) /*!< in/out: MySQL table, for + struct TABLE* table) /*!< in/out: MySQL table, for reporting erroneous key value if applicable */ { @@ -2278,7 +2278,7 @@ row_merge_build_indexes( unless creating a PRIMARY KEY */ dict_index_t** indexes, /*!< in: indexes to be created */ ulint n_indexes, /*!< in: size of indexes[] */ - TABLE* table) /*!< in/out: MySQL table, for + struct TABLE* table) /*!< in/out: MySQL table, for reporting erroneous key value if applicable */ { diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 9394b0df40b..5be0fe18824 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -680,6 +680,29 @@ int my_stmt_result(const char *buff) return row_count; } +/* Print the total number of warnings and the warnings themselves. */ + +void my_process_warnings(MYSQL *conn, unsigned expected_warning_count) +{ + MYSQL_RES *result; + int rc; + + if (!opt_silent) + fprintf(stdout, "\n total warnings: %u (expected: %u)\n", + mysql_warning_count(conn), expected_warning_count); + + DIE_UNLESS(mysql_warning_count(mysql) == expected_warning_count); + + rc= mysql_query(conn, "SHOW WARNINGS"); + DIE_UNLESS(rc == 0); + + result= mysql_store_result(conn); + mytest(result); + + rc= my_process_result_set(result); + mysql_free_result(result); +} + /* Utility function to verify a particular column data */ @@ -12478,7 +12501,7 @@ static void test_datetime_ranges() rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - DIE_UNLESS(mysql_warning_count(mysql) != 6); + my_process_warnings(mysql, 12); verify_col_data("t1", "year", "0000-00-00 00:00:00"); verify_col_data("t1", "month", "0000-00-00 00:00:00"); @@ -12509,7 +12532,7 @@ static void test_datetime_ranges() rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - DIE_UNLESS(mysql_warning_count(mysql) != 3); + my_process_warnings(mysql, 6); verify_col_data("t1", "year", "0000-00-00 00:00:00"); verify_col_data("t1", "month", "0000-00-00 00:00:00"); @@ -12548,7 +12571,7 @@ static void test_datetime_ranges() rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); - DIE_UNLESS(mysql_warning_count(mysql) == 2); + my_process_warnings(mysql, 2); verify_col_data("t1", "day_ovfl", "838:59:59"); verify_col_data("t1", "day", "828:30:30"); @@ -17411,6 +17434,7 @@ static void test_bug28386() DBUG_VOID_RETURN; } + static void test_wl4166_1() { MYSQL_STMT *stmt; @@ -17622,6 +17646,167 @@ static void test_wl4166_2() } + +/** + Test how warnings generated during assignment of parameters + are (currently not) preserve in case of reprepare. +*/ + +static void test_wl4166_3() +{ + int rc; + MYSQL_STMT *stmt; + MYSQL_BIND my_bind[1]; + MYSQL_TIME tm[1]; + + myheader("test_wl4166_3"); + + rc= mysql_query(mysql, "drop table if exists t1"); + myquery(rc); + + rc= mysql_query(mysql, "create table t1 (year datetime)"); + myquery(rc); + + stmt= mysql_simple_prepare(mysql, "insert into t1 (year) values (?)"); + check_stmt(stmt); + verify_param_count(stmt, 1); + + bzero((char*) my_bind, sizeof(my_bind)); + my_bind[0].buffer_type= MYSQL_TYPE_DATETIME; + my_bind[0].buffer= &tm[0]; + + rc= mysql_stmt_bind_param(stmt, my_bind); + check_execute(stmt, rc); + + tm[0].year= 10000; + tm[0].month= 1; tm[0].day= 1; + tm[0].hour= 1; tm[0].minute= 1; tm[0].second= 1; + tm[0].second_part= 0; tm[0].neg= 0; + + /* Cause a statement reprepare */ + rc= mysql_query(mysql, "alter table t1 add column c int"); + myquery(rc); + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + /* + Sic: only one warning, instead of two. The warning + about data truncation when assigning a parameter is lost. + This is a bug. + */ + my_process_warnings(mysql, 1); + + verify_col_data("t1", "year", "0000-00-00 00:00:00"); + + mysql_stmt_close(stmt); + + rc= mysql_query(mysql, "drop table t1"); + myquery(rc); +} + + +/** + Test that long data parameters, as well as parameters + that were originally in a different character set, are + preserved in case of reprepare. +*/ + +static void test_wl4166_4() +{ + MYSQL_STMT *stmt; + int rc; + const char *stmt_text; + MYSQL_BIND bind_array[2]; + + /* Represented as numbers to keep UTF8 tools from clobbering them. */ + const char *koi8= "\xee\xd5\x2c\x20\xda\xc1\x20\xd2\xd9\xc2\xc1\xcc\xcb\xd5"; + const char *cp1251= "\xcd\xf3\x2c\x20\xe7\xe0\x20\xf0\xfb\xe1\xe0\xeb\xea\xf3"; + char buf1[16], buf2[16]; + ulong buf1_len, buf2_len; + + myheader("test_wl4166_4"); + + rc= mysql_query(mysql, "drop table if exists t1"); + myquery(rc); + + /* + Create table with binary columns, set session character set to cp1251, + client character set to koi8, and make sure that there is conversion + on insert and no conversion on select + */ + rc= mysql_query(mysql, + "create table t1 (c1 varbinary(255), c2 varbinary(255))"); + myquery(rc); + rc= mysql_query(mysql, "set character_set_client=koi8r, " + "character_set_connection=cp1251, " + "character_set_results=koi8r"); + myquery(rc); + + bzero((char*) bind_array, sizeof(bind_array)); + + bind_array[0].buffer_type= MYSQL_TYPE_STRING; + + bind_array[1].buffer_type= MYSQL_TYPE_STRING; + bind_array[1].buffer= (void *) koi8; + bind_array[1].buffer_length= strlen(koi8); + + stmt= mysql_stmt_init(mysql); + check_stmt(stmt); + + stmt_text= "insert into t1 (c1, c2) values (?, ?)"; + + rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text)); + check_execute(stmt, rc); + + mysql_stmt_bind_param(stmt, bind_array); + + mysql_stmt_send_long_data(stmt, 0, koi8, strlen(koi8)); + + /* Cause a reprepare at statement execute */ + rc= mysql_query(mysql, "alter table t1 add column d int"); + myquery(rc); + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + stmt_text= "select c1, c2 from t1"; + + /* c1 and c2 are binary so no conversion will be done on select */ + rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text)); + check_execute(stmt, rc); + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + bind_array[0].buffer= buf1; + bind_array[0].buffer_length= sizeof(buf1); + bind_array[0].length= &buf1_len; + + bind_array[1].buffer= buf2; + bind_array[1].buffer_length= sizeof(buf2); + bind_array[1].length= &buf2_len; + + mysql_stmt_bind_result(stmt, bind_array); + + rc= mysql_stmt_fetch(stmt); + check_execute(stmt, rc); + + DIE_UNLESS(buf1_len == strlen(cp1251)); + DIE_UNLESS(buf2_len == strlen(cp1251)); + DIE_UNLESS(!memcmp(buf1, cp1251, buf1_len)); + DIE_UNLESS(!memcmp(buf2, cp1251, buf1_len)); + + rc= mysql_stmt_fetch(stmt); + DIE_UNLESS(rc == MYSQL_NO_DATA); + + mysql_stmt_close(stmt); + + rc= mysql_query(mysql, "drop table t1"); + myquery(rc); + rc= mysql_query(mysql, "set names default"); + myquery(rc); +} + /** Bug#38486 Crash when using cursor protocol */ @@ -17652,6 +17837,49 @@ static void test_bug38486(void) DBUG_VOID_RETURN; } + +/** + Bug# 33831 mysql_real_connect() should fail if + given an already connected MYSQL handle. +*/ + +static void test_bug33831(void) +{ + MYSQL *l_mysql; + my_bool error; + + DBUG_ENTER("test_bug33831"); + + error= 0; + + if (!(l_mysql= mysql_init(NULL))) + { + myerror("mysql_init() failed"); + DIE_UNLESS(0); + } + if (!(mysql_real_connect(l_mysql, opt_host, opt_user, + opt_password, current_db, opt_port, + opt_unix_socket, 0))) + { + myerror("connection failed"); + DIE_UNLESS(0); + } + + if (mysql_real_connect(l_mysql, opt_host, opt_user, + opt_password, current_db, opt_port, + opt_unix_socket, 0)) + { + myerror("connection should have failed"); + DIE_UNLESS(0); + } + + + mysql_close(l_mysql); + + DBUG_VOID_RETURN; +} + + static void test_bug40365(void) { uint rc, i; @@ -18335,7 +18563,10 @@ static struct my_tests_st my_tests[]= { { "test_bug28386", test_bug28386 }, { "test_wl4166_1", test_wl4166_1 }, { "test_wl4166_2", test_wl4166_2 }, + { "test_wl4166_3", test_wl4166_3 }, + { "test_wl4166_4", test_wl4166_4 }, { "test_bug38486", test_bug38486 }, + { "test_bug33831", test_bug33831 }, { "test_bug40365", test_bug40365 }, { "test_bug43560", test_bug43560 }, #ifdef HAVE_QUERY_CACHE diff --git a/unittest/mysys/Makefile.am b/unittest/mysys/Makefile.am index be91ef31c9d..f0ffc7a6720 100644 --- a/unittest/mysys/Makefile.am +++ b/unittest/mysys/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (C) 2006 MySQL AB +# Copyright (C) 2009 Sun Microsystems, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -21,7 +21,14 @@ LDADD = $(top_builddir)/unittest/mytap/libmytap.a \ $(top_builddir)/dbug/libdbug.a \ $(top_builddir)/strings/libmystrings.a -noinst_PROGRAMS = bitmap-t base64-t my_atomic-t +noinst_PROGRAMS = bitmap-t base64-t + +if NEED_THREAD +# my_atomic-t is used to check thread functions, so it is safe to +# ignore the file in non-threaded builds. +# In fact, it will not compile without thread support. +noinst_PROGRAMS += my_atomic-t +endif # Don't update the files from bitkeeper %::SCCS/s.% |