diff options
265 files changed, 17240 insertions, 1985 deletions
diff --git a/.bzrignore b/.bzrignore index d284c0f740a..bcdb50c37b4 100644 --- a/.bzrignore +++ b/.bzrignore @@ -585,6 +585,7 @@ heap/hp_test2 help help.c help.h +include/abi_check include/check_abi include/link_sources include/my_config.h diff --git a/client/mysqldump.c b/client/mysqldump.c index 7fae3c023b1..812a158048e 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -1002,6 +1002,205 @@ static int mysql_query_with_error_report(MYSQL *mysql_con, MYSQL_RES **res, return 0; } + +static int fetch_db_collation(const char *db_name, + char *db_cl_name, + int db_cl_size) +{ + bool err_status= FALSE; + char query[QUERY_LENGTH]; + MYSQL_RES *db_cl_res; + MYSQL_ROW db_cl_row; + + my_snprintf(query, sizeof (query), "use %s", db_name); + + if (mysql_query_with_error_report(mysql, NULL, query)) + return 1; + + if (mysql_query_with_error_report(mysql, &db_cl_res, + "select @@collation_database")) + return 1; + + do + { + if (mysql_num_rows(db_cl_res) != 1) + { + err_status= TRUE; + break; + } + + if (!(db_cl_row= mysql_fetch_row(db_cl_res))) + { + err_status= TRUE; + break; + } + + strncpy(db_cl_name, db_cl_row[0], db_cl_size); + db_cl_name[db_cl_size - 1]= 0; /* just in case. */ + + } while (FALSE); + + mysql_free_result(db_cl_res); + + return err_status ? 1 : 0; +} + + +static char *my_case_str(const char *str, + uint str_len, + const char *token, + uint token_len) +{ + my_match_t match; + + uint status= my_charset_latin1.coll->instr(&my_charset_latin1, + str, str_len, + token, token_len, + &match, 1); + + return status ? (char *) str + match.end : NULL; +} + + +static int switch_db_collation(FILE *sql_file, + const char *db_name, + const char *delimiter, + const char *current_db_cl_name, + const char *required_db_cl_name, + int *db_cl_altered) +{ + if (strcmp(current_db_cl_name, required_db_cl_name) != 0) + { + CHARSET_INFO *db_cl= get_charset_by_name(required_db_cl_name, MYF(0)); + + if (!db_cl) + return 1; + + fprintf(sql_file, + "ALTER DATABASE %s CHARACTER SET %s COLLATE %s %s\n", + (const char *) db_name, + (const char *) db_cl->csname, + (const char *) db_cl->name, + (const char *) delimiter); + + *db_cl_altered= 1; + + return 0; + } + + *db_cl_altered= 0; + + return 0; +} + + +static int restore_db_collation(FILE *sql_file, + const char *db_name, + const char *delimiter, + const char *db_cl_name) +{ + CHARSET_INFO *db_cl= get_charset_by_name(db_cl_name, MYF(0)); + + if (!db_cl) + return 1; + + fprintf(sql_file, + "ALTER DATABASE %s CHARACTER SET %s COLLATE %s %s\n", + (const char *) db_name, + (const char *) db_cl->csname, + (const char *) db_cl->name, + (const char *) delimiter); + + return 0; +} + + +static void switch_cs_variables(FILE *sql_file, + const char *delimiter, + const char *character_set_client, + const char *character_set_results, + const char *collation_connection) +{ + fprintf(sql_file, + "/*!50003 SET @saved_cs_client = @@character_set_client */ %s\n" + "/*!50003 SET @saved_cs_results = @@character_set_results */ %s\n" + "/*!50003 SET @saved_col_connection = @@collation_connection */ %s\n" + "/*!50003 SET character_set_client = %s */ %s\n" + "/*!50003 SET character_set_results = %s */ %s\n" + "/*!50003 SET collation_connection = %s */ %s\n", + (const char *) delimiter, + (const char *) delimiter, + (const char *) delimiter, + + (const char *) character_set_client, + (const char *) delimiter, + + (const char *) character_set_results, + (const char *) delimiter, + + (const char *) collation_connection, + (const char *) delimiter); +} + + +static void restore_cs_variables(FILE *sql_file, + const char *delimiter) +{ + fprintf(sql_file, + "/*!50003 SET character_set_client = @saved_cs_client */ %s\n" + "/*!50003 SET character_set_results = @saved_cs_results */ %s\n" + "/*!50003 SET collation_connection = @saved_col_connection */ %s\n", + (const char *) delimiter, + (const char *) delimiter, + (const char *) delimiter); +} + + +static void switch_sql_mode(FILE *sql_file, + const char *delimiter, + const char *sql_mode) +{ + fprintf(sql_file, + "/*!50003 SET @saved_sql_mode = @@sql_mode */ %s\n" + "/*!50003 SET sql_mode = '%s' */ %s\n", + (const char *) delimiter, + + (const char *) sql_mode, + (const char *) delimiter); +} + + +static void restore_sql_mode(FILE *sql_file, + const char *delimiter) +{ + fprintf(sql_file, + "/*!50003 SET sql_mode = @saved_sql_mode */ %s\n", + (const char *) delimiter); +} + + +static void switch_time_zone(FILE *sql_file, + const char *delimiter, + const char *time_zone) +{ + fprintf(sql_file, + "/*!50003 SET @saved_time_zone = @@time_zone */ %s\n" + "/*!50003 SET time_zone = '%s' */ %s\n", + (const char *) delimiter, + + (const char *) time_zone, + (const char *) delimiter); +} + + +static void restore_time_zone(FILE *sql_file, + const char *delimiter) +{ + fprintf(sql_file, + "/*!50003 SET time_zone = @saved_time_zone */ %s\n", + (const char *) delimiter); +} + /* Open a new .sql file to dump the table or view into @@ -1470,10 +1669,14 @@ static uint dump_events_for_db(char *db) char query_buff[QUERY_LENGTH]; char db_name_buff[NAME_LEN*2+3], name_buff[NAME_LEN*2+3]; char *event_name; - char delimiter[QUERY_LENGTH], *delimit_test; + char delimiter[QUERY_LENGTH]; FILE *sql_file= md_result_file; MYSQL_RES *event_res, *event_list_res; MYSQL_ROW row, event_list_row; + + char db_cl_name[MY_CS_NAME_SIZE]; + int db_cl_altered; + DBUG_ENTER("dump_events_for_db"); DBUG_PRINT("enter", ("db: '%s'", db)); @@ -1498,6 +1701,11 @@ static uint dump_events_for_db(char *db) { fprintf(sql_file, "/*!50106 SET @save_time_zone= @@TIME_ZONE */ ;\n"); + /* Get database collation. */ + + if (fetch_db_collation(db_name_buff, db_cl_name, sizeof (db_cl_name))) + DBUG_RETURN(1); + while ((event_list_row= mysql_fetch_row(event_list_res)) != NULL) { event_name= quote_name(event_list_row[1], name_buff, 0); @@ -1520,17 +1728,45 @@ static uint dump_events_for_db(char *db) fprintf(sql_file, "/*!50106 DROP EVENT IF EXISTS %s */%s\n", event_name, delimiter); - delimit_test= create_delimiter(row[3], delimiter, sizeof(delimiter)); - if (delimit_test == NULL) { - fprintf(stderr, "%s: Warning: Can't dump event '%s'\n", - event_name, my_progname); + if (create_delimiter(row[3], delimiter, sizeof(delimiter)) == NULL) + { + fprintf(stderr, "%s: Warning: Can't create delimiter for event '%s'\n", + event_name, my_progname); DBUG_RETURN(1); } fprintf(sql_file, "DELIMITER %s\n", delimiter); - fprintf(sql_file, "/*!50106 SET TIME_ZONE= '%s' */ %s\n", - row[2], delimiter); - fprintf(sql_file, "/*!50106 %s */ %s\n", row[3], delimiter); + + if (switch_db_collation(sql_file, db_name_buff, delimiter, db_cl_name, + row[6], &db_cl_altered)) + { + DBUG_RETURN(1); + } + + switch_cs_variables(sql_file, delimiter, + row[4], /* character_set_client */ + row[4], /* character_set_results */ + row[5]); /* collation_connection */ + + switch_sql_mode(sql_file, delimiter, row[1]); + + switch_time_zone(sql_file, delimiter, row[2]); + + fprintf(sql_file, + "/*!50106 %s */ %s\n", + (const char *) row[3], + (const char *) delimiter); + + restore_time_zone(sql_file, delimiter); + restore_sql_mode(sql_file, delimiter); + restore_cs_variables(sql_file, delimiter); + + if (db_cl_altered) + { + if (restore_db_collation(sql_file, db_name_buff, delimiter, + db_cl_name)) + DBUG_RETURN(1); + } } } /* end of event printing */ mysql_free_result(event_res); @@ -1592,6 +1828,10 @@ static uint dump_routines_for_db(char *db) FILE *sql_file= md_result_file; MYSQL_RES *routine_res, *routine_list_res; MYSQL_ROW row, routine_list_row; + + char db_cl_name[MY_CS_NAME_SIZE]; + int db_cl_altered; + DBUG_ENTER("dump_routines_for_db"); DBUG_PRINT("enter", ("db: '%s'", db)); @@ -1608,10 +1848,10 @@ static uint dump_routines_for_db(char *db) if (lock_tables) mysql_query(mysql, "LOCK TABLES mysql.proc READ"); - if (opt_compact) - fprintf(sql_file, "\n/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;\n"); + /* Get database collation. */ - fprintf(sql_file, "DELIMITER ;;\n"); + if (fetch_db_collation(db_name_buff, db_cl_name, sizeof (db_cl_name))) + DBUG_RETURN(1); /* 0, retrieve and dump functions, 1, procedures */ for (i= 0; i <= 1; i++) @@ -1658,26 +1898,34 @@ static uint dump_routines_for_db(char *db) char *definer_begin; if (opt_drop) - fprintf(sql_file, "/*!50003 DROP %s IF EXISTS %s */;;\n", + fprintf(sql_file, "/*!50003 DROP %s IF EXISTS %s */;\n", routine_type[i], routine_name); /* Cover DEFINER-clause in version-specific comments. TODO: this is definitely a BAD IDEA to parse SHOW CREATE output. - We should user INFORMATION_SCHEMA instead. The only problem is - that now INFORMATION_SCHEMA does not provide information about - routine parameters. + However, we can not use INFORMATION_SCHEMA instead: + 1. INFORMATION_SCHEMA provides data in UTF8, but here we + need data in the original character set; + 2. INFORMATION_SCHEMA does not provide information about + routine parameters now. */ - definer_begin= strstr(row[2], " DEFINER"); + definer_begin= my_case_str(row[2], strlen(row[2]), + C_STRING_WITH_LEN(" DEFINER")); if (definer_begin) { - char *definer_end= strstr(definer_begin, " PROCEDURE"); + char *definer_end= my_case_str(definer_begin, + strlen(definer_begin), + C_STRING_WITH_LEN(" PROCEDURE")); if (!definer_end) - definer_end= strstr(definer_begin, " FUNCTION"); + { + definer_end= my_case_str(definer_begin, strlen(definer_begin), + C_STRING_WITH_LEN(" FUNCTION")); + } if (definer_end) { @@ -1703,13 +1951,34 @@ static uint dump_routines_for_db(char *db) we need to change sql_mode only for the CREATE PROCEDURE/FUNCTION otherwise we may need to re-quote routine_name */ - fprintf(sql_file, "/*!50003 SET SESSION SQL_MODE=\"%s\"*/;;\n", - row[1] /* sql_mode */); - fprintf(sql_file, "/*!50003 %s */;;\n", - (query_str != NULL ? query_str : row[2])); + + if (switch_db_collation(sql_file, db_name_buff, ";", + db_cl_name, row[5], &db_cl_altered)) + { + DBUG_RETURN(1); + } + + switch_cs_variables(sql_file, ";", + row[3], /* character_set_client */ + row[3], /* character_set_results */ + row[4]); /* collation_connection */ + + switch_sql_mode(sql_file, ";", row[1]); + fprintf(sql_file, - "/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/" - ";;\n"); + "DELIMITER ;;\n" + "/*!50003 %s */;;\n" + "DELIMITER ;\n", + (const char *) (query_str != NULL ? query_str : row[2])); + + restore_sql_mode(sql_file, ";"); + restore_cs_variables(sql_file, ";"); + + if (db_cl_altered) + { + if (restore_db_collation(sql_file, db_name_buff, ";", db_cl_name)) + DBUG_RETURN(1); + } my_free(query_str, MYF(MY_ALLOW_ZERO_PTR)); } @@ -1720,8 +1989,6 @@ static uint dump_routines_for_db(char *db) } mysql_free_result(routine_list_res); } /* end of for i (0 .. 1) */ - /* set the delimiter back to ';' */ - fprintf(sql_file, "DELIMITER ;\n"); if (lock_tables) VOID(mysql_query_with_error_report(mysql, 0, "UNLOCK TABLES")); @@ -2239,8 +2506,7 @@ continue_xml: */ -static void dump_triggers_for_table(char *table, - char *db __attribute__((unused))) +static void dump_triggers_for_table(char *table, char *db_name) { char *result_table; char name_buff[NAME_LEN*4+3], table_buff[NAME_LEN*2+3]; @@ -2249,8 +2515,12 @@ static void dump_triggers_for_table(char *table, FILE *sql_file= md_result_file; MYSQL_RES *result; MYSQL_ROW row; + + char db_cl_name[MY_CS_NAME_SIZE]; + int db_cl_altered; + DBUG_ENTER("dump_triggers_for_table"); - DBUG_PRINT("enter", ("db: %s, table: %s", db, table)); + DBUG_PRINT("enter", ("db: %s, table: %s", db_name, table)); /* Do not use ANSI_QUOTES on triggers in dump */ opt_compatible_mode&= ~MASK_ANSI_QUOTES; @@ -2266,62 +2536,113 @@ static void dump_triggers_for_table(char *table, my_fclose(sql_file, MYF(MY_WME)); DBUG_VOID_RETURN; } - if (mysql_num_rows(result)) - { - if (opt_compact) - fprintf(sql_file, "\n/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;\n"); - fprintf(sql_file, "\nDELIMITER ;;\n"); - } + + /* Get database collation. */ + + if (fetch_db_collation(db_name, db_cl_name, sizeof (db_cl_name))) + DBUG_VOID_RETURN; + + /* Dump triggers. */ + while ((row= mysql_fetch_row(result))) { - fprintf(sql_file, - "/*!50003 SET SESSION SQL_MODE=\"%s\" */;;\n" - "/*!50003 CREATE */ ", - row[6] /* sql_mode */); + MYSQL_RES *res2; - if (mysql_num_fields(result) > 7) + my_snprintf(query_buff, sizeof (query_buff), + "SHOW CREATE TRIGGER %s", + quote_name(row[0], name_buff, TRUE)); + + if (mysql_query_with_error_report(mysql, &res2, query_buff)) + { + if (path) + my_fclose(sql_file, MYF(MY_WME)); + maybe_exit(EX_MYSQLERR); + DBUG_VOID_RETURN; + } + + while ((row= mysql_fetch_row(res2))) { + char *query_str= NULL; + char *definer_begin; + /* - mysqldump can be run against the server, that does not support definer - in triggers (there is no DEFINER column in SHOW TRIGGERS output). So, - we should check if we have this column before accessing it. + Cover DEFINER-clause in version-specific comments. + + TODO: this is definitely a BAD IDEA to parse SHOW CREATE output. + However, we can not use INFORMATION_SCHEMA instead: + 1. INFORMATION_SCHEMA provides data in UTF8, but here we + need data in the original character set; + 2. INFORMATION_SCHEMA does not provide information about + routine parameters now. */ - size_t user_name_len; - char user_name_str[USERNAME_LENGTH + 1]; - char quoted_user_name_str[USERNAME_LENGTH * 2 + 3]; - size_t host_name_len; - char host_name_str[HOSTNAME_LENGTH + 1]; - char quoted_host_name_str[HOSTNAME_LENGTH * 2 + 3]; + definer_begin= my_case_str(row[2], strlen(row[2]), + C_STRING_WITH_LEN(" DEFINER")); - parse_user(row[7], strlen(row[7]), user_name_str, &user_name_len, - host_name_str, &host_name_len); + if (definer_begin) + { + char *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(strlen(row[2]) + 23); + + query_str_tail= strnmov(query_str, row[2], + definer_begin - row[2]); + 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); + } + } + + if (switch_db_collation(sql_file, db_name, ";", + db_cl_name, row[5], &db_cl_altered)) + DBUG_VOID_RETURN; + + switch_cs_variables(sql_file, ";", + row[3], /* character_set_client */ + row[3], /* character_set_results */ + row[4]); /* collation_connection */ + + switch_sql_mode(sql_file, ";", row[1]); fprintf(sql_file, - "/*!50017 DEFINER=%s@%s */ ", - quote_name(user_name_str, quoted_user_name_str, FALSE), - quote_name(host_name_str, quoted_host_name_str, FALSE)); - } + "DELIMITER ;;\n" + "/*!50003 %s */;;\n" + "DELIMITER ;\n", + (const char *) (query_str != NULL ? query_str : row[2])); - fprintf(sql_file, - "/*!50003 TRIGGER %s %s %s ON %s FOR EACH ROW%s%s */;;\n\n", - quote_name(row[0], name_buff, 0), /* Trigger */ - row[4], /* Timing */ - row[1], /* Event */ - result_table, - (strchr(" \t\n\r", *(row[3]))) ? "" : " ", - row[3] /* Statement */); + restore_sql_mode(sql_file, ";"); + restore_cs_variables(sql_file, ";"); + + if (db_cl_altered) + { + if (restore_db_collation(sql_file, db_name, ";", db_cl_name)) + DBUG_VOID_RETURN; + } + + my_free(query_str, MYF(MY_ALLOW_ZERO_PTR)); + } + mysql_free_result(res2); } - if (mysql_num_rows(result)) - fprintf(sql_file, - "DELIMITER ;\n" - "/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;\n"); + mysql_free_result(result); + /* make sure to set back opt_compatible mode to original value */ opt_compatible_mode=old_opt_compatible_mode; + DBUG_VOID_RETURN; } @@ -4107,9 +4428,11 @@ static my_bool get_view_structure(char *table, char* db) my_snprintf(query, sizeof(query), - "SELECT CHECK_OPTION, DEFINER, SECURITY_TYPE " \ - "FROM information_schema.views " \ + "SELECT CHECK_OPTION, DEFINER, SECURITY_TYPE, " + " CHARACTER_SET_CLIENT, COLLATION_CONNECTION " + "FROM information_schema.views " "WHERE table_name=\"%s\" AND table_schema=\"%s\"", table, db); + if (mysql_query(mysql, query)) { /* @@ -4195,7 +4518,23 @@ static my_bool get_view_structure(char *table, char* db) } /* Dump view structure to file */ - fprintf(sql_file, "/*!50001 %s */;\n", ds_view.str); + + fprintf(sql_file, + "/*!50001 SET @saved_cs_client = @@character_set_client */;\n" + "/*!50001 SET @saved_cs_results = @@character_set_results */;\n" + "/*!50001 SET @saved_col_connection = @@collation_connection */;\n" + "/*!50001 SET character_set_client = %s */;\n" + "/*!50001 SET character_set_results = %s */;\n" + "/*!50001 SET collation_connection = %s */;\n" + "/*!50001 %s */;\n" + "/*!50001 SET character_set_client = @saved_cs_client */;\n" + "/*!50001 SET character_set_results = @saved_cs_results */;\n" + "/*!50001 SET collation_connection = @saved_col_connection */;\n", + (const char *) row[3], + (const char *) row[3], + (const char *) row[4], + (const char *) ds_view.str); + check_io(sql_file); mysql_free_result(table_res); dynstr_free(&ds_view); diff --git a/include/my_base.h b/include/my_base.h index fad3ce225ef..f26f00e8bfa 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -396,7 +396,12 @@ enum ha_base_keytype { #define HA_ERR_AUTOINC_READ_FAILED 166 /* Failed to get next autoinc value */ #define HA_ERR_AUTOINC_ERANGE 167 /* Failed to set row autoinc value */ #define HA_ERR_GENERIC 168 /* Generic error */ -#define HA_ERR_LAST 168 /*Copy last error nr.*/ +#define HA_ERR_RECORD_IS_THE_SAME 169 /* row not actually updated : + new values same as the old values */ + +#define HA_ERR_LOGGING_IMPOSSIBLE 170 /* It is not possible to log this + statement */ +#define HA_ERR_LAST 170 /*Copy last error nr.*/ /* Add error numbers before HA_ERR_LAST and change it accordingly. */ #define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1) diff --git a/include/my_pthread.h b/include/my_pthread.h index e2cce40182d..27b621de925 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -181,8 +181,7 @@ void pthread_exit(void *a); /* was #define pthread_exit(A) ExitThread(A)*/ #define my_pthread_setprio(A,B) SetThreadPriority(GetCurrentThread(), (B)) #define pthread_kill(A,B) pthread_dummy(0) -#define pthread_join(A,B) \ - ((WaitForSingleObject((A), INFINITE) != WAIT_OBJECT_0) || !CloseHandle(A)) +#define pthread_join(A,B) (WaitForSingleObject((A), INFINITE) != WAIT_OBJECT_0) /* Dummy defines for easier code */ #define pthread_attr_setdetachstate(A,B) pthread_dummy(0) diff --git a/include/my_sys.h b/include/my_sys.h index 9148d0cf29b..ca44f9ed39b 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -912,12 +912,12 @@ extern CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags); extern CHARSET_INFO *get_charset_by_csname(const char *cs_name, uint cs_flags, myf my_flags); -extern bool resolve_charset(CHARSET_INFO **cs, - const char *cs_name, - CHARSET_INFO *default_cs); -extern bool resolve_collation(CHARSET_INFO **cl, - const char *cl_name, - CHARSET_INFO *default_cl); +extern bool resolve_charset(const char *cs_name, + CHARSET_INFO *default_cs, + CHARSET_INFO **cs); +extern bool resolve_collation(const char *cl_name, + CHARSET_INFO *default_cl, + CHARSET_INFO **cl); extern void free_charsets(void); extern char *get_charsets_dir(char *buf); diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index f994397b8fd..a05d061204b 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -168,8 +168,23 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)), } +/* + Free all memory and resources used by the client library + + NOTES + When calling this there should not be any other threads using + the library. + + To make things simpler when used with windows dll's (which calls this + function automaticly), it's safe to call this function multiple times. +*/ + + void STDCALL mysql_server_end() { + if (!mysql_client_init) + return; + #ifdef EMBEDDED_LIBRARY end_embedded_server(); #endif diff --git a/mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test b/mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test new file mode 100644 index 00000000000..926c4106d6d --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test @@ -0,0 +1,290 @@ +############################################# +#Authors: TU and Jeb +#Date: 2007/04 +#Purpose: Generic replication to cluster +# and ensuring that the ndb_apply_status +# table is updated. +############################################# +# Notes: +# include/select_ndb_apply_status.inc +# Selects out the log name, start & end pos +# from the ndb_apply_status table +# +# include/show_binlog_using_logname.inc +# To select out 1 row from offset 1 +# from the start position in the binlog whose +# name is = log_name +# +# include/tpcb.inc +# Creates DATABASE tpcb, the tables and +# stored procedures for loading the DB +# and for running transactions against DB. +############################################## + + +--echo +--echo *** Test 1 *** +--echo + +connection master; +create table t1 (a int key, b int) engine innodb; +create table t2 (a int key, b int) engine innodb; + +--echo + +--sync_slave_with_master +alter table t1 engine ndb; +alter table t2 engine ndb; + +--echo + +# check binlog position without begin +connection master; +insert into t1 values (1,2); + +--echo + +--sync_slave_with_master +--source include/select_ndb_apply_status.inc + +--echo + +connection master; +# here is actually a bug, since there is no begin statement, the +# query is autocommitted, and end_pos shows end of the insert and not +# end of the commit +--replace_result $start_pos <start_pos> +--replace_column 5 # +--eval show binlog events from $start_pos limit 1 +--echo +--replace_result $start_pos <start_pos> $end_pos <end_pos> +--replace_column 2 # +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ +--eval show binlog events from $start_pos limit 1,1 + +--echo + +# check binlog position with begin +begin; +insert into t1 values (2,3); +insert into t2 values (3,4); +commit; + +--echo + +--sync_slave_with_master +--source include/select_ndb_apply_status.inc + +connection master; +--replace_result $start_pos <start_pos> +--replace_column 5 # +--eval show binlog events from $start_pos limit 1 +--echo +--replace_result $start_pos <start_pos> +--replace_column 2 # 4 # 5 # +--eval show binlog events from $start_pos limit 1,2 +--echo +--replace_result $start_pos <start_pos> $end_pos <end_pos> +--replace_column 2 # +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ +--eval show binlog events from $start_pos limit 3,1 + +--echo + +connection master; +DROP TABLE test.t1, test.t2; +--sync_slave_with_master +SHOW TABLES; + +# Run in some transactions using stored procedures +# and ensure that the ndb_apply_status table is +# updated to show the transactions + + +--echo +--echo *** Test 2 *** +--echo + +# Create database/tables and stored procdures +connection master; +--source include/tpcb.inc + +# Switch tables on slave to use NDB +--sync_slave_with_master +USE tpcb; +ALTER TABLE account ENGINE NDB; +ALTER TABLE branch ENGINE NDB; +ALTER TABLE teller ENGINE NDB; +ALTER TABLE history ENGINE NDB; + +--echo + +# Load DB tpcb and run some transactions +connection master; +--disable_query_log +CALL tpcb.load(); +SET AUTOCOMMIT=0; +let $run= 5; +while ($run) +{ + START TRANSACTION; + --eval CALL tpcb.trans($rpl_format); + eval SET @my_errno= $mysql_errno; + let $run_good= `SELECT @my_errno = 0`; + let $run_bad= `SELECT @my_errno <> 0`; + if ($run_good) + { + COMMIT; + } + if ($run_bad) + { + ROLLBACK; + } + dec $run; +} + +SET AUTOCOMMIT=1; +--enable_query_log + +--sync_slave_with_master +--source include/select_ndb_apply_status.inc + +--echo + +connection master; +--source include/show_binlog_using_logname.inc + +# Flush the logs on the master moving all +# Transaction to a new binlog and ensure +# that the ndb_apply_status table is updated +# to show the use of the new binlog. + +--echo +--echo ** Test 3 ** +--echo + +# Flush logs on master which should force it +# to switch to binlog #2 + +FLUSH LOGS; + +# Run in some transaction to increase end pos in +# binlog + +--disable_query_log +SET AUTOCOMMIT=0; +let $run= 5; +while ($run) +{ + START TRANSACTION; + --eval CALL tpcb.trans($rpl_format); + eval SET @my_errno= $mysql_errno; + let $run_good= `SELECT @my_errno = 0`; + let $run_bad= `SELECT @my_errno <> 0`; + if ($run_good) + { + COMMIT; + } + if ($run_bad) + { + ROLLBACK; + } + dec $run; +} +SET AUTOCOMMIT=1; +--enable_query_log + +--echo + +--sync_slave_with_master +--source include/select_ndb_apply_status.inc + +--echo + +connection master; +--source include/show_binlog_using_logname.inc + +# Now we reset both the master and the slave +# Run some more transaction and ensure +# that the ndb_apply_status is updated +# correctly + +--echo +--echo ** Test 4 ** +--echo + +# Reset both slave and master +# This should reset binlog to #1 +--source include/master-slave-reset.inc + +--echo + +# Run in some transactions and check +connection master; +--disable_query_log +SET AUTOCOMMIT=0; +let $run= 5; +while ($run) +{ + START TRANSACTION; + --eval CALL tpcb.trans($rpl_format); + eval SET @my_errno= $mysql_errno; + let $run_good= `SELECT @my_errno = 0`; + let $run_bad= `SELECT @my_errno <> 0`; + if ($run_good) + { + COMMIT; + } + if ($run_bad) + { + ROLLBACK; + } + dec $run; +} +SET AUTOCOMMIT=1; +--enable_query_log + +--sync_slave_with_master +--source include/select_ndb_apply_status.inc + +--echo + +connection master; +--source include/show_binlog_using_logname.inc + +# Since we are doing replication, it is a good +# idea to check to make sure all data was +# Replicated correctly + +--echo +--echo *** DUMP MASTER & SLAVE FOR COMPARE ******** + +--exec $MYSQL_DUMP -n -t --compact --order-by-primary --skip-extended-insert tpcb account teller branch history > $MYSQLTEST_VARDIR/tmp/master_apply_status.sql + +--exec $MYSQL_DUMP_SLAVE -n -t --compact --order-by-primary --skip-extended-insert tpcb account teller branch history > $MYSQLTEST_VARDIR/tmp/slave_apply_status.sql + +connection master; +DROP DATABASE tpcb; + +--sync_slave_with_master + +####### Commenting out until decision on Bug#27960 ########### + +#--source include/select_ndb_apply_status.inc + +#connection master; +#--eval SHOW BINLOG EVENTS in '$log_name' from $start_pos +#--source include/show_binlog_using_logname.inc + +--echo ****** Do dumps compare ************ + + +diff_files $MYSQLTEST_VARDIR/tmp/master_apply_status.sql $MYSQLTEST_VARDIR/tmp/slave_apply_status.sql; + +## Note: Ths files should only get removed, if the above diff succeeds. + +--exec rm $MYSQLTEST_VARDIR/tmp/master_apply_status.sql +--exec rm $MYSQLTEST_VARDIR/tmp/slave_apply_status.sql + + +# End of 5.1 Test diff --git a/mysql-test/extra/rpl_tests/rpl_row_UUID.test b/mysql-test/extra/rpl_tests/rpl_row_UUID.test index ee2a29ac938..9f2dbb4ce4b 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_UUID.test +++ b/mysql-test/extra/rpl_tests/rpl_row_UUID.test @@ -41,7 +41,7 @@ end| delimiter ;| # test both in SELECT and in INSERT select fn1(0); -create table t2 (a int); +eval create table t2 (a int) engine=$engine_type; insert into t2 values(fn1(2)); sync_slave_with_master; diff --git a/mysql-test/include/ddl_i18n.check_events.inc b/mysql-test/include/ddl_i18n.check_events.inc new file mode 100644 index 00000000000..8b0d70e3c0e --- /dev/null +++ b/mysql-test/include/ddl_i18n.check_events.inc @@ -0,0 +1,48 @@ +# - Check SHOW CREATE statement; + +--echo +--echo + +SHOW CREATE EVENT ev1| +--echo +SHOW CREATE EVENT ev2| +--echo +SHOW CREATE EVENT mysqltest2.ev3| +--echo +SHOW CREATE EVENT mysqltest2.ev3| + +# - Check SHOW statement; + +--echo +--echo + +SHOW EVENTS LIKE 'ev1'| + +--echo +SHOW EVENTS LIKE 'ev2'| + +--echo +SHOW EVENTS LIKE 'ev3'| + +--echo +SHOW EVENTS LIKE 'ev4'| + +# - Check INFORMATION_SCHEMA; + +--echo +--echo + +--replace_column 17 CREATED 18 LAST_ALTERED +SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev1'| + +--echo +--replace_column 17 CREATED 18 LAST_ALTERED +SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev2'| + +--echo +--replace_column 17 CREATED 18 LAST_ALTERED +SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev3'| + +--echo +--replace_column 17 CREATED 18 LAST_ALTERED +SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev4'| diff --git a/mysql-test/include/ddl_i18n.check_sp.inc b/mysql-test/include/ddl_i18n.check_sp.inc new file mode 100644 index 00000000000..bb1657d7072 --- /dev/null +++ b/mysql-test/include/ddl_i18n.check_sp.inc @@ -0,0 +1,83 @@ +# - Check SHOW CREATE statement; + +--echo +--echo + +SHOW CREATE PROCEDURE p1| +--echo +SHOW CREATE PROCEDURE p2| +--echo +SHOW CREATE PROCEDURE mysqltest2.p3| +--echo +SHOW CREATE PROCEDURE mysqltest2.p4| + +# - Check SHOW statement; + +--echo +--echo + +--replace_column 5 MODIFIED 6 CREATED +SHOW PROCEDURE STATUS LIKE 'p1'| + +--echo +--replace_column 5 MODIFIED 6 CREATED +SHOW PROCEDURE STATUS LIKE 'p2'| + +--echo +--replace_column 5 MODIFIED 6 CREATED +SHOW PROCEDURE STATUS LIKE 'p3'| + +--echo +--replace_column 5 MODIFIED 6 CREATED +SHOW PROCEDURE STATUS LIKE 'p4'| + +# - Check INFORMATION_SCHEMA; + +--echo +--echo + +--replace_column 16 CREATED 17 ALTERED +SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p1'| + +--echo +--replace_column 16 CREATED 17 ALTERED +SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p2'| + +--echo +--replace_column 16 CREATED 17 ALTERED +SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p3'| + +--echo +--replace_column 16 CREATED 17 ALTERED +SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p4'| + +# - Initialize the used variables (actual values don't matter); + +--echo +--echo + +SET @a = '1'| +SET @b = '2'| + +# - Execute the routines; + +--echo +--echo + +CALL p1(@a, @b)| +SELECT COLLATION(@a) AS ca, COLLATION(@b) cb| + +--echo + +CALL p2(@a, @b)| +SELECT COLLATION(@a) AS ca, COLLATION(@b) cb| + +--echo + +CALL mysqltest2.p3(@a, @b)| +SELECT COLLATION(@a) AS ca, COLLATION(@b) cb| + +--echo + +CALL mysqltest2.p4(@a, @b)| +SELECT COLLATION(@a) AS ca, COLLATION(@b) cb| diff --git a/mysql-test/include/ddl_i18n.check_triggers.inc b/mysql-test/include/ddl_i18n.check_triggers.inc new file mode 100644 index 00000000000..dbfbc3cda5e --- /dev/null +++ b/mysql-test/include/ddl_i18n.check_triggers.inc @@ -0,0 +1,106 @@ +# - Check SHOW CREATE statement; + +--echo +--echo + +SHOW CREATE TRIGGER trg1| +--echo +SHOW CREATE TRIGGER trg2| +--echo +SHOW CREATE TRIGGER mysqltest2.trg3| +--echo +SHOW CREATE TRIGGER mysqltest2.trg4| + +# - Check SHOW statement; + +--echo +--echo + +SHOW TRIGGERS| + +--echo + +use mysqltest2| + +--echo + +SHOW TRIGGERS| + +use mysqltest1| + +# - Check INFORMATION_SCHEMA; + +--echo +--echo + +--replace_column 17 CREATED +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg1'| + +--echo +--replace_column 17 CREATED +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg2'| + +--echo +--replace_column 17 CREATED +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg3'| + +--echo +--replace_column 17 CREATED +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg4'| + +# - Initialize the used variables (actual values don't matter); + +--echo +--echo + +SET @a1 = '1'| +SET @a2 = '1'| +SET @a3 = '1'| + +SET @b1 = '2'| +SET @b2 = '2'| +SET @b3 = '2'| + +# - Execute the triggers; + +--echo +--echo + +INSERT INTO t1 VALUES(1)| + +--echo +--echo ---> Log: +SELECT msg FROM log| + +--echo +SELECT + COLLATION(@a1) AS ca1, + COLLATION(@a2) AS ca2, + COLLATION(@a3) AS ca3, + COLLATION(@b1) AS cb1, + COLLATION(@b2) AS cb2, + COLLATION(@b3) AS cb3| + +--echo +DELETE FROM log| + +--echo +--echo + +INSERT INTO mysqltest2.t1 VALUES(1)| + +--echo +--echo ---> Log: +SELECT msg FROM mysqltest2.log| + +--echo +SELECT + COLLATION(@a1) AS ca1, + COLLATION(@a2) AS ca2, + COLLATION(@a3) AS ca3, + COLLATION(@b1) AS cb1, + COLLATION(@b2) AS cb2, + COLLATION(@b3) AS cb3| + +--echo +DELETE FROM mysqltest2.log| diff --git a/mysql-test/include/ddl_i18n.check_views.inc b/mysql-test/include/ddl_i18n.check_views.inc new file mode 100644 index 00000000000..727f3506e4a --- /dev/null +++ b/mysql-test/include/ddl_i18n.check_views.inc @@ -0,0 +1,32 @@ +# - Check SHOW CREATE statement; + +--echo +--echo + +SHOW CREATE VIEW v1| + +--echo + +SHOW CREATE VIEW v2| + +# - Check INFORMATION_SCHEMA; + +--echo +--echo + +SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'| + +--echo + +SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'| + +# - Execute the views; + +--echo +--echo + +SELECT COLLATION(c1), COLLATION(c2) FROM v1| + +--echo + +SELECT COLLATION(c1) FROM v2| diff --git a/mysql-test/include/have_cp1251.inc b/mysql-test/include/have_cp1251.inc new file mode 100644 index 00000000000..2d5f1b3b529 --- /dev/null +++ b/mysql-test/include/have_cp1251.inc @@ -0,0 +1,7 @@ +--require r/have_cp1251.require + +--disable_query_log + +SHOW COLLATION LIKE 'cp1251_general_ci'; + +--enable_query_log diff --git a/mysql-test/include/have_cp866.inc b/mysql-test/include/have_cp866.inc new file mode 100644 index 00000000000..27390d87d51 --- /dev/null +++ b/mysql-test/include/have_cp866.inc @@ -0,0 +1,7 @@ +--require r/have_cp866.require + +--disable_query_log + +SHOW COLLATION LIKE 'cp866_general_ci'; + +--enable_query_log diff --git a/mysql-test/include/have_koi8r.inc b/mysql-test/include/have_koi8r.inc new file mode 100644 index 00000000000..1fe163565ba --- /dev/null +++ b/mysql-test/include/have_koi8r.inc @@ -0,0 +1,7 @@ +--require r/have_koi8r.require + +--disable_query_log + +SHOW COLLATION LIKE 'koi8r_general_ci'; + +--enable_query_log diff --git a/mysql-test/include/have_utf8.inc b/mysql-test/include/have_utf8.inc new file mode 100644 index 00000000000..58b74f4072f --- /dev/null +++ b/mysql-test/include/have_utf8.inc @@ -0,0 +1,7 @@ +--require r/have_utf8.require + +--disable_query_log + +SHOW COLLATION LIKE 'utf8_general_ci'; + +--enable_query_log diff --git a/mysql-test/include/mix1.inc b/mysql-test/include/mix1.inc index cc2f0e0588e..aa8720fe2f8 100644 --- a/mysql-test/include/mix1.inc +++ b/mysql-test/include/mix1.inc @@ -672,6 +672,54 @@ SELECT * FROM t3 WHERE a = 'uk'; DROP TABLE t1,t2,t3; +# +# Test bug when trying to drop data file which no InnoDB directory entry +# + +create table t1 (a int) engine=innodb; +copy_file $MYSQLTEST_VARDIR/master-data/test/t1.frm $MYSQLTEST_VARDIR/master-data/test/t2.frm; +--error 1146 +select * from t2; +drop table t1; +--error 1051 +drop table t2; +create table t2 (a int); +drop table t2; + + +# +# Bug #29154: LOCK TABLES is not atomic when >1 InnoDB tables are locked +# + +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +CREATE TABLE t2 (a INT) ENGINE=InnoDB; + +CONNECT (c1,localhost,root,,); +CONNECT (c2,localhost,root,,); + +--echo switch to connection c1 +CONNECTION c1; +SET AUTOCOMMIT=0; +INSERT INTO t2 VALUES (1); + +--echo switch to connection c2 +CONNECTION c2; +SET AUTOCOMMIT=0; +--error ER_LOCK_WAIT_TIMEOUT +LOCK TABLES t1 READ, t2 READ; + +--echo switch to connection c1 +CONNECTION c1; +COMMIT; +INSERT INTO t1 VALUES (1); + +--echo switch to connection default +CONNECTION default; +SET AUTOCOMMIT=default; +DISCONNECT c1; +DISCONNECT c2; +DROP TABLE t1,t2; + --echo End of 5.0 tests # diff --git a/mysql-test/include/query_cache_sql_prepare.inc b/mysql-test/include/query_cache_sql_prepare.inc index cdb3bd586e7..cf6d4c26959 100644 --- a/mysql-test/include/query_cache_sql_prepare.inc +++ b/mysql-test/include/query_cache_sql_prepare.inc @@ -33,7 +33,7 @@ drop table if exists t1; create table t1(c1 int); insert into t1 values(1),(10),(100); -# Prepared statements has no parameters, query caching should happen +# First, prepared statements with no parameters prepare stmt1 from "select * from t1 where c1=10"; show status like 'Qcache_hits'; execute stmt1; @@ -113,7 +113,9 @@ show status like 'Qcache_hits'; --echo ---- switch to connection default ---- connection default; -# Prepared statement has parameters, query caching should not happen +# Query caching also works when statement has parameters +# (BUG#29318 Statements prepared with PREPARE and with one parameter don't use +# query cache) prepare stmt1 from "select * from t1 where c1=?"; show status like 'Qcache_hits'; set @a=1; @@ -127,6 +129,12 @@ set @a=1; prepare stmt4 from "select * from t1 where c1=?"; execute stmt4 using @a; show status like 'Qcache_hits'; +# verify that presence of user variables forbids caching +prepare stmt4 from "select @a from t1 where c1=?"; +execute stmt4 using @a; +show status like 'Qcache_hits'; +execute stmt4 using @a; +show status like 'Qcache_hits'; --echo ---- switch to connection default ---- connection default; diff --git a/mysql-test/include/rpl_events.inc b/mysql-test/include/rpl_events.inc index bbe52d3628b..4b57468b2d7 100644 --- a/mysql-test/include/rpl_events.inc +++ b/mysql-test/include/rpl_events.inc @@ -13,52 +13,63 @@ drop table if exists t1,t2; # first, we need a table to record something from an event eval CREATE TABLE `t1` ( - `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `id` INT(10) UNSIGNED NOT NULL, `c` VARCHAR(50) NOT NULL, `ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=$engine_type DEFAULT CHARSET=utf8; -INSERT INTO t1 (c) VALUES ('manually'); +INSERT INTO t1 (id, c) VALUES (1, 'manually'); -# then, we create the event -CREATE EVENT test.justonce ON SCHEDULE AT NOW() + INTERVAL 2 SECOND DO INSERT INTO t1 -(c) VALUES ('from justonce'); +# We create the event so that it inserts exactly 1 row in the table +# A recuring event is used so that we can be sure the event will +# fire regardless of timing delays on the server. Otherwise, it is +# possible for the event to timeout before it has inserted a row. +--echo "Creating event test.justonce on the master" +CREATE EVENT test.justonce ON SCHEDULE EVERY 2 SECOND DO + INSERT IGNORE INTO t1 (id, c) VALUES (2, 'from justonce'); +# Show the event is alive and present on master +--echo "Checking event is active on master" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce'; -# wait 3 seconds, so the event can trigger ---real_sleep 3 -let $wait_condition= - SELECT count(*) = 1 FROM t1 WHERE c = 'from justonce'; ---source include/wait_condition.inc +# Wait until event has fired. We know this because t1 will contain +# the row from the event. +let $wait_condition= + SELECT COUNT(*) = 1 FROM t1 WHERE c = 'from justonce'; +--source include/wait_condition.inc # check that table t1 contains something ---echo "in the master" +--echo "Checking event data on the master" --enable_info --replace_column 3 TIMESTAMP -SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id; +SELECT * FROM t1 ORDER BY id; --disable_info sync_slave_with_master; ---echo "in the slave" +--echo "Checking event data on the slave" --enable_info --replace_column 3 TIMESTAMP -SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id; +SELECT * FROM t1 ORDER BY id; --disable_info +--echo "Checking event is inactive on slave" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce'; # Create an event on the slave and check to see what the originator is. +--echo "Dropping event test.slave_once on the slave" --disable_warnings DROP EVENT IF EXISTS test.slave_once; --enable_warnings CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO -INSERT INTO t1(c) VALUES ('from slave_once'); + INSERT IGNORE INTO t1(id, c) VALUES (3, 'from slave_once'); + +--echo "Checking event status on the slave for originator value = slave's server_id" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once'; +--echo "Dropping event test.slave_once on the slave" --disable_warnings DROP EVENT IF EXISTS test.slave_once; --enable_warnings @@ -66,57 +77,74 @@ DROP EVENT IF EXISTS test.slave_once; connection master; # BUG#20384 - disable events on slave +--echo "Dropping event test.justonce on the master" --disable_warnings DROP EVENT IF EXISTS test.justonce; --enable_warnings +--echo "Creating event test.er on the master" CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO -INSERT INTO t1(c) VALUES ('from er'); + INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er'); + +--echo "Checking event status on the master" SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; sync_slave_with_master; ---echo "in the slave" +--echo "Checking event status on the slave" SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; connection master; ---echo "in the master" -ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO INSERT into t1(c) VALUES ('from alter er'); +--echo "Altering event test.er on the master" +ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO + INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er'); + +--echo "Checking event status on the master" SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; sync_slave_with_master; ---echo "in the slave" +--echo "Checking event status on the slave" SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; connection master; ---echo "in the master" +--echo "Dropping event test.er on the master" DROP EVENT test.er; + +--echo "Checking event status on the master" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; --disable_info sync_slave_with_master; ---echo "in the slave" +--echo "Checking event status on the slave" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; # test the DISABLE ON SLAVE for setting event SLAVESIDE_DISABLED as status # on CREATE EVENT -CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND -DO INSERT INTO t1(c) VALUES ('from slave_terminate'); +--echo "Creating event test.slave_terminate on the slave" +CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DO + INSERT IGNORE INTO t1(id, c) VALUES (6, 'from slave_terminate'); + +--echo "Checking event status on the slave" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate'; +--echo "Dropping event test.slave_terminate on the slave" DROP EVENT test.slave_terminate; -CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND -DISABLE ON SLAVE DO INSERT INTO t1(c) VALUES ('from slave_terminate'); +--echo "Creating event test.slave_terminate with DISABLE ON SLAVE on the slave" +CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DISABLE ON SLAVE DO + INSERT IGNORE INTO t1(c) VALUES (7, 'from slave_terminate'); + +--echo "Checking event status on the slave" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate'; +--echo "Dropping event test.slave_terminate on the slave" DROP EVENT test.slave_terminate; ---echo "in the master" +--echo "Cleanup" connection master; DROP TABLE t1; diff --git a/mysql-test/include/select_ndb_apply_status.inc b/mysql-test/include/select_ndb_apply_status.inc new file mode 100644 index 00000000000..a676b7cfb06 --- /dev/null +++ b/mysql-test/include/select_ndb_apply_status.inc @@ -0,0 +1,13 @@ +################################################## +# Author: Jeb +# Date: 2007/04 +# Purpose: To select out log name, start and end +# positions from ndb_apply_status table +################################################## +--replace_column 1 <log_name> 2 <start_pos> 3 <end_pos> +select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos + from mysql.ndb_apply_status; +--let $start_pos = `select @start_pos` +--let $end_pos = `select @end_pos` +--let $log_name = `select @log_name` + diff --git a/mysql-test/include/show_binlog_using_logname.inc b/mysql-test/include/show_binlog_using_logname.inc new file mode 100644 index 00000000000..d78c28e5916 --- /dev/null +++ b/mysql-test/include/show_binlog_using_logname.inc @@ -0,0 +1,13 @@ +######################################################## +# Author: Jeb +# Date: 2007/04 +# Purpose: To select out 1 row from offset 1 +# from the start position in the binlog whose +# name is = log_name +######################################################## + +--replace_result $start_pos <start_pos> $end_pos <end_pos> +--replace_column 2 # +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ +--eval show binlog events in '$log_name' from $start_pos limit $off_set,1 + diff --git a/mysql-test/include/tpcb.inc b/mysql-test/include/tpcb.inc new file mode 100644 index 00000000000..84a5c98f9c2 --- /dev/null +++ b/mysql-test/include/tpcb.inc @@ -0,0 +1,155 @@ +################################################## +# Author: Jeb +# Date: 2007/04 +# Purpose: To create a tpcb database, tables and +# stored procedures to load the database +# and run transactions against the DB +################################################## +--disable_warnings +DROP DATABASE IF EXISTS tpcb; +--enable_warnings +CREATE DATABASE tpcb; + +--echo +CREATE TABLE tpcb.account (id INT, bid INT, balance DECIMAL(10,2), + filler CHAR(255), PRIMARY KEY(id)); +--echo +CREATE TABLE tpcb.branch (bid INT, balance DECIMAL(10,2), filler VARCHAR(255), + PRIMARY KEY(bid)); +--echo +CREATE TABLE tpcb.teller (tid INT, balance DECIMAL(10,2), filler VARCHAR(255), + PRIMARY KEY(tid)); +--echo +CREATE TABLE tpcb.history (id MEDIUMINT NOT NULL AUTO_INCREMENT,aid INT, + tid INT, bid INT, amount DECIMAL(10,2), + tdate DATETIME, teller CHAR(20), uuidf LONGBLOB, + filler CHAR(80),PRIMARY KEY (id)); + +--echo +--echo --- Create stored procedures & functions --- +--echo + +--disable_query_log +delimiter |; +CREATE PROCEDURE tpcb.load() +BEGIN + DECLARE acct INT DEFAULT 100; + DECLARE brch INT DEFAULT 10; + DECLARE tell INT DEFAULT 100; + DECLARE tmp INT DEFAULT 10; + WHILE brch > 0 DO + SET tmp = 100; + WHILE tmp > 0 DO + INSERT INTO tpcb.account VALUES (acct, brch, 0.0, "FRESH ACCOUNT"); + SET acct = acct - 1; + SET tmp = tmp -1; + END WHILE; + INSERT INTO tpcb.branch VALUES (brch, 0.0, "FRESH BRANCH"); + SET brch = brch - 1; + END WHILE; + WHILE tell > 0 DO + INSERT INTO tpcb.teller VALUES (tell, 0.0, "FRESH TELLER"); + SET tell = tell - 1; + END WHILE; +END| + +CREATE FUNCTION tpcb.account_id () RETURNS INT +BEGIN + DECLARE num INT; + DECLARE ran INT; + SELECT RAND() * 10 INTO ran; + IF (ran < 5) + THEN + SELECT RAND() * 10 INTO num; + ELSE + SELECT RAND() * 100 INTO num; + END IF; + IF (num < 1) + THEN + RETURN 1; + END IF; + RETURN num; +END| + +CREATE FUNCTION tpcb.teller_id () RETURNS INT +BEGIN + DECLARE num INT; + DECLARE ran INT; + SELECT RAND() * 10 INTO ran; + IF (ran < 5) + THEN + SELECT RAND() * 10 INTO num; + ELSE + SELECT RAND() * 100 INTO num; + END IF; + IF (num < 1) + THEN + RETURN 1; + END IF; + RETURN num; +END| + +CREATE PROCEDURE tpcb.trans(in format varchar(3)) +BEGIN + DECLARE acct INT DEFAULT 0; + DECLARE brch INT DEFAULT 0; + DECLARE tell INT DEFAULT 0; + DECLARE bal DECIMAL(10,2) DEFAULT 0.0; + DECLARE amount DECIMAL(10,2) DEFAULT 1.00; + DECLARE test INT DEFAULT 0; + DECLARE bbal DECIMAL(10,2) DEFAULT 0.0; + DECLARE tbal DECIMAL(10,2) DEFAULT 0.0; + DECLARE local_uuid VARCHAR(255); + DECLARE local_user VARCHAR(255); + DECLARE local_time TIMESTAMP; + + SELECT RAND() * 10 INTO test; + SELECT tpcb.account_id() INTO acct; + SELECT tpcb.teller_id() INTO tell; + + SELECT account.balance INTO bal FROM tpcb.account WHERE id = acct; + SELECT account.bid INTO brch FROM tpcb.account WHERE id = acct; + SELECT teller.balance INTO tbal FROM tpcb.teller WHERE tid = tell; + SELECT branch.balance INTO bbal FROM tpcb.branch WHERE bid = brch; + + IF (test < 5) + THEN + SET bal = bal + amount; + SET bbal = bbal + amount; + SET tbal = tbal + amount; + UPDATE tpcb.account SET balance = bal, filler = 'account updated' + WHERE id = acct; + UPDATE tpcb.branch SET balance = bbal, filler = 'branch updated' + WHERE bid = brch; + UPDATE tpcb.teller SET balance = tbal, filler = 'teller updated' + WHERE tid = tell; + ELSE + SET bal = bal - amount; + SET bbal = bbal - amount; + SET tbal = tbal - amount; + UPDATE tpcb.account SET balance = bal, filler = 'account updated' + WHERE id = acct; + UPDATE tpcb.branch SET balance = bbal, filler = 'branch updated' + WHERE bid = brch; + UPDATE tpcb.teller SET balance = tbal, filler = 'teller updated' + WHERE tid = tell; + END IF; + + IF (format = 'SBR') + THEN + SET local_uuid=UUID(); + SET local_user=USER(); + SET local_time= NOW(); + INSERT INTO tpcb.history VALUES(NULL,acct,tell,brch,amount, local_time,local_user, + local_uuid,'completed trans'); + ELSE + INSERT INTO tpcb.history VALUES(NULL,acct,tell,brch,amount, NOW(), USER(), + UUID(),'completed trans'); + END IF; +END| +delimiter ;| +--enable_query_log +--echo +--echo *** Stored Procedures Created *** +--echo + diff --git a/mysql-test/include/tpcb_disk_data.inc b/mysql-test/include/tpcb_disk_data.inc new file mode 100644 index 00000000000..dbdf3766bbc --- /dev/null +++ b/mysql-test/include/tpcb_disk_data.inc @@ -0,0 +1,166 @@ +################################################## +# Author: Jeb +# Date: 2007/05 +# Purpose: To create a tpcb database using Disk Data, +# tables and stored procedures to load the database +# and run transactions against the DB +################################################## +--disable_warnings +DROP DATABASE IF EXISTS tpcb; +--enable_warnings +CREATE DATABASE tpcb; + +--echo +eval CREATE TABLE tpcb.account + (id INT, bid INT, balance DECIMAL(10,2), + filler CHAR(255), PRIMARY KEY(id)) + TABLESPACE $table_space STORAGE DISK + ENGINE=$engine_type; +--echo +eval CREATE TABLE tpcb.branch + (bid INT, balance DECIMAL(10,2), filler VARCHAR(255), + PRIMARY KEY(bid))TABLESPACE $table_space STORAGE DISK + ENGINE=$engine_type; +--echo +eval CREATE TABLE tpcb.teller + (tid INT, balance DECIMAL(10,2), filler VARCHAR(255), + PRIMARY KEY(tid)) TABLESPACE $table_space STORAGE DISK + ENGINE=$engine_type; + +--echo +eval CREATE TABLE tpcb.history + (id MEDIUMINT NOT NULL AUTO_INCREMENT,aid INT, + tid INT, bid INT, amount DECIMAL(10,2), + tdate DATETIME, teller CHAR(20), uuidf LONGBLOB, + filler CHAR(80),PRIMARY KEY (id)) + TABLESPACE $table_space STORAGE DISK + ENGINE=$engine_type; + +--echo +--echo --- Create stored procedures & functions --- +--echo + +--disable_query_log +delimiter |; +CREATE PROCEDURE tpcb.load() +BEGIN + DECLARE acct INT DEFAULT 100; + DECLARE brch INT DEFAULT 10; + DECLARE tell INT DEFAULT 100; + DECLARE tmp INT DEFAULT 10; + WHILE brch > 0 DO + SET tmp = 100; + WHILE tmp > 0 DO + INSERT INTO tpcb.account VALUES (acct, brch, 0.0, "FRESH ACCOUNT"); + SET acct = acct - 1; + SET tmp = tmp -1; + END WHILE; + INSERT INTO tpcb.branch VALUES (brch, 0.0, "FRESH BRANCH"); + SET brch = brch - 1; + END WHILE; + WHILE tell > 0 DO + INSERT INTO tpcb.teller VALUES (tell, 0.0, "FRESH TELLER"); + SET tell = tell - 1; + END WHILE; +END| + +CREATE FUNCTION tpcb.account_id () RETURNS INT +BEGIN + DECLARE num INT; + DECLARE ran INT; + SELECT RAND() * 10 INTO ran; + IF (ran < 5) + THEN + SELECT RAND() * 10 INTO num; + ELSE + SELECT RAND() * 100 INTO num; + END IF; + IF (num < 1) + THEN + RETURN 1; + END IF; + RETURN num; +END| + +CREATE FUNCTION tpcb.teller_id () RETURNS INT +BEGIN + DECLARE num INT; + DECLARE ran INT; + SELECT RAND() * 10 INTO ran; + IF (ran < 5) + THEN + SELECT RAND() * 10 INTO num; + ELSE + SELECT RAND() * 100 INTO num; + END IF; + IF (num < 1) + THEN + RETURN 1; + END IF; + RETURN num; +END| + +CREATE PROCEDURE tpcb.trans(in format varchar(3)) +BEGIN + DECLARE acct INT DEFAULT 0; + DECLARE brch INT DEFAULT 0; + DECLARE tell INT DEFAULT 0; + DECLARE bal DECIMAL(10,2) DEFAULT 0.0; + DECLARE amount DECIMAL(10,2) DEFAULT 1.00; + DECLARE test INT DEFAULT 0; + DECLARE bbal DECIMAL(10,2) DEFAULT 0.0; + DECLARE tbal DECIMAL(10,2) DEFAULT 0.0; + DECLARE local_uuid VARCHAR(255); + DECLARE local_user VARCHAR(255); + DECLARE local_time TIMESTAMP; + + SELECT RAND() * 10 INTO test; + SELECT tpcb.account_id() INTO acct; + SELECT tpcb.teller_id() INTO tell; + + SELECT account.balance INTO bal FROM tpcb.account WHERE id = acct; + SELECT account.bid INTO brch FROM tpcb.account WHERE id = acct; + SELECT teller.balance INTO tbal FROM tpcb.teller WHERE tid = tell; + SELECT branch.balance INTO bbal FROM tpcb.branch WHERE bid = brch; + + IF (test < 5) + THEN + SET bal = bal + amount; + SET bbal = bbal + amount; + SET tbal = tbal + amount; + UPDATE tpcb.account SET balance = bal, filler = 'account updated' + WHERE id = acct; + UPDATE tpcb.branch SET balance = bbal, filler = 'branch updated' + WHERE bid = brch; + UPDATE tpcb.teller SET balance = tbal, filler = 'teller updated' + WHERE tid = tell; + ELSE + SET bal = bal - amount; + SET bbal = bbal - amount; + SET tbal = tbal - amount; + UPDATE tpcb.account SET balance = bal, filler = 'account updated' + WHERE id = acct; + UPDATE tpcb.branch SET balance = bbal, filler = 'branch updated' + WHERE bid = brch; + UPDATE tpcb.teller SET balance = tbal, filler = 'teller updated' + WHERE tid = tell; + END IF; + + IF (format = 'SBR') + THEN + SET local_uuid=UUID(); + SET local_user=USER(); + SET local_time= NOW(); + INSERT INTO tpcb.history VALUES(NULL,acct,tell,brch,amount, local_time,local_user, + local_uuid,'completed trans'); + ELSE + INSERT INTO tpcb.history VALUES(NULL,acct,tell,brch,amount, NOW(), USER(), + UUID(),'completed trans'); + END IF; +END| +delimiter ;| +--enable_query_log +--echo +--echo *** Stored Procedures Created *** +--echo + diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl index 11ff85818a7..120947c84a7 100644 --- a/mysql-test/lib/mtr_cases.pl +++ b/mysql-test/lib/mtr_cases.pl @@ -631,6 +631,7 @@ our @tags= ["include/big_test.inc", "big_test", 1], ["include/have_debug.inc", "need_debug", 1], ["include/have_ndb.inc", "ndb_test", 1], + ["include/have_multi_ndb.inc", "ndb_test", 1], ["include/have_ndb_extra.inc", "ndb_extra", 1], ["require_manager", "require_manager", 1], ); diff --git a/mysql-test/lib/mtr_report.pl b/mysql-test/lib/mtr_report.pl index d82ed200a4b..a9d6d17d870 100644 --- a/mysql-test/lib/mtr_report.pl +++ b/mysql-test/lib/mtr_report.pl @@ -364,7 +364,12 @@ sub mtr_report_stats ($) { # Bug #28436: Incorrect position in SHOW BINLOG EVENTS causes # server coredump /\QError in Log_event::read_log_event(): 'Sanity check failed', data_len: 258, event_type: 49\E/ or - /Statement is not safe to log in statement format/ + /Statement is not safe to log in statement format/ or + + # Test case for Bug#14233 produces the following warnings: + /Stored routine 'test'.'bug14233_1': invalid value in column mysql.proc/ or + /Stored routine 'test'.'bug14233_2': invalid value in column mysql.proc/ or + /Stored routine 'test'.'bug14233_3': invalid value in column mysql.proc/ ) { next; # Skip these lines diff --git a/mysql-test/r/binary.result b/mysql-test/r/binary.result index ccafa43c7ab..be87c25e932 100644 --- a/mysql-test/r/binary.result +++ b/mysql-test/r/binary.result @@ -160,3 +160,41 @@ hex(col1) 62000000000000000000 62200000000000000000 drop table t1; +CREATE TABLE t1 ( +a binary(20) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', +index idx(a) +); +INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029087575'); +INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020'); +INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029080707'); +SELECT hex(a) FROM t1 order by a; +hex(a) +1F9480179366F2BF567E1C4B964C1EF029080707 +1F9480179366F2BF567E1C4B964C1EF029082020 +1F9480179366F2BF567E1C4B964C1EF029087575 +EXPLAIN SELECT hex(a) FROM t1 order by a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL idx 20 NULL 3 Using index +SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020'); +hex(a) +1F9480179366F2BF567E1C4B964C1EF029082020 +EXPLAIN +SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020'); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref idx idx 20 const 1 Using where; Using index +SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF02908'); +hex(a) +DROP TABLE t1; +CREATE TABLE t1 ( +id numeric(20) NOT NULL, +lang varchar(8) NOT NULL, +msg varchar(32) NOT NULL, +PRIMARY KEY (id,lang) +); +INSERT INTO t1 VALUES (33, 'en', 'zzzzzzz'); +INSERT INTO t1 VALUES (31, 'en', 'xxxxxxx'); +INSERT INTO t1 VALUES (32, 'en', 'yyyyyyy'); +SELECT * FROM t1 WHERE id=32; +id lang msg +32 en yyyyyyy +DROP TABLE t1; diff --git a/mysql-test/r/binlog_multi_engine.result b/mysql-test/r/binlog_multi_engine.result index 71b2d7b0c48..d605fbfaf67 100644 --- a/mysql-test/r/binlog_multi_engine.result +++ b/mysql-test/r/binlog_multi_engine.result @@ -30,8 +30,6 @@ master-bin.000001 # Query # # use `test`; TRUNCATE t1b master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t1n) master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) -master-bin.000001 # Write_rows # # table_id: # -master-bin.000001 # Write_rows # # table_id: # master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT master-bin.000001 # Query # # use `test`; TRUNCATE t1n @@ -41,8 +39,10 @@ INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2); INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2); INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2); UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c; +UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f; +ERROR HY000: Binary logging not possible. Message: Statement cannot be written atomically since more than one engine involved and at least one engine is self-logging UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c; -ERROR HY000: Binary logging not possible. Message: Statement cannot be logged to the binary log in row-based nor statement-based format +ERROR HY000: Binary logging not possible. Message: Statement cannot be written atomically since more than one engine involved and at least one engine is self-logging TRUNCATE t1m; TRUNCATE t1b; TRUNCATE t1n; @@ -69,8 +69,10 @@ ERROR HY000: Binary logging not possible. Message: Row-based format required for INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2); UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c; ERROR HY000: Binary logging not possible. Message: Row-based format required for this statement, but not allowed by this combination of engines +UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f; +ERROR HY000: Binary logging not possible. Message: Statement cannot be written atomically since more than one engine involved and at least one engine is self-logging UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c; -ERROR HY000: Binary logging not possible. Message: Statement cannot be logged to the binary log in row-based nor statement-based format +ERROR HY000: Binary logging not possible. Message: Row-based format required for this statement, but not allowed by this combination of engines show binlog events from <binlog_start>; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Table_map # # table_id: # (test.t1m) diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index e73b74ccac3..cdbb767dd9f 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -878,6 +878,644 @@ unlock tables; drop table t1, t2; create table t1 (upgrade int); drop table t1; +create table t1 ( +c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, c8 int, +c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int, +key a001_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a002_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a003_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a004_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a005_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a006_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a007_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a008_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a009_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a010_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a011_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a012_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a013_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a014_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a015_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a016_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a017_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a018_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a019_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a020_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a021_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a022_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a023_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a024_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a025_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a026_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a027_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a028_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a029_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a030_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a031_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a032_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a033_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a034_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a035_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a036_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a037_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a038_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a039_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a040_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a041_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a042_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a043_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a044_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a045_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a046_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a047_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a048_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a049_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a050_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a051_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a052_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a053_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a054_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a055_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a056_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a057_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a058_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a059_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a060_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a061_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a062_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a063_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +key a064_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16) +); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) DEFAULT NULL, + `c2` int(11) DEFAULT NULL, + `c3` int(11) DEFAULT NULL, + `c4` int(11) DEFAULT NULL, + `c5` int(11) DEFAULT NULL, + `c6` int(11) DEFAULT NULL, + `c7` int(11) DEFAULT NULL, + `c8` int(11) DEFAULT NULL, + `c9` int(11) DEFAULT NULL, + `c10` int(11) DEFAULT NULL, + `c11` int(11) DEFAULT NULL, + `c12` int(11) DEFAULT NULL, + `c13` int(11) DEFAULT NULL, + `c14` int(11) DEFAULT NULL, + `c15` int(11) DEFAULT NULL, + `c16` int(11) DEFAULT NULL, + KEY `a001_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a002_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a003_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a004_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a005_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a006_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a007_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a008_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a009_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a010_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a011_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a012_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a013_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a014_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a015_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a016_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a017_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a018_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a019_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a020_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a021_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a022_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a023_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a024_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a025_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a026_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a027_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a028_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a029_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a030_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a031_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a032_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a033_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a034_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a035_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a036_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a037_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a038_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a039_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a040_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a041_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a042_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a043_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a044_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a045_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a046_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a047_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a048_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a049_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a050_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a051_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a052_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a053_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a054_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a055_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a056_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a057_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a058_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a059_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a060_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a061_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a062_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a063_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a064_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +flush tables; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) DEFAULT NULL, + `c2` int(11) DEFAULT NULL, + `c3` int(11) DEFAULT NULL, + `c4` int(11) DEFAULT NULL, + `c5` int(11) DEFAULT NULL, + `c6` int(11) DEFAULT NULL, + `c7` int(11) DEFAULT NULL, + `c8` int(11) DEFAULT NULL, + `c9` int(11) DEFAULT NULL, + `c10` int(11) DEFAULT NULL, + `c11` int(11) DEFAULT NULL, + `c12` int(11) DEFAULT NULL, + `c13` int(11) DEFAULT NULL, + `c14` int(11) DEFAULT NULL, + `c15` int(11) DEFAULT NULL, + `c16` int(11) DEFAULT NULL, + KEY `a001_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a002_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a003_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a004_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a005_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a006_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a007_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a008_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a009_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a010_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a011_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a012_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a013_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a014_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a015_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a016_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a017_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a018_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a019_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a020_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a021_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a022_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a023_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a024_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a025_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a026_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a027_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a028_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a029_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a030_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a031_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a032_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a033_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a034_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a035_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a036_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a037_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a038_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a039_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a040_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a041_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a042_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a043_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a044_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a045_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a046_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a047_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a048_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a049_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a050_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a051_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a052_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a053_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a054_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a055_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a056_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a057_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a058_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a059_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a060_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a061_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a062_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a063_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a064_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create table t1 (c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, +c8 int, c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int); +alter table t1 +add key a001_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a002_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a003_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a004_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a005_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a006_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a007_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a008_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a009_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a010_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a011_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a012_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a013_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a014_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a015_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a016_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a017_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a018_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a019_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a020_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a021_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a022_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a023_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a024_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a025_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a026_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a027_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a028_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a029_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a030_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a031_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a032_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a033_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a034_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a035_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a036_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a037_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a038_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a039_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a040_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a041_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a042_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a043_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a044_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a045_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a046_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a047_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a048_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a049_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a050_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a051_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a052_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a053_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a054_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a055_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a056_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a057_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a058_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a059_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a060_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a061_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a062_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a063_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), +add key a064_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) DEFAULT NULL, + `c2` int(11) DEFAULT NULL, + `c3` int(11) DEFAULT NULL, + `c4` int(11) DEFAULT NULL, + `c5` int(11) DEFAULT NULL, + `c6` int(11) DEFAULT NULL, + `c7` int(11) DEFAULT NULL, + `c8` int(11) DEFAULT NULL, + `c9` int(11) DEFAULT NULL, + `c10` int(11) DEFAULT NULL, + `c11` int(11) DEFAULT NULL, + `c12` int(11) DEFAULT NULL, + `c13` int(11) DEFAULT NULL, + `c14` int(11) DEFAULT NULL, + `c15` int(11) DEFAULT NULL, + `c16` int(11) DEFAULT NULL, + KEY `a001_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a002_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a003_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a004_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a005_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a006_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a007_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a008_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a009_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a010_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a011_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a012_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a013_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a014_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a015_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a016_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a017_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a018_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a019_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a020_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a021_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a022_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a023_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a024_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a025_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a026_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a027_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a028_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a029_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a030_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a031_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a032_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a033_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a034_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a035_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a036_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a037_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a038_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a039_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a040_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a041_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a042_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a043_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a044_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a045_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a046_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a047_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a048_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a049_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a050_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a051_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a052_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a053_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a054_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a055_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a056_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a057_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a058_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a059_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a060_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a061_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a062_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a063_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a064_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +flush tables; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) DEFAULT NULL, + `c2` int(11) DEFAULT NULL, + `c3` int(11) DEFAULT NULL, + `c4` int(11) DEFAULT NULL, + `c5` int(11) DEFAULT NULL, + `c6` int(11) DEFAULT NULL, + `c7` int(11) DEFAULT NULL, + `c8` int(11) DEFAULT NULL, + `c9` int(11) DEFAULT NULL, + `c10` int(11) DEFAULT NULL, + `c11` int(11) DEFAULT NULL, + `c12` int(11) DEFAULT NULL, + `c13` int(11) DEFAULT NULL, + `c14` int(11) DEFAULT NULL, + `c15` int(11) DEFAULT NULL, + `c16` int(11) DEFAULT NULL, + KEY `a001_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a002_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a003_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a004_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a005_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a006_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a007_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a008_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a009_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a010_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a011_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a012_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a013_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a014_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a015_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a016_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a017_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a018_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a019_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a020_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a021_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a022_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a023_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a024_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a025_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a026_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a027_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a028_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a029_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a030_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a031_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a032_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a033_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a034_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a035_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a036_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a037_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a038_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a039_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a040_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a041_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a042_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a043_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a044_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a045_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a046_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a047_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a048_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a049_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a050_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a051_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a052_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a053_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a054_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a055_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a056_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a057_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a058_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a059_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a060_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a061_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a062_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a063_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`), + KEY `a064_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +alter table t1 add key +a065_long_123456789_123456789_123456789_123456789_123456789_1234 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16); +ERROR 42000: Too many keys specified; max 64 keys allowed +drop table t1; +create table t1 (c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, +c8 int, c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, +c16 int, c17 int); +alter table t1 add key i1 ( +c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16, c17); +ERROR 42000: Too many key parts specified; max 16 parts allowed +alter table t1 add key +a001_long_123456789_123456789_123456789_123456789_123456789_12345 (c1); +ERROR 42000: Identifier name 'a001_long_123456789_123456789_123456789_123456789_123456789_12345' is too long +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) DEFAULT NULL, + `c2` int(11) DEFAULT NULL, + `c3` int(11) DEFAULT NULL, + `c4` int(11) DEFAULT NULL, + `c5` int(11) DEFAULT NULL, + `c6` int(11) DEFAULT NULL, + `c7` int(11) DEFAULT NULL, + `c8` int(11) DEFAULT NULL, + `c9` int(11) DEFAULT NULL, + `c10` int(11) DEFAULT NULL, + `c11` int(11) DEFAULT NULL, + `c12` int(11) DEFAULT NULL, + `c13` int(11) DEFAULT NULL, + `c14` int(11) DEFAULT NULL, + `c15` int(11) DEFAULT NULL, + `c16` int(11) DEFAULT NULL, + `c17` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; End of 5.0 tests CREATE TABLE t1 (a int, b int); insert into t1 values (1,1),(1,2); @@ -980,8 +1618,8 @@ Table Create Table KEY `имÑ_индекÑа_в_кодировке_утф8_длиной_больше_чем_48` (`имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show create view имÑ_вью_кодировке_утф8_длиной_больше_чем_42; -View Create View -имÑ_вью_кодировке_утф8_длиной_больше_чем_42 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `имÑ_вью_кодировке_утф8_длиной_больше_чем_42` AS select `имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48`.`имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45` AS `имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45` from `имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48` +View Create View character_set_client collation_connection +имÑ_вью_кодировке_утф8_длиной_больше_чем_42 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `имÑ_вью_кодировке_утф8_длиной_больше_чем_42` AS select `имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48`.`имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45` AS `имÑ_полÑ_в_кодировке_утф8_длиной_больше_чем_45` from `имÑ_таблицы_в_кодировке_утф8_длиной_больше_чем_48` utf8 utf8_general_ci create event имÑ_ÑобытиÑ_в_кодировке_утф8_длиной_больше_чем_48 on schedule every 2 year do select 1; select EVENT_NAME from information_schema.events where event_schema='test'; diff --git a/mysql-test/r/ctype_collate.result b/mysql-test/r/ctype_collate.result index c5d433cd080..5417c9da47e 100644 --- a/mysql-test/r/ctype_collate.result +++ b/mysql-test/r/ctype_collate.result @@ -595,3 +595,11 @@ EXPLAIN SELECT * FROM t1 WHERE s2 LIKE 'a' COLLATE latin1_german1_ci; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where DROP TABLE t1; +create table t1(f1 varchar(10) character set latin2 collate latin2_hungarian_ci, key(f1)); +insert into t1 set f1=0x3F3F9DC73F; +insert into t1 set f1=0x3F3F1E563F; +insert into t1 set f1=0x3F3F; +check table t1 extended; +Table Op Msg_type Msg_text +test.t1 check status OK +drop table t1; diff --git a/mysql-test/r/ctype_cp932_binlog_stm.result b/mysql-test/r/ctype_cp932_binlog_stm.result index b9a39b88ae5..c6ca7a3f008 100644 --- a/mysql-test/r/ctype_cp932_binlog_stm.result +++ b/mysql-test/r/ctype_cp932_binlog_stm.result @@ -40,9 +40,9 @@ IN ind DECIMAL(10,2)) BEGIN INSERT INTO t4 VALUES (ins1, ins2, ind); END -master-bin.000001 783 Query 1 1002 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93)) -master-bin.000001 1002 Query 1 1091 use `test`; DROP PROCEDURE bug18293 -master-bin.000001 1091 Query 1 1170 use `test`; DROP TABLE t4 +master-bin.000001 783 Query 1 999 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93)) +master-bin.000001 999 Query 1 1085 use `test`; DROP PROCEDURE bug18293 +master-bin.000001 1085 Query 1 1161 use `test`; DROP TABLE t4 End of 5.0 tests SHOW BINLOG EVENTS FROM 364; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error diff --git a/mysql-test/r/ctype_uca.result b/mysql-test/r/ctype_uca.result index 1fd1493bf1e..889702e380c 100644 --- a/mysql-test/r/ctype_uca.result +++ b/mysql-test/r/ctype_uca.result @@ -2663,3 +2663,95 @@ COUNT(*) c1 1 1 a DROP TABLE IF EXISTS t1; +set names utf8; +create table t1 ( +a varchar(255), +key a(a) +) character set utf8 collate utf8_danish_ci; +insert into t1 values ('Ã¥aaaa'),('ååaaa'),('aaaaa'); +select a as like_a from t1 where a like 'a%'; +like_a +aaaaa +select a as like_aa from t1 where a like 'aa%'; +like_aa +aaaaa +select a as like_aaa from t1 where a like 'aaa%'; +like_aaa +aaaaa +select a as like_aaaa from t1 where a like 'aaaa%'; +like_aaaa +aaaaa +select a as like_aaaaa from t1 where a like 'aaaaa%'; +like_aaaaa +aaaaa +alter table t1 convert to character set ucs2 collate ucs2_danish_ci; +select a as like_a from t1 where a like 'a%'; +like_a +aaaaa +select a as like_aa from t1 where a like 'aa%'; +like_aa +aaaaa +select a as like_aaa from t1 where a like 'aaa%'; +like_aaa +aaaaa +select a as like_aaaa from t1 where a like 'aaaa%'; +like_aaaa +aaaaa +select a as like_aaaaa from t1 where a like 'aaaaa%'; +like_aaaaa +aaaaa +drop table t1; +create table t1 ( +a varchar(255), +key(a) +) character set utf8 collate utf8_spanish2_ci; +insert into t1 values ('aaaaa'),('lllll'),('zzzzz'); +select a as like_l from t1 where a like 'l%'; +like_l +lllll +select a as like_ll from t1 where a like 'll%'; +like_ll +lllll +select a as like_lll from t1 where a like 'lll%'; +like_lll +lllll +select a as like_llll from t1 where a like 'llll%'; +like_llll +lllll +select a as like_lllll from t1 where a like 'lllll%'; +like_lllll +lllll +alter table t1 convert to character set ucs2 collate ucs2_spanish2_ci; +select a as like_l from t1 where a like 'l%'; +like_l +lllll +select a as like_ll from t1 where a like 'll%'; +like_ll +lllll +select a as like_lll from t1 where a like 'lll%'; +like_lll +lllll +select a as like_llll from t1 where a like 'llll%'; +like_llll +lllll +select a as like_lllll from t1 where a like 'lllll%'; +like_lllll +lllll +drop table t1; +create table t1 ( +a varchar(255), +key a(a) +) character set utf8 collate utf8_czech_ci; +insert into t1 values +('b'),('c'),('d'),('e'),('f'),('g'),('h'),('ch'),('i'),('j'); +select * from t1 where a like 'c%'; +a +c +ch +alter table t1 convert to character set ucs2 collate ucs2_czech_ci; +select * from t1 where a like 'c%'; +a +c +ch +drop table t1; +End for 5.0 tests diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index fcfe5d6345b..6f1c9d3d52a 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -865,4 +865,25 @@ blob 65535 65535 text 65535 65535 text 65535 32767 drop table t1; +create table t1 (a char(1) character set ucs2); +insert into t1 values ('a'),('b'),('c'); +select hex(group_concat(a)) from t1; +hex(group_concat(a)) +0061002C0062002C0063 +select collation(group_concat(a)) from t1; +collation(group_concat(a)) +ucs2_general_ci +drop table t1; +set names latin1; +create table t1 (a char(1) character set latin1); +insert into t1 values ('a'),('b'),('c'); +set character_set_connection=ucs2; +select hex(group_concat(a separator ',')) from t1; +hex(group_concat(a separator ',')) +612C622C63 +select collation(group_concat(a separator ',')) from t1; +collation(group_concat(a separator ',')) +latin1_swedish_ci +drop table t1; +set names latin1; End of 5.0 tests diff --git a/mysql-test/r/ctype_ucs2_def.result b/mysql-test/r/ctype_ucs2_def.result index fb21fb4a6c1..6fd45428368 100644 --- a/mysql-test/r/ctype_ucs2_def.result +++ b/mysql-test/r/ctype_ucs2_def.result @@ -7,6 +7,13 @@ character_set_server ucs2 DROP TABLE IF EXISTS t1; create table t1 (a int); drop table t1; +End of 4.1 tests +create table t1 (a char(1) character set latin1); +insert into t1 values ('a'),('b'),('c'); +select hex(group_concat(a)) from t1; +hex(group_concat(a)) +612C622C63 +drop table t1; CREATE TABLE t1(col1 VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL, col2 VARCHAR(32) CHARACTER SET ucs2 COLLATE ucs2_bin NOT NULL, UNIQUE KEY key1 USING HASH (col1, col2)) ENGINE=MEMORY; diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 8601e6890de..4778e9a6296 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -1657,3 +1657,40 @@ colA colB colA colB 1 foo 1 foo 2 foo bar 2 foo bar DROP TABLE t1, t2; +SELECT 'н1234567890' UNION SELECT _binary '1'; +н1234567890 +н1234567890 +1 +SELECT 'н1234567890' UNION SELECT 1; +н1234567890 +н1234567890 +1 +SELECT '1' UNION SELECT 'н1234567890'; +1 +1 +н1234567890 +SELECT 1 UNION SELECT 'н1234567890'; +1 +1 +н1234567890 +CREATE TABLE t1 (c VARCHAR(11)) CHARACTER SET utf8; +CREATE TABLE t2 (b CHAR(1) CHARACTER SET binary, i INT); +INSERT INTO t1 (c) VALUES ('н1234567890'); +INSERT INTO t2 (b, i) VALUES ('1', 1); +SELECT c FROM t1 UNION SELECT b FROM t2; +c +н1234567890 +1 +SELECT c FROM t1 UNION SELECT i FROM t2; +c +н1234567890 +1 +SELECT b FROM t2 UNION SELECT c FROM t1; +b +1 +н1234567890 +SELECT i FROM t2 UNION SELECT c FROM t1; +i +1 +н1234567890 +DROP TABLE t1, t2; diff --git a/mysql-test/r/ddl_i18n_koi8r.result b/mysql-test/r/ddl_i18n_koi8r.result new file mode 100644 index 00000000000..9e5931330e2 --- /dev/null +++ b/mysql-test/r/ddl_i18n_koi8r.result @@ -0,0 +1,2783 @@ +set names koi8r; + +------------------------------------------------------------------- +Views +------------------------------------------------------------------- + +DROP DATABASE IF EXISTS mysqltest1| +CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| +use mysqltest1| +CREATE TABLE t1(ËÏÌ INT)| +INSERT INTO t1 VALUES(1)| + +CREATE VIEW v1 AS +SELECT 'ÔÅÓÔ' AS c1, ËÏÌ AS c2 +FROM t1| + +CREATE VIEW v2 AS SELECT _utf8'теÑÑ‚' as c1| + + + +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 _koi8r'ÔÅÓÔ' AS `c1`,`t1`.`ËÏÌ` AS `c2` from `t1` koi8r koi8r_general_ci + +SHOW CREATE VIEW v2| +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select _utf8'теÑÑ‚' AS `c1` koi8r koi8r_general_ci + + +SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'| +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION +NULL mysqltest1 v1 SELECT 'ÔÅÓÔ' AS c1, ËÏÌ AS c2 NONE YES root@localhost DEFINER koi8r koi8r_general_ci + +SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'| +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION +NULL mysqltest1 v2 SELECT 'ÔÅÓÔ' as c1 NONE NO root@localhost DEFINER koi8r koi8r_general_ci + + +SELECT COLLATION(c1), COLLATION(c2) FROM v1| +COLLATION(c1) COLLATION(c2) +koi8r_general_ci binary + +SELECT COLLATION(c1) FROM v2| +COLLATION(c1) +utf8_general_ci + + +ALTER DATABASE mysqltest1 COLLATE cp866_general_ci| + +---> connection: con2 +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| +SELECT * FROM mysqltest1.v1| +SELECT * FROM mysqltest1.v2| +use mysqltest1| +set names koi8r| + + +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 _koi8r'ÔÅÓÔ' AS `c1`,`t1`.`ËÏÌ` AS `c2` from `t1` koi8r koi8r_general_ci + +SHOW CREATE VIEW v2| +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select _utf8'теÑÑ‚' AS `c1` koi8r koi8r_general_ci + + +SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'| +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION +NULL mysqltest1 v1 SELECT 'ÔÅÓÔ' AS c1, ËÏÌ AS c2 NONE YES root@localhost DEFINER koi8r koi8r_general_ci + +SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'| +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION +NULL mysqltest1 v2 SELECT 'ÔÅÓÔ' as c1 NONE NO root@localhost DEFINER koi8r koi8r_general_ci + + +SELECT COLLATION(c1), COLLATION(c2) FROM v1| +COLLATION(c1) COLLATION(c2) +koi8r_general_ci binary + +SELECT COLLATION(c1) FROM v2| +COLLATION(c1) +utf8_general_ci + +---> Dumping mysqltest1 to ddl_i18n_koi8r.views.mysqltest1.sql + + +DROP DATABASE mysqltest1| + + +---> Restoring mysqltest1... + +---> connection: con3 +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| +SELECT * FROM mysqltest1.v1| +SELECT * FROM mysqltest1.v2| +use mysqltest1| +set names koi8r| + + +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 _koi8r'ÔÅÓÔ' AS `c1`,`t1`.`ËÏÌ` AS `c2` from `t1` koi8r koi8r_general_ci + +SHOW CREATE VIEW v2| +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select _utf8'теÑÑ‚' AS `c1` koi8r koi8r_general_ci + + +SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'| +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION +NULL mysqltest1 v1 select 'ÔÅÓÔ' AS `c1`,`t1`.`ËÏÌ` AS `c2` from `t1` NONE YES root@localhost DEFINER koi8r koi8r_general_ci + +SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'| +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION +NULL mysqltest1 v2 select 'ÔÅÓÔ' AS `c1` NONE NO root@localhost DEFINER koi8r koi8r_general_ci + + +SELECT COLLATION(c1), COLLATION(c2) FROM v1| +COLLATION(c1) COLLATION(c2) +koi8r_general_ci binary + +SELECT COLLATION(c1) FROM v2| +COLLATION(c1) +utf8_general_ci + +---> connection: default +use test| +DROP DATABASE mysqltest1| + +------------------------------------------------------------------- +Stored procedures/functions +------------------------------------------------------------------- + +DROP DATABASE IF EXISTS mysqltest1| +DROP DATABASE IF EXISTS mysqltest2| +CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| +CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| +use mysqltest1| + +CREATE PROCEDURE p1( +INOUT ÐÁÒÁÍ1 CHAR(10), +OUT ÐÁÒÁÍ2 CHAR(10)) +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c5, +COLLATION(_utf8 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END| + +CREATE PROCEDURE p2( +INOUT ÐÁÒÁÍ1 CHAR(10) CHARACTER SET utf8, +OUT ÐÁÒÁÍ2 CHAR(10) CHARACTER SET utf8) +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c5, +COLLATION(_utf8 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END| + +CREATE PROCEDURE mysqltest2.p3( +INOUT ÐÁÒÁÍ1 CHAR(10), +OUT ÐÁÒÁÍ2 CHAR(10)) +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c5, +COLLATION(_utf8 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END| + +CREATE PROCEDURE mysqltest2.p4( +INOUT ÐÁÒÁÍ1 CHAR(10) CHARACTER SET utf8, +OUT ÐÁÒÁÍ2 CHAR(10) CHARACTER SET utf8) +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c5, +COLLATION(_utf8 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END| + + +SHOW CREATE PROCEDURE p1| +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`( +INOUT ÐÁÒÁÍ1 CHAR(10), +OUT ÐÁÒÁÍ2 CHAR(10)) +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c5, +COLLATION(_utf8 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END koi8r koi8r_general_ci utf8_unicode_ci + +SHOW CREATE PROCEDURE p2| +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +p2 CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`( +INOUT ÐÁÒÁÍ1 CHAR(10) CHARACTER SET utf8, +OUT ÐÁÒÁÍ2 CHAR(10) CHARACTER SET utf8) +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c5, +COLLATION(_utf8 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END koi8r koi8r_general_ci utf8_unicode_ci + +SHOW CREATE PROCEDURE mysqltest2.p3| +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +p3 CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`( +INOUT ÐÁÒÁÍ1 CHAR(10), +OUT ÐÁÒÁÍ2 CHAR(10)) +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c5, +COLLATION(_utf8 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END koi8r koi8r_general_ci utf8_unicode_ci + +SHOW CREATE PROCEDURE mysqltest2.p4| +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +p4 CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`( +INOUT ÐÁÒÁÍ1 CHAR(10) CHARACTER SET utf8, +OUT ÐÁÒÁÍ2 CHAR(10) CHARACTER SET utf8) +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c5, +COLLATION(_utf8 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END koi8r koi8r_general_ci utf8_unicode_ci + + +SHOW PROCEDURE STATUS LIKE 'p1'| +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +mysqltest1 p1 PROCEDURE root@localhost MODIFIED CREATED DEFINER koi8r koi8r_general_ci utf8_unicode_ci + +SHOW PROCEDURE STATUS LIKE 'p2'| +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +mysqltest1 p2 PROCEDURE root@localhost MODIFIED CREATED DEFINER koi8r koi8r_general_ci utf8_unicode_ci + +SHOW PROCEDURE STATUS LIKE 'p3'| +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +mysqltest2 p3 PROCEDURE root@localhost MODIFIED CREATED DEFINER koi8r koi8r_general_ci utf8_unicode_ci + +SHOW PROCEDURE STATUS LIKE 'p4'| +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +mysqltest2 p4 PROCEDURE root@localhost MODIFIED CREATED DEFINER koi8r koi8r_general_ci utf8_unicode_ci + + +SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p1'| +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 CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +p1 NULL mysqltest1 p1 PROCEDURE NULL SQL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION( 'ÔÅËÓÔ') AS c5, +COLLATION( 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost koi8r koi8r_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p2'| +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 CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +p2 NULL mysqltest1 p2 PROCEDURE NULL SQL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION( 'ÔÅËÓÔ') AS c5, +COLLATION( 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost koi8r koi8r_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p3'| +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 CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +p3 NULL mysqltest2 p3 PROCEDURE NULL SQL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION( 'ÔÅËÓÔ') AS c5, +COLLATION( 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost koi8r koi8r_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p4'| +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 CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +p4 NULL mysqltest2 p4 PROCEDURE NULL SQL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION( 'ÔÅËÓÔ') AS c5, +COLLATION( 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost koi8r koi8r_general_ci utf8_unicode_ci + + +SET @a = '1'| +SET @b = '2'| + + +CALL p1(@a, @b)| +c1 c2 c3 +utf8_unicode_ci utf8_unicode_ci utf8_unicode_ci +c4 c5 c6 c7 c8 +koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r +SELECT COLLATION(@a) AS ca, COLLATION(@b) cb| +ca cb +utf8_unicode_ci utf8_unicode_ci + +CALL p2(@a, @b)| +c1 c2 c3 +utf8_general_ci utf8_general_ci utf8_general_ci +c4 c5 c6 c7 c8 +koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r +SELECT COLLATION(@a) AS ca, COLLATION(@b) cb| +ca cb +utf8_general_ci utf8_general_ci + +CALL mysqltest2.p3(@a, @b)| +c1 c2 c3 +utf8_unicode_ci utf8_unicode_ci utf8_unicode_ci +c4 c5 c6 c7 c8 +koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r +SELECT COLLATION(@a) AS ca, COLLATION(@b) cb| +ca cb +utf8_unicode_ci utf8_unicode_ci + +CALL mysqltest2.p4(@a, @b)| +c1 c2 c3 +utf8_general_ci utf8_general_ci utf8_general_ci +c4 c5 c6 c7 c8 +koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r +SELECT COLLATION(@a) AS ca, COLLATION(@b) cb| +ca cb +utf8_general_ci utf8_general_ci + + +ALTER DATABASE mysqltest1 COLLATE cp866_general_ci| +ALTER DATABASE mysqltest2 COLLATE cp866_general_ci| + +---> connection: con2 +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| +CALL p1(@a, @b)| +c1 c2 c3 +utf8_unicode_ci utf8_unicode_ci utf8_unicode_ci +c4 c5 c6 c7 c8 +koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r +CALL p2(@a, @b)| +c1 c2 c3 +utf8_general_ci utf8_general_ci utf8_general_ci +c4 c5 c6 c7 c8 +koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r +CALL mysqltest2.p3(@a, @b)| +c1 c2 c3 +utf8_unicode_ci utf8_unicode_ci utf8_unicode_ci +c4 c5 c6 c7 c8 +koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r +CALL mysqltest2.p4(@a, @b)| +c1 c2 c3 +utf8_general_ci utf8_general_ci utf8_general_ci +c4 c5 c6 c7 c8 +koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r +set names koi8r| + + +SHOW CREATE PROCEDURE p1| +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`( +INOUT ÐÁÒÁÍ1 CHAR(10), +OUT ÐÁÒÁÍ2 CHAR(10)) +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c5, +COLLATION(_utf8 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END koi8r koi8r_general_ci utf8_unicode_ci + +SHOW CREATE PROCEDURE p2| +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +p2 CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`( +INOUT ÐÁÒÁÍ1 CHAR(10) CHARACTER SET utf8, +OUT ÐÁÒÁÍ2 CHAR(10) CHARACTER SET utf8) +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c5, +COLLATION(_utf8 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END koi8r koi8r_general_ci utf8_unicode_ci + +SHOW CREATE PROCEDURE mysqltest2.p3| +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +p3 CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`( +INOUT ÐÁÒÁÍ1 CHAR(10), +OUT ÐÁÒÁÍ2 CHAR(10)) +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c5, +COLLATION(_utf8 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END koi8r koi8r_general_ci utf8_unicode_ci + +SHOW CREATE PROCEDURE mysqltest2.p4| +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +p4 CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`( +INOUT ÐÁÒÁÍ1 CHAR(10) CHARACTER SET utf8, +OUT ÐÁÒÁÍ2 CHAR(10) CHARACTER SET utf8) +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c5, +COLLATION(_utf8 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END koi8r koi8r_general_ci utf8_unicode_ci + + +SHOW PROCEDURE STATUS LIKE 'p1'| +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +mysqltest1 p1 PROCEDURE root@localhost MODIFIED CREATED DEFINER koi8r koi8r_general_ci utf8_unicode_ci + +SHOW PROCEDURE STATUS LIKE 'p2'| +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +mysqltest1 p2 PROCEDURE root@localhost MODIFIED CREATED DEFINER koi8r koi8r_general_ci utf8_unicode_ci + +SHOW PROCEDURE STATUS LIKE 'p3'| +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +mysqltest2 p3 PROCEDURE root@localhost MODIFIED CREATED DEFINER koi8r koi8r_general_ci utf8_unicode_ci + +SHOW PROCEDURE STATUS LIKE 'p4'| +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +mysqltest2 p4 PROCEDURE root@localhost MODIFIED CREATED DEFINER koi8r koi8r_general_ci utf8_unicode_ci + + +SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p1'| +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 CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +p1 NULL mysqltest1 p1 PROCEDURE NULL SQL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION( 'ÔÅËÓÔ') AS c5, +COLLATION( 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost koi8r koi8r_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p2'| +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 CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +p2 NULL mysqltest1 p2 PROCEDURE NULL SQL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION( 'ÔÅËÓÔ') AS c5, +COLLATION( 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost koi8r koi8r_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p3'| +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 CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +p3 NULL mysqltest2 p3 PROCEDURE NULL SQL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION( 'ÔÅËÓÔ') AS c5, +COLLATION( 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost koi8r koi8r_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p4'| +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 CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +p4 NULL mysqltest2 p4 PROCEDURE NULL SQL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION( 'ÔÅËÓÔ') AS c5, +COLLATION( 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost koi8r koi8r_general_ci utf8_unicode_ci + + +SET @a = '1'| +SET @b = '2'| + + +CALL p1(@a, @b)| +c1 c2 c3 +utf8_unicode_ci utf8_unicode_ci utf8_unicode_ci +c4 c5 c6 c7 c8 +koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r +SELECT COLLATION(@a) AS ca, COLLATION(@b) cb| +ca cb +utf8_unicode_ci utf8_unicode_ci + +CALL p2(@a, @b)| +c1 c2 c3 +utf8_general_ci utf8_general_ci utf8_general_ci +c4 c5 c6 c7 c8 +koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r +SELECT COLLATION(@a) AS ca, COLLATION(@b) cb| +ca cb +utf8_general_ci utf8_general_ci + +CALL mysqltest2.p3(@a, @b)| +c1 c2 c3 +utf8_unicode_ci utf8_unicode_ci utf8_unicode_ci +c4 c5 c6 c7 c8 +koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r +SELECT COLLATION(@a) AS ca, COLLATION(@b) cb| +ca cb +utf8_unicode_ci utf8_unicode_ci + +CALL mysqltest2.p4(@a, @b)| +c1 c2 c3 +utf8_general_ci utf8_general_ci utf8_general_ci +c4 c5 c6 c7 c8 +koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r +SELECT COLLATION(@a) AS ca, COLLATION(@b) cb| +ca cb +utf8_general_ci utf8_general_ci + +---> Dump of mysqltest1 + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 */; + +USE `mysqltest1`; +ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = koi8r */ ; +/*!50003 SET character_set_results = koi8r */ ; +/*!50003 SET collation_connection = koi8r_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p1`( +INOUT ÐÁÒÁÍ1 CHAR(10), +OUT ÐÁÒÁÍ2 CHAR(10)) +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c5, +COLLATION(_utf8 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +ALTER DATABASE mysqltest1 CHARACTER SET cp866 COLLATE cp866_general_ci ; +ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = koi8r */ ; +/*!50003 SET character_set_results = koi8r */ ; +/*!50003 SET collation_connection = koi8r_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p2`( +INOUT ÐÁÒÁÍ1 CHAR(10) CHARACTER SET utf8, +OUT ÐÁÒÁÍ2 CHAR(10) CHARACTER SET utf8) +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c5, +COLLATION(_utf8 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +ALTER DATABASE mysqltest1 CHARACTER SET cp866 COLLATE cp866_general_ci ; + +---> Dumping mysqltest1 to ddl_i18n_koi8r.sp.mysqltest1.sql + +---> Dump of mysqltest2 + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 */; + +USE `mysqltest2`; +ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = koi8r */ ; +/*!50003 SET character_set_results = koi8r */ ; +/*!50003 SET collation_connection = koi8r_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p3`( +INOUT ÐÁÒÁÍ1 CHAR(10), +OUT ÐÁÒÁÍ2 CHAR(10)) +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c5, +COLLATION(_utf8 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +ALTER DATABASE mysqltest2 CHARACTER SET cp866 COLLATE cp866_general_ci ; +ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = koi8r */ ; +/*!50003 SET character_set_results = koi8r */ ; +/*!50003 SET collation_connection = koi8r_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p4`( +INOUT ÐÁÒÁÍ1 CHAR(10) CHARACTER SET utf8, +OUT ÐÁÒÁÍ2 CHAR(10) CHARACTER SET utf8) +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c5, +COLLATION(_utf8 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +ALTER DATABASE mysqltest2 CHARACTER SET cp866 COLLATE cp866_general_ci ; + +---> Dumping mysqltest2 to ddl_i18n_koi8r.sp.mysqltest2.sql + + +DROP DATABASE mysqltest1| +DROP DATABASE mysqltest2| + + +---> Restoring mysqltest1... +---> Restoring mysqltest2... + +---> connection: con3 +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| +CALL p1(@a, @b)| +c1 c2 c3 +utf8_unicode_ci utf8_unicode_ci utf8_unicode_ci +c4 c5 c6 c7 c8 +koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r +CALL p2(@a, @b)| +c1 c2 c3 +utf8_general_ci utf8_general_ci utf8_general_ci +c4 c5 c6 c7 c8 +koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r +CALL mysqltest2.p3(@a, @b)| +c1 c2 c3 +utf8_unicode_ci utf8_unicode_ci utf8_unicode_ci +c4 c5 c6 c7 c8 +koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r +CALL mysqltest2.p4(@a, @b)| +c1 c2 c3 +utf8_general_ci utf8_general_ci utf8_general_ci +c4 c5 c6 c7 c8 +koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r +set names koi8r| + + +SHOW CREATE PROCEDURE p1| +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`( +INOUT ÐÁÒÁÍ1 CHAR(10), +OUT ÐÁÒÁÍ2 CHAR(10)) +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c5, +COLLATION(_utf8 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END koi8r koi8r_general_ci utf8_unicode_ci + +SHOW CREATE PROCEDURE p2| +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +p2 CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`( +INOUT ÐÁÒÁÍ1 CHAR(10) CHARACTER SET utf8, +OUT ÐÁÒÁÍ2 CHAR(10) CHARACTER SET utf8) +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c5, +COLLATION(_utf8 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END koi8r koi8r_general_ci utf8_unicode_ci + +SHOW CREATE PROCEDURE mysqltest2.p3| +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +p3 CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`( +INOUT ÐÁÒÁÍ1 CHAR(10), +OUT ÐÁÒÁÍ2 CHAR(10)) +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c5, +COLLATION(_utf8 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END koi8r koi8r_general_ci utf8_unicode_ci + +SHOW CREATE PROCEDURE mysqltest2.p4| +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +p4 CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`( +INOUT ÐÁÒÁÍ1 CHAR(10) CHARACTER SET utf8, +OUT ÐÁÒÁÍ2 CHAR(10) CHARACTER SET utf8) +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c5, +COLLATION(_utf8 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END koi8r koi8r_general_ci utf8_unicode_ci + + +SHOW PROCEDURE STATUS LIKE 'p1'| +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +mysqltest1 p1 PROCEDURE root@localhost MODIFIED CREATED DEFINER koi8r koi8r_general_ci utf8_unicode_ci + +SHOW PROCEDURE STATUS LIKE 'p2'| +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +mysqltest1 p2 PROCEDURE root@localhost MODIFIED CREATED DEFINER koi8r koi8r_general_ci utf8_unicode_ci + +SHOW PROCEDURE STATUS LIKE 'p3'| +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +mysqltest2 p3 PROCEDURE root@localhost MODIFIED CREATED DEFINER koi8r koi8r_general_ci utf8_unicode_ci + +SHOW PROCEDURE STATUS LIKE 'p4'| +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +mysqltest2 p4 PROCEDURE root@localhost MODIFIED CREATED DEFINER koi8r koi8r_general_ci utf8_unicode_ci + + +SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p1'| +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 CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +p1 NULL mysqltest1 p1 PROCEDURE NULL SQL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION( 'ÔÅËÓÔ') AS c5, +COLLATION( 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost koi8r koi8r_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p2'| +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 CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +p2 NULL mysqltest1 p2 PROCEDURE NULL SQL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION( 'ÔÅËÓÔ') AS c5, +COLLATION( 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost koi8r koi8r_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p3'| +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 CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +p3 NULL mysqltest2 p3 PROCEDURE NULL SQL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION( 'ÔÅËÓÔ') AS c5, +COLLATION( 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost koi8r koi8r_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p4'| +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 CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +p4 NULL mysqltest2 p4 PROCEDURE NULL SQL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION(ÐÁÒÁÍ1) AS c2, +COLLATION(ÐÁÒÁÍ2) AS c3; +SELECT +COLLATION('ÔÅËÓÔ') AS c4, +COLLATION( 'ÔÅËÓÔ') AS c5, +COLLATION( 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET ÐÁÒÁÍ1 = 'a'; +SET ÐÁÒÁÍ2 = 'b'; +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost koi8r koi8r_general_ci utf8_unicode_ci + + +SET @a = '1'| +SET @b = '2'| + + +CALL p1(@a, @b)| +c1 c2 c3 +utf8_unicode_ci utf8_unicode_ci utf8_unicode_ci +c4 c5 c6 c7 c8 +koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r +SELECT COLLATION(@a) AS ca, COLLATION(@b) cb| +ca cb +utf8_unicode_ci utf8_unicode_ci + +CALL p2(@a, @b)| +c1 c2 c3 +utf8_general_ci utf8_general_ci utf8_general_ci +c4 c5 c6 c7 c8 +koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r +SELECT COLLATION(@a) AS ca, COLLATION(@b) cb| +ca cb +utf8_general_ci utf8_general_ci + +CALL mysqltest2.p3(@a, @b)| +c1 c2 c3 +utf8_unicode_ci utf8_unicode_ci utf8_unicode_ci +c4 c5 c6 c7 c8 +koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r +SELECT COLLATION(@a) AS ca, COLLATION(@b) cb| +ca cb +utf8_unicode_ci utf8_unicode_ci + +CALL mysqltest2.p4(@a, @b)| +c1 c2 c3 +utf8_general_ci utf8_general_ci utf8_general_ci +c4 c5 c6 c7 c8 +koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r +SELECT COLLATION(@a) AS ca, COLLATION(@b) cb| +ca cb +utf8_general_ci utf8_general_ci + +---> connection: default +use test| +DROP DATABASE mysqltest1| +DROP DATABASE mysqltest2| + +------------------------------------------------------------------- +Triggers +------------------------------------------------------------------- + +DROP DATABASE IF EXISTS mysqltest1| +DROP DATABASE IF EXISTS mysqltest2| +CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| +CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| +use mysqltest1| +CREATE TABLE t1(c INT)| +CREATE TABLE mysqltest2.t1(c INT)| +CREATE TABLE log(msg VARCHAR(255))| +CREATE TABLE mysqltest2.log(msg VARCHAR(255))| + +CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'ÔÅËÓÔ'; +SET @a1 = _koi8r 'ÔÅËÓÔ'; +SET @a2 = _utf8 'текÑÑ‚'; +END| + +CREATE TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'ÔÅËÓÔ'; +SET @b1 = _koi8r 'ÔÅËÓÔ'; +SET @b2 = _utf8 'текÑÑ‚'; +END| + +CREATE TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'ÔÅËÓÔ'; +SET @a1 = _koi8r 'ÔÅËÓÔ'; +SET @a2 = _utf8 'текÑÑ‚'; +END| + +CREATE TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'ÔÅËÓÔ'; +SET @b1 = _koi8r 'ÔÅËÓÔ'; +SET @b2 = _utf8 'текÑÑ‚'; +END| + + + +SHOW CREATE TRIGGER trg1| +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +trg1 CREATE DEFINER=`root`@`localhost` TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'ÔÅËÓÔ'; +SET @a1 = _koi8r 'ÔÅËÓÔ'; +SET @a2 = _utf8 'текÑÑ‚'; +END koi8r koi8r_general_ci utf8_unicode_ci + +SHOW CREATE TRIGGER trg2| +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +trg2 CREATE DEFINER=`root`@`localhost` TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'ÔÅËÓÔ'; +SET @b1 = _koi8r 'ÔÅËÓÔ'; +SET @b2 = _utf8 'текÑÑ‚'; +END koi8r koi8r_general_ci utf8_unicode_ci + +SHOW CREATE TRIGGER mysqltest2.trg3| +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +trg3 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'ÔÅËÓÔ'; +SET @a1 = _koi8r 'ÔÅËÓÔ'; +SET @a2 = _utf8 'текÑÑ‚'; +END koi8r koi8r_general_ci utf8_unicode_ci + +SHOW CREATE TRIGGER mysqltest2.trg4| +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +trg4 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'ÔÅËÓÔ'; +SET @b1 = _koi8r 'ÔÅËÓÔ'; +SET @b2 = _utf8 'текÑÑ‚'; +END koi8r koi8r_general_ci utf8_unicode_ci + + +SHOW TRIGGERS| +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +trg1 INSERT t1 BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'ÔÅËÓÔ'; +SET @a1 = 'ÔÅËÓÔ'; +SET @a2 = 'ÔÅËÓÔ'; +END BEFORE NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci +trg2 INSERT t1 BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'ÔÅËÓÔ'; +SET @b1 = 'ÔÅËÓÔ'; +SET @b2 = 'ÔÅËÓÔ'; +END AFTER NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci + +use mysqltest2| + +SHOW TRIGGERS| +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +trg3 INSERT t1 BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'ÔÅËÓÔ'; +SET @a1 = 'ÔÅËÓÔ'; +SET @a2 = 'ÔÅËÓÔ'; +END BEFORE NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci +trg4 INSERT t1 BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'ÔÅËÓÔ'; +SET @b1 = 'ÔÅËÓÔ'; +SET @b2 = 'ÔÅËÓÔ'; +END AFTER NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci +use mysqltest1| + + +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg1'| +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest1 trg1 INSERT NULL mysqltest1 t1 0 NULL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'ÔÅËÓÔ'; +SET @a1 = 'ÔÅËÓÔ'; +SET @a2 = 'ÔÅËÓÔ'; +END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg2'| +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest1 trg2 INSERT NULL mysqltest1 t1 0 NULL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'ÔÅËÓÔ'; +SET @b1 = 'ÔÅËÓÔ'; +SET @b2 = 'ÔÅËÓÔ'; +END ROW AFTER NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg3'| +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest2 trg3 INSERT NULL mysqltest2 t1 0 NULL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'ÔÅËÓÔ'; +SET @a1 = 'ÔÅËÓÔ'; +SET @a2 = 'ÔÅËÓÔ'; +END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg4'| +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest2 trg4 INSERT NULL mysqltest2 t1 0 NULL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'ÔÅËÓÔ'; +SET @b1 = 'ÔÅËÓÔ'; +SET @b2 = 'ÔÅËÓÔ'; +END ROW AFTER NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci utf8_unicode_ci + + +SET @a1 = '1'| +SET @a2 = '1'| +SET @a3 = '1'| +SET @b1 = '2'| +SET @b2 = '2'| +SET @b3 = '2'| + + +INSERT INTO t1 VALUES(1)| + +---> Log: +SELECT msg FROM log| +msg +utf8_unicode_ci +koi8r_general_ci +koi8r_general_ci +utf8_general_ci +koi8r_general_ci +koi8r +utf8_general_ci +koi8r_general_ci +koi8r_general_ci +utf8_general_ci +koi8r_general_ci +koi8r + +SELECT +COLLATION(@a1) AS ca1, +COLLATION(@a2) AS ca2, +COLLATION(@a3) AS ca3, +COLLATION(@b1) AS cb1, +COLLATION(@b2) AS cb2, +COLLATION(@b3) AS cb3| +ca1 ca2 ca3 cb1 cb2 cb3 +koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci + +DELETE FROM log| + + +INSERT INTO mysqltest2.t1 VALUES(1)| + +---> Log: +SELECT msg FROM mysqltest2.log| +msg +utf8_unicode_ci +koi8r_general_ci +koi8r_general_ci +utf8_general_ci +koi8r_general_ci +koi8r +utf8_general_ci +koi8r_general_ci +koi8r_general_ci +utf8_general_ci +koi8r_general_ci +koi8r + +SELECT +COLLATION(@a1) AS ca1, +COLLATION(@a2) AS ca2, +COLLATION(@a3) AS ca3, +COLLATION(@b1) AS cb1, +COLLATION(@b2) AS cb2, +COLLATION(@b3) AS cb3| +ca1 ca2 ca3 cb1 cb2 cb3 +koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci + +DELETE FROM mysqltest2.log| + + +ALTER DATABASE mysqltest1 COLLATE cp866_general_ci| +ALTER DATABASE mysqltest2 COLLATE cp866_general_ci| +ALTER TABLE t1 ADD COLUMN fake INT| +ALTER TABLE t1 DROP COLUMN fake| +ALTER TABLE mysqltest2.t1 ADD COLUMN fake INT| +ALTER TABLE mysqltest2.t1 DROP COLUMN fake| + +---> connection: con2 +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| +INSERT INTO mysqltest1.t1 VALUES(0)| +INSERT INTO mysqltest2.t1 VALUES(0)| +DELETE FROM mysqltest1.log| +DELETE FROM mysqltest2.log| +set names koi8r| +use mysqltest1| + + +SHOW CREATE TRIGGER trg1| +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +trg1 CREATE DEFINER=`root`@`localhost` TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'ÔÅËÓÔ'; +SET @a1 = _koi8r 'ÔÅËÓÔ'; +SET @a2 = _utf8 'текÑÑ‚'; +END koi8r koi8r_general_ci utf8_unicode_ci + +SHOW CREATE TRIGGER trg2| +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +trg2 CREATE DEFINER=`root`@`localhost` TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'ÔÅËÓÔ'; +SET @b1 = _koi8r 'ÔÅËÓÔ'; +SET @b2 = _utf8 'текÑÑ‚'; +END koi8r koi8r_general_ci utf8_unicode_ci + +SHOW CREATE TRIGGER mysqltest2.trg3| +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +trg3 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'ÔÅËÓÔ'; +SET @a1 = _koi8r 'ÔÅËÓÔ'; +SET @a2 = _utf8 'текÑÑ‚'; +END koi8r koi8r_general_ci utf8_unicode_ci + +SHOW CREATE TRIGGER mysqltest2.trg4| +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +trg4 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'ÔÅËÓÔ'; +SET @b1 = _koi8r 'ÔÅËÓÔ'; +SET @b2 = _utf8 'текÑÑ‚'; +END koi8r koi8r_general_ci utf8_unicode_ci + + +SHOW TRIGGERS| +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +trg1 INSERT t1 BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'ÔÅËÓÔ'; +SET @a1 = 'ÔÅËÓÔ'; +SET @a2 = 'ÔÅËÓÔ'; +END BEFORE NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci +trg2 INSERT t1 BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'ÔÅËÓÔ'; +SET @b1 = 'ÔÅËÓÔ'; +SET @b2 = 'ÔÅËÓÔ'; +END AFTER NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci + +use mysqltest2| + +SHOW TRIGGERS| +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +trg3 INSERT t1 BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'ÔÅËÓÔ'; +SET @a1 = 'ÔÅËÓÔ'; +SET @a2 = 'ÔÅËÓÔ'; +END BEFORE NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci +trg4 INSERT t1 BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'ÔÅËÓÔ'; +SET @b1 = 'ÔÅËÓÔ'; +SET @b2 = 'ÔÅËÓÔ'; +END AFTER NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci +use mysqltest1| + + +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg1'| +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest1 trg1 INSERT NULL mysqltest1 t1 0 NULL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'ÔÅËÓÔ'; +SET @a1 = 'ÔÅËÓÔ'; +SET @a2 = 'ÔÅËÓÔ'; +END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg2'| +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest1 trg2 INSERT NULL mysqltest1 t1 0 NULL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'ÔÅËÓÔ'; +SET @b1 = 'ÔÅËÓÔ'; +SET @b2 = 'ÔÅËÓÔ'; +END ROW AFTER NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg3'| +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest2 trg3 INSERT NULL mysqltest2 t1 0 NULL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'ÔÅËÓÔ'; +SET @a1 = 'ÔÅËÓÔ'; +SET @a2 = 'ÔÅËÓÔ'; +END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg4'| +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest2 trg4 INSERT NULL mysqltest2 t1 0 NULL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'ÔÅËÓÔ'; +SET @b1 = 'ÔÅËÓÔ'; +SET @b2 = 'ÔÅËÓÔ'; +END ROW AFTER NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci utf8_unicode_ci + + +SET @a1 = '1'| +SET @a2 = '1'| +SET @a3 = '1'| +SET @b1 = '2'| +SET @b2 = '2'| +SET @b3 = '2'| + + +INSERT INTO t1 VALUES(1)| + +---> Log: +SELECT msg FROM log| +msg +utf8_unicode_ci +koi8r_general_ci +koi8r_general_ci +utf8_general_ci +koi8r_general_ci +koi8r +utf8_general_ci +koi8r_general_ci +koi8r_general_ci +utf8_general_ci +koi8r_general_ci +koi8r + +SELECT +COLLATION(@a1) AS ca1, +COLLATION(@a2) AS ca2, +COLLATION(@a3) AS ca3, +COLLATION(@b1) AS cb1, +COLLATION(@b2) AS cb2, +COLLATION(@b3) AS cb3| +ca1 ca2 ca3 cb1 cb2 cb3 +koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci + +DELETE FROM log| + + +INSERT INTO mysqltest2.t1 VALUES(1)| + +---> Log: +SELECT msg FROM mysqltest2.log| +msg +utf8_unicode_ci +koi8r_general_ci +koi8r_general_ci +utf8_general_ci +koi8r_general_ci +koi8r +utf8_general_ci +koi8r_general_ci +koi8r_general_ci +utf8_general_ci +koi8r_general_ci +koi8r + +SELECT +COLLATION(@a1) AS ca1, +COLLATION(@a2) AS ca2, +COLLATION(@a3) AS ca3, +COLLATION(@b1) AS cb1, +COLLATION(@b2) AS cb2, +COLLATION(@b3) AS cb3| +ca1 ca2 ca3 cb1 cb2 cb3 +koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci + +DELETE FROM mysqltest2.log| + +---> Dump of mysqltest1 + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 */; + +USE `mysqltest1`; +CREATE TABLE `log` ( + `msg` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +CREATE TABLE `t1` ( + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +INSERT INTO `t1` VALUES (1),(0),(1); +ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = koi8r */ ; +/*!50003 SET character_set_results = koi8r */ ; +/*!50003 SET collation_connection = koi8r_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'ÔÅËÓÔ'; +SET @a1 = _koi8r 'ÔÅËÓÔ'; +SET @a2 = _utf8 'текÑÑ‚'; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +ALTER DATABASE mysqltest1 CHARACTER SET cp866 COLLATE cp866_general_ci ; +ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = koi8r */ ; +/*!50003 SET character_set_results = koi8r */ ; +/*!50003 SET collation_connection = koi8r_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'ÔÅËÓÔ'; +SET @b1 = _koi8r 'ÔÅËÓÔ'; +SET @b2 = _utf8 'текÑÑ‚'; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +ALTER DATABASE mysqltest1 CHARACTER SET cp866 COLLATE cp866_general_ci ; + +---> Dumping mysqltest1 to ddl_i18n_koi8r.triggers.mysqltest1.sql + +---> Dump of mysqltest2 + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 */; + +USE `mysqltest2`; +CREATE TABLE `log` ( + `msg` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +CREATE TABLE `t1` ( + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +INSERT INTO `t1` VALUES (1),(0),(1); +ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = koi8r */ ; +/*!50003 SET character_set_results = koi8r */ ; +/*!50003 SET collation_connection = koi8r_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'ÔÅËÓÔ'; +SET @a1 = _koi8r 'ÔÅËÓÔ'; +SET @a2 = _utf8 'текÑÑ‚'; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +ALTER DATABASE mysqltest2 CHARACTER SET cp866 COLLATE cp866_general_ci ; +ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = koi8r */ ; +/*!50003 SET character_set_results = koi8r */ ; +/*!50003 SET collation_connection = koi8r_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'ÔÅËÓÔ'; +SET @b1 = _koi8r 'ÔÅËÓÔ'; +SET @b2 = _utf8 'текÑÑ‚'; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +ALTER DATABASE mysqltest2 CHARACTER SET cp866 COLLATE cp866_general_ci ; + +---> Dumping mysqltest2 to ddl_i18n_koi8r.triggers.mysqltest2.sql + + +DROP DATABASE mysqltest1| +DROP DATABASE mysqltest2| + + +---> Restoring mysqltest1... +---> Restoring mysqltest2... +ALTER TABLE mysqltest1.t1 ADD COLUMN fake INT| +ALTER TABLE mysqltest1.t1 DROP COLUMN fake| +ALTER TABLE mysqltest2.t1 ADD COLUMN fake INT| +ALTER TABLE mysqltest2.t1 DROP COLUMN fake| + +---> connection: con3 +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| +INSERT INTO mysqltest1.t1 VALUES(0)| +INSERT INTO mysqltest2.t1 VALUES(0)| +DELETE FROM mysqltest1.log| +DELETE FROM mysqltest2.log| +set names koi8r| +use mysqltest1| + + +SHOW CREATE TRIGGER trg1| +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +trg1 CREATE DEFINER=`root`@`localhost` TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'ÔÅËÓÔ'; +SET @a1 = _koi8r 'ÔÅËÓÔ'; +SET @a2 = _utf8 'текÑÑ‚'; +END koi8r koi8r_general_ci utf8_unicode_ci + +SHOW CREATE TRIGGER trg2| +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +trg2 CREATE DEFINER=`root`@`localhost` TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'ÔÅËÓÔ'; +SET @b1 = _koi8r 'ÔÅËÓÔ'; +SET @b2 = _utf8 'текÑÑ‚'; +END koi8r koi8r_general_ci utf8_unicode_ci + +SHOW CREATE TRIGGER mysqltest2.trg3| +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +trg3 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'ÔÅËÓÔ'; +SET @a1 = _koi8r 'ÔÅËÓÔ'; +SET @a2 = _utf8 'текÑÑ‚'; +END koi8r koi8r_general_ci utf8_unicode_ci + +SHOW CREATE TRIGGER mysqltest2.trg4| +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +trg4 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'ÔÅËÓÔ'; +SET @b1 = _koi8r 'ÔÅËÓÔ'; +SET @b2 = _utf8 'текÑÑ‚'; +END koi8r koi8r_general_ci utf8_unicode_ci + + +SHOW TRIGGERS| +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +trg1 INSERT t1 BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'ÔÅËÓÔ'; +SET @a1 = 'ÔÅËÓÔ'; +SET @a2 = 'ÔÅËÓÔ'; +END BEFORE NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci +trg2 INSERT t1 BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'ÔÅËÓÔ'; +SET @b1 = 'ÔÅËÓÔ'; +SET @b2 = 'ÔÅËÓÔ'; +END AFTER NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci + +use mysqltest2| + +SHOW TRIGGERS| +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +trg3 INSERT t1 BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'ÔÅËÓÔ'; +SET @a1 = 'ÔÅËÓÔ'; +SET @a2 = 'ÔÅËÓÔ'; +END BEFORE NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci +trg4 INSERT t1 BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'ÔÅËÓÔ'; +SET @b1 = 'ÔÅËÓÔ'; +SET @b2 = 'ÔÅËÓÔ'; +END AFTER NULL root@localhost koi8r koi8r_general_ci utf8_unicode_ci +use mysqltest1| + + +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg1'| +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest1 trg1 INSERT NULL mysqltest1 t1 0 NULL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'ÔÅËÓÔ'; +SET @a1 = 'ÔÅËÓÔ'; +SET @a2 = 'ÔÅËÓÔ'; +END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg2'| +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest1 trg2 INSERT NULL mysqltest1 t1 0 NULL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'ÔÅËÓÔ'; +SET @b1 = 'ÔÅËÓÔ'; +SET @b2 = 'ÔÅËÓÔ'; +END ROW AFTER NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg3'| +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest2 trg3 INSERT NULL mysqltest2 t1 0 NULL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'ÔÅËÓÔ'; +SET @a1 = 'ÔÅËÓÔ'; +SET @a2 = 'ÔÅËÓÔ'; +END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg4'| +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest2 trg4 INSERT NULL mysqltest2 t1 0 NULL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); +INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(COLLATION( 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'ÔÅËÓÔ'; +SET @b1 = 'ÔÅËÓÔ'; +SET @b2 = 'ÔÅËÓÔ'; +END ROW AFTER NULL NULL OLD NEW CREATED root@localhost koi8r koi8r_general_ci utf8_unicode_ci + + +SET @a1 = '1'| +SET @a2 = '1'| +SET @a3 = '1'| +SET @b1 = '2'| +SET @b2 = '2'| +SET @b3 = '2'| + + +INSERT INTO t1 VALUES(1)| + +---> Log: +SELECT msg FROM log| +msg +utf8_unicode_ci +koi8r_general_ci +koi8r_general_ci +utf8_general_ci +koi8r_general_ci +koi8r +utf8_general_ci +koi8r_general_ci +koi8r_general_ci +utf8_general_ci +koi8r_general_ci +koi8r + +SELECT +COLLATION(@a1) AS ca1, +COLLATION(@a2) AS ca2, +COLLATION(@a3) AS ca3, +COLLATION(@b1) AS cb1, +COLLATION(@b2) AS cb2, +COLLATION(@b3) AS cb3| +ca1 ca2 ca3 cb1 cb2 cb3 +koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci + +DELETE FROM log| + + +INSERT INTO mysqltest2.t1 VALUES(1)| + +---> Log: +SELECT msg FROM mysqltest2.log| +msg +utf8_unicode_ci +koi8r_general_ci +koi8r_general_ci +utf8_general_ci +koi8r_general_ci +koi8r +utf8_general_ci +koi8r_general_ci +koi8r_general_ci +utf8_general_ci +koi8r_general_ci +koi8r + +SELECT +COLLATION(@a1) AS ca1, +COLLATION(@a2) AS ca2, +COLLATION(@a3) AS ca3, +COLLATION(@b1) AS cb1, +COLLATION(@b2) AS cb2, +COLLATION(@b3) AS cb3| +ca1 ca2 ca3 cb1 cb2 cb3 +koi8r_general_ci utf8_general_ci koi8r_general_ci koi8r_general_ci utf8_general_ci koi8r_general_ci + +DELETE FROM mysqltest2.log| + +---> connection: default +use test| +DROP DATABASE mysqltest1| +DROP DATABASE mysqltest2| + +------------------------------------------------------------------- +Events +------------------------------------------------------------------- + +DROP DATABASE IF EXISTS mysqltest1| +DROP DATABASE IF EXISTS mysqltest2| +CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| +CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| +use mysqltest1| + +CREATE EVENT ev1 ON SCHEDULE AT '2030-01-01 00:00:00' DO +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c3, +COLLATION(_utf8 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END| + +CREATE EVENT ev2 ON SCHEDULE AT '2030-01-01 00:00:00' DO +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c3, +COLLATION(_utf8 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END| + +CREATE EVENT mysqltest2.ev3 ON SCHEDULE AT '2030-01-01 00:00:00' DO +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c3, +COLLATION(_utf8 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END| + +CREATE EVENT mysqltest2.ev4 ON SCHEDULE AT '2030-01-01 00:00:00' DO +BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c3, +COLLATION(_utf8 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +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 +DECLARE ÐÅÒÅÍ1 CHAR(10); +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c3, +COLLATION(_utf8 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +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 +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c3, +COLLATION(_utf8 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +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 +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c3, +COLLATION(_utf8 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +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 +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c3, +COLLATION(_utf8 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END koi8r koi8r_general_ci utf8_unicode_ci + + +SHOW EVENTS LIKE 'ev1'| +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +mysqltest1 ev1 root@localhost SYSTEM ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED 1 koi8r koi8r_general_ci utf8_unicode_ci + +SHOW EVENTS LIKE 'ev2'| +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +mysqltest1 ev2 root@localhost SYSTEM ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED 1 koi8r koi8r_general_ci utf8_unicode_ci + +SHOW EVENTS LIKE 'ev3'| +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation + +SHOW EVENTS LIKE 'ev4'| +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation + + +SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev1'| +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest1 ev1 root@localhost SYSTEM SQL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION( 'ÔÅËÓÔ') AS c3, +COLLATION( 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev2'| +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest1 ev2 root@localhost SYSTEM SQL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION( 'ÔÅËÓÔ') AS c3, +COLLATION( 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev3'| +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest2 ev3 root@localhost SYSTEM SQL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION( 'ÔÅËÓÔ') AS c3, +COLLATION( 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev4'| +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest2 ev4 root@localhost SYSTEM SQL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION( 'ÔÅËÓÔ') AS c3, +COLLATION( 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci + + +ALTER DATABASE mysqltest1 COLLATE cp866_general_ci| +ALTER DATABASE mysqltest2 COLLATE cp866_general_ci| + +---> connection: con2 +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| +SHOW CREATE EVENT ev1| +SHOW CREATE EVENT ev2| +SHOW CREATE EVENT mysqltest2.ev3| +SHOW CREATE EVENT mysqltest2.ev4| +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 +DECLARE ÐÅÒÅÍ1 CHAR(10); +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c3, +COLLATION(_utf8 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +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 +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c3, +COLLATION(_utf8 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +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 +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c3, +COLLATION(_utf8 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +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 +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c3, +COLLATION(_utf8 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END koi8r koi8r_general_ci utf8_unicode_ci + + +SHOW EVENTS LIKE 'ev1'| +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +mysqltest1 ev1 root@localhost SYSTEM ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED 1 koi8r koi8r_general_ci utf8_unicode_ci + +SHOW EVENTS LIKE 'ev2'| +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +mysqltest1 ev2 root@localhost SYSTEM ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED 1 koi8r koi8r_general_ci utf8_unicode_ci + +SHOW EVENTS LIKE 'ev3'| +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation + +SHOW EVENTS LIKE 'ev4'| +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation + + +SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev1'| +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest1 ev1 root@localhost SYSTEM SQL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION( 'ÔÅËÓÔ') AS c3, +COLLATION( 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev2'| +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest1 ev2 root@localhost SYSTEM SQL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION( 'ÔÅËÓÔ') AS c3, +COLLATION( 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev3'| +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest2 ev3 root@localhost SYSTEM SQL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION( 'ÔÅËÓÔ') AS c3, +COLLATION( 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev4'| +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest2 ev4 root@localhost SYSTEM SQL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION( 'ÔÅËÓÔ') AS c3, +COLLATION( 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci + +---> Dump of mysqltest1 + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 */; + +USE `mysqltest1`; +/*!50106 SET @save_time_zone= @@TIME_ZONE */ ; +DELIMITER ;; +ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;; +/*!50003 SET @saved_cs_client = @@character_set_client */ ;; +/*!50003 SET @saved_cs_results = @@character_set_results */ ;; +/*!50003 SET @saved_col_connection = @@collation_connection */ ;; +/*!50003 SET character_set_client = koi8r */ ;; +/*!50003 SET character_set_results = koi8r */ ;; +/*!50003 SET collation_connection = koi8r_general_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!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 +DECLARE ÐÅÒÅÍ1 CHAR(10); +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c3, +COLLATION(_utf8 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END */ ;; +/*!50003 SET time_zone = @saved_time_zone */ ;; +/*!50003 SET sql_mode = @saved_sql_mode */ ;; +/*!50003 SET character_set_client = @saved_cs_client */ ;; +/*!50003 SET character_set_results = @saved_cs_results */ ;; +/*!50003 SET collation_connection = @saved_col_connection */ ;; +ALTER DATABASE mysqltest1 CHARACTER SET cp866 COLLATE cp866_general_ci ;; +DELIMITER ;; +ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;; +/*!50003 SET @saved_cs_client = @@character_set_client */ ;; +/*!50003 SET @saved_cs_results = @@character_set_results */ ;; +/*!50003 SET @saved_col_connection = @@collation_connection */ ;; +/*!50003 SET character_set_client = koi8r */ ;; +/*!50003 SET character_set_results = koi8r */ ;; +/*!50003 SET collation_connection = koi8r_general_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!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 +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c3, +COLLATION(_utf8 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END */ ;; +/*!50003 SET time_zone = @saved_time_zone */ ;; +/*!50003 SET sql_mode = @saved_sql_mode */ ;; +/*!50003 SET character_set_client = @saved_cs_client */ ;; +/*!50003 SET character_set_results = @saved_cs_results */ ;; +/*!50003 SET collation_connection = @saved_col_connection */ ;; +ALTER DATABASE mysqltest1 CHARACTER SET cp866 COLLATE cp866_general_ci ;; +DELIMITER ; +/*!50106 SET TIME_ZONE= @save_time_zone */ ; + +---> Dumping mysqltest1 to ddl_i18n_koi8r.events.mysqltest1.sql + +---> Dump of mysqltest2 + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 */; + +USE `mysqltest2`; +/*!50106 SET @save_time_zone= @@TIME_ZONE */ ; +DELIMITER ;; +ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;; +/*!50003 SET @saved_cs_client = @@character_set_client */ ;; +/*!50003 SET @saved_cs_results = @@character_set_results */ ;; +/*!50003 SET @saved_col_connection = @@collation_connection */ ;; +/*!50003 SET character_set_client = koi8r */ ;; +/*!50003 SET character_set_results = koi8r */ ;; +/*!50003 SET collation_connection = koi8r_general_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!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 +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c3, +COLLATION(_utf8 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END */ ;; +/*!50003 SET time_zone = @saved_time_zone */ ;; +/*!50003 SET sql_mode = @saved_sql_mode */ ;; +/*!50003 SET character_set_client = @saved_cs_client */ ;; +/*!50003 SET character_set_results = @saved_cs_results */ ;; +/*!50003 SET collation_connection = @saved_col_connection */ ;; +ALTER DATABASE mysqltest2 CHARACTER SET cp866 COLLATE cp866_general_ci ;; +DELIMITER ;; +ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;; +/*!50003 SET @saved_cs_client = @@character_set_client */ ;; +/*!50003 SET @saved_cs_results = @@character_set_results */ ;; +/*!50003 SET @saved_col_connection = @@collation_connection */ ;; +/*!50003 SET character_set_client = koi8r */ ;; +/*!50003 SET character_set_results = koi8r */ ;; +/*!50003 SET collation_connection = koi8r_general_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!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 +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c3, +COLLATION(_utf8 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END */ ;; +/*!50003 SET time_zone = @saved_time_zone */ ;; +/*!50003 SET sql_mode = @saved_sql_mode */ ;; +/*!50003 SET character_set_client = @saved_cs_client */ ;; +/*!50003 SET character_set_results = @saved_cs_results */ ;; +/*!50003 SET collation_connection = @saved_col_connection */ ;; +ALTER DATABASE mysqltest2 CHARACTER SET cp866 COLLATE cp866_general_ci ;; +DELIMITER ; +/*!50106 SET TIME_ZONE= @save_time_zone */ ; + +---> Dumping mysqltest2 to ddl_i18n_koi8r.events.mysqltest2.sql + + +DROP DATABASE mysqltest1| +DROP DATABASE mysqltest2| + + +---> Restoring mysqltest1... +---> Restoring mysqltest2... + +---> connection: con3 +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| +SHOW CREATE EVENT ev1| +SHOW CREATE EVENT ev2| +SHOW CREATE EVENT mysqltest2.ev3| +SHOW CREATE EVENT mysqltest2.ev4| +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 +DECLARE ÐÅÒÅÍ1 CHAR(10); +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c3, +COLLATION(_utf8 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +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 +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c3, +COLLATION(_utf8 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +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 +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c3, +COLLATION(_utf8 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +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 +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c3, +COLLATION(_utf8 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END koi8r koi8r_general_ci utf8_unicode_ci + + +SHOW EVENTS LIKE 'ev1'| +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +mysqltest1 ev1 root@localhost SYSTEM ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED 1 koi8r koi8r_general_ci utf8_unicode_ci + +SHOW EVENTS LIKE 'ev2'| +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +mysqltest1 ev2 root@localhost SYSTEM ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED 1 koi8r koi8r_general_ci utf8_unicode_ci + +SHOW EVENTS LIKE 'ev3'| +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation + +SHOW EVENTS LIKE 'ev4'| +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation + + +SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev1'| +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest1 ev1 root@localhost SYSTEM SQL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10); +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION( 'ÔÅËÓÔ') AS c3, +COLLATION( 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev2'| +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest1 ev2 root@localhost SYSTEM SQL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION( 'ÔÅËÓÔ') AS c3, +COLLATION( 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev3'| +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest2 ev3 root@localhost SYSTEM SQL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION( 'ÔÅËÓÔ') AS c3, +COLLATION( 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev4'| +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest2 ev4 root@localhost SYSTEM SQL BEGIN +DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(ÐÅÒÅÍ1) AS c1, +COLLATION('ÔÅËÓÔ') AS c2, +COLLATION( 'ÔÅËÓÔ') AS c3, +COLLATION( 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8_unicode_ci + +------------------------------------------------------------------- +DDL statements within stored routine. +------------------------------------------------------------------- + +DROP DATABASE IF EXISTS mysqltest1| +DROP DATABASE IF EXISTS mysqltest2| +CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| +CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| +use mysqltest1| + +CREATE PROCEDURE p1() +BEGIN +CREATE TABLE t1(col1 VARCHAR(10)); +SHOW CREATE TABLE t1; +END| + +CREATE PROCEDURE mysqltest2.p2() +BEGIN +CREATE TABLE t2(col1 VARCHAR(10)); +SHOW CREATE TABLE t2; +END| + +CALL p1()| +Table Create Table +t1 CREATE TABLE `t1` ( + `col1` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci + +SHOW CREATE TABLE t1| +Table Create Table +t1 CREATE TABLE `t1` ( + `col1` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci + + +CALL mysqltest2.p2()| +Table Create Table +t2 CREATE TABLE `t2` ( + `col1` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci + +SHOW CREATE TABLE mysqltest2.t2| +Table Create Table +t2 CREATE TABLE `t2` ( + `col1` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci + +ALTER DATABASE mysqltest1 COLLATE cp1251_general_cs| +ALTER DATABASE mysqltest2 COLLATE cp1251_general_cs| +DROP TABLE t1| +DROP TABLE mysqltest2.t2| + +CALL p1()| +Table Create Table +t1 CREATE TABLE `t1` ( + `col1` varchar(10) COLLATE cp1251_general_cs DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs + +SHOW CREATE TABLE t1| +Table Create Table +t1 CREATE TABLE `t1` ( + `col1` varchar(10) COLLATE cp1251_general_cs DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs + + +CALL mysqltest2.p2()| +Table Create Table +t2 CREATE TABLE `t2` ( + `col1` varchar(10) COLLATE cp1251_general_cs DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs + +SHOW CREATE TABLE mysqltest2.t2| +Table Create Table +t2 CREATE TABLE `t2` ( + `col1` varchar(10) COLLATE cp1251_general_cs DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs + +---> connection: default +use test| +DROP DATABASE mysqltest1| +DROP DATABASE mysqltest2| diff --git a/mysql-test/r/ddl_i18n_utf8.result b/mysql-test/r/ddl_i18n_utf8.result new file mode 100644 index 00000000000..d74d014d755 --- /dev/null +++ b/mysql-test/r/ddl_i18n_utf8.result @@ -0,0 +1,2783 @@ +set names utf8; + +------------------------------------------------------------------- +Views +------------------------------------------------------------------- + +DROP DATABASE IF EXISTS mysqltest1| +CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| +use mysqltest1| +CREATE TABLE t1(кол INT)| +INSERT INTO t1 VALUES(1)| + +CREATE VIEW v1 AS +SELECT 'теÑÑ‚' AS c1, кол AS c2 +FROM t1| + +CREATE VIEW v2 AS SELECT _koi8r'ÔÅÓÔ' as c1| + + + +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 _utf8'теÑÑ‚' AS `c1`,`t1`.`кол` AS `c2` from `t1` utf8 utf8_general_ci + +SHOW CREATE VIEW v2| +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select _koi8r'ÔÅÓÔ' AS `c1` utf8 utf8_general_ci + + +SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'| +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION +NULL mysqltest1 v1 SELECT 'теÑÑ‚' AS c1, кол AS c2 NONE YES root@localhost DEFINER utf8 utf8_general_ci + +SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'| +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION +NULL mysqltest1 v2 SELECT 'теÑÑ‚' as c1 NONE NO root@localhost DEFINER utf8 utf8_general_ci + + +SELECT COLLATION(c1), COLLATION(c2) FROM v1| +COLLATION(c1) COLLATION(c2) +utf8_general_ci binary + +SELECT COLLATION(c1) FROM v2| +COLLATION(c1) +koi8r_general_ci + + +ALTER DATABASE mysqltest1 COLLATE cp866_general_ci| + +---> connection: con2 +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| +SELECT * FROM mysqltest1.v1| +SELECT * FROM mysqltest1.v2| +use mysqltest1| +set names utf8| + + +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 _utf8'теÑÑ‚' AS `c1`,`t1`.`кол` AS `c2` from `t1` utf8 utf8_general_ci + +SHOW CREATE VIEW v2| +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select _koi8r'ÔÅÓÔ' AS `c1` utf8 utf8_general_ci + + +SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'| +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION +NULL mysqltest1 v1 SELECT 'теÑÑ‚' AS c1, кол AS c2 NONE YES root@localhost DEFINER utf8 utf8_general_ci + +SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'| +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION +NULL mysqltest1 v2 SELECT 'теÑÑ‚' as c1 NONE NO root@localhost DEFINER utf8 utf8_general_ci + + +SELECT COLLATION(c1), COLLATION(c2) FROM v1| +COLLATION(c1) COLLATION(c2) +utf8_general_ci binary + +SELECT COLLATION(c1) FROM v2| +COLLATION(c1) +koi8r_general_ci + +---> Dumping mysqltest1 to ddl_i18n_utf8views.mysqltest1.sql + + +DROP DATABASE mysqltest1| + + +---> Restoring mysqltest1... + +---> connection: con3 +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| +SELECT * FROM mysqltest1.v1| +SELECT * FROM mysqltest1.v2| +use mysqltest1| +set names utf8| + + +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 _utf8'теÑÑ‚' AS `c1`,`t1`.`кол` AS `c2` from `t1` utf8 utf8_general_ci + +SHOW CREATE VIEW v2| +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select _koi8r'ÔÅÓÔ' AS `c1` utf8 utf8_general_ci + + +SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'| +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION +NULL mysqltest1 v1 select 'теÑÑ‚' AS `c1`,`t1`.`кол` AS `c2` from `t1` NONE YES root@localhost DEFINER utf8 utf8_general_ci + +SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'| +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION +NULL mysqltest1 v2 select 'теÑÑ‚' AS `c1` NONE NO root@localhost DEFINER utf8 utf8_general_ci + + +SELECT COLLATION(c1), COLLATION(c2) FROM v1| +COLLATION(c1) COLLATION(c2) +utf8_general_ci binary + +SELECT COLLATION(c1) FROM v2| +COLLATION(c1) +koi8r_general_ci + +---> connection: default +use test| +DROP DATABASE mysqltest1| + +------------------------------------------------------------------- +Stored procedures/functions +------------------------------------------------------------------- + +DROP DATABASE IF EXISTS mysqltest1| +DROP DATABASE IF EXISTS mysqltest2| +CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| +CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| +use mysqltest1| + +CREATE PROCEDURE p1( +INOUT парам1 CHAR(10), +OUT парам2 CHAR(10)) +BEGIN +DECLARE перем1 CHAR(10); +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION(_utf8 'текÑÑ‚') AS c5, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END| + +CREATE PROCEDURE p2( +INOUT парам1 CHAR(10) CHARACTER SET utf8, +OUT парам2 CHAR(10) CHARACTER SET utf8) +BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION(_utf8 'текÑÑ‚') AS c5, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END| + +CREATE PROCEDURE mysqltest2.p3( +INOUT парам1 CHAR(10), +OUT парам2 CHAR(10)) +BEGIN +DECLARE перем1 CHAR(10); +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION(_utf8 'текÑÑ‚') AS c5, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END| + +CREATE PROCEDURE mysqltest2.p4( +INOUT парам1 CHAR(10) CHARACTER SET utf8, +OUT парам2 CHAR(10) CHARACTER SET utf8) +BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION(_utf8 'текÑÑ‚') AS c5, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END| + + +SHOW CREATE PROCEDURE p1| +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`( +INOUT парам1 CHAR(10), +OUT парам2 CHAR(10)) +BEGIN +DECLARE перем1 CHAR(10); +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION(_utf8 'текÑÑ‚') AS c5, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END utf8 utf8_general_ci utf8_unicode_ci + +SHOW CREATE PROCEDURE p2| +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +p2 CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`( +INOUT парам1 CHAR(10) CHARACTER SET utf8, +OUT парам2 CHAR(10) CHARACTER SET utf8) +BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION(_utf8 'текÑÑ‚') AS c5, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END utf8 utf8_general_ci utf8_unicode_ci + +SHOW CREATE PROCEDURE mysqltest2.p3| +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +p3 CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`( +INOUT парам1 CHAR(10), +OUT парам2 CHAR(10)) +BEGIN +DECLARE перем1 CHAR(10); +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION(_utf8 'текÑÑ‚') AS c5, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END utf8 utf8_general_ci utf8_unicode_ci + +SHOW CREATE PROCEDURE mysqltest2.p4| +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +p4 CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`( +INOUT парам1 CHAR(10) CHARACTER SET utf8, +OUT парам2 CHAR(10) CHARACTER SET utf8) +BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION(_utf8 'текÑÑ‚') AS c5, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END utf8 utf8_general_ci utf8_unicode_ci + + +SHOW PROCEDURE STATUS LIKE 'p1'| +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +mysqltest1 p1 PROCEDURE root@localhost MODIFIED CREATED DEFINER utf8 utf8_general_ci utf8_unicode_ci + +SHOW PROCEDURE STATUS LIKE 'p2'| +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +mysqltest1 p2 PROCEDURE root@localhost MODIFIED CREATED DEFINER utf8 utf8_general_ci utf8_unicode_ci + +SHOW PROCEDURE STATUS LIKE 'p3'| +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +mysqltest2 p3 PROCEDURE root@localhost MODIFIED CREATED DEFINER utf8 utf8_general_ci utf8_unicode_ci + +SHOW PROCEDURE STATUS LIKE 'p4'| +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +mysqltest2 p4 PROCEDURE root@localhost MODIFIED CREATED DEFINER utf8 utf8_general_ci utf8_unicode_ci + + +SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p1'| +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 CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +p1 NULL mysqltest1 p1 PROCEDURE NULL SQL BEGIN +DECLARE перем1 CHAR(10); +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION( 'текÑÑ‚') AS c5, +COLLATION( 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost utf8 utf8_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p2'| +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 CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +p2 NULL mysqltest1 p2 PROCEDURE NULL SQL BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION( 'текÑÑ‚') AS c5, +COLLATION( 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost utf8 utf8_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p3'| +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 CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +p3 NULL mysqltest2 p3 PROCEDURE NULL SQL BEGIN +DECLARE перем1 CHAR(10); +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION( 'текÑÑ‚') AS c5, +COLLATION( 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost utf8 utf8_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p4'| +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 CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +p4 NULL mysqltest2 p4 PROCEDURE NULL SQL BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION( 'текÑÑ‚') AS c5, +COLLATION( 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost utf8 utf8_general_ci utf8_unicode_ci + + +SET @a = '1'| +SET @b = '2'| + + +CALL p1(@a, @b)| +c1 c2 c3 +utf8_unicode_ci utf8_unicode_ci utf8_unicode_ci +c4 c5 c6 c7 c8 +utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8 +SELECT COLLATION(@a) AS ca, COLLATION(@b) cb| +ca cb +utf8_unicode_ci utf8_unicode_ci + +CALL p2(@a, @b)| +c1 c2 c3 +utf8_general_ci utf8_general_ci utf8_general_ci +c4 c5 c6 c7 c8 +utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8 +SELECT COLLATION(@a) AS ca, COLLATION(@b) cb| +ca cb +utf8_general_ci utf8_general_ci + +CALL mysqltest2.p3(@a, @b)| +c1 c2 c3 +utf8_unicode_ci utf8_unicode_ci utf8_unicode_ci +c4 c5 c6 c7 c8 +utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8 +SELECT COLLATION(@a) AS ca, COLLATION(@b) cb| +ca cb +utf8_unicode_ci utf8_unicode_ci + +CALL mysqltest2.p4(@a, @b)| +c1 c2 c3 +utf8_general_ci utf8_general_ci utf8_general_ci +c4 c5 c6 c7 c8 +utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8 +SELECT COLLATION(@a) AS ca, COLLATION(@b) cb| +ca cb +utf8_general_ci utf8_general_ci + + +ALTER DATABASE mysqltest1 COLLATE cp866_general_ci| +ALTER DATABASE mysqltest2 COLLATE cp866_general_ci| + +---> connection: con2 +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| +CALL p1(@a, @b)| +c1 c2 c3 +utf8_unicode_ci utf8_unicode_ci utf8_unicode_ci +c4 c5 c6 c7 c8 +utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8 +CALL p2(@a, @b)| +c1 c2 c3 +utf8_general_ci utf8_general_ci utf8_general_ci +c4 c5 c6 c7 c8 +utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8 +CALL mysqltest2.p3(@a, @b)| +c1 c2 c3 +utf8_unicode_ci utf8_unicode_ci utf8_unicode_ci +c4 c5 c6 c7 c8 +utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8 +CALL mysqltest2.p4(@a, @b)| +c1 c2 c3 +utf8_general_ci utf8_general_ci utf8_general_ci +c4 c5 c6 c7 c8 +utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8 +set names utf8| + + +SHOW CREATE PROCEDURE p1| +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`( +INOUT парам1 CHAR(10), +OUT парам2 CHAR(10)) +BEGIN +DECLARE перем1 CHAR(10); +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION(_utf8 'текÑÑ‚') AS c5, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END utf8 utf8_general_ci utf8_unicode_ci + +SHOW CREATE PROCEDURE p2| +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +p2 CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`( +INOUT парам1 CHAR(10) CHARACTER SET utf8, +OUT парам2 CHAR(10) CHARACTER SET utf8) +BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION(_utf8 'текÑÑ‚') AS c5, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END utf8 utf8_general_ci utf8_unicode_ci + +SHOW CREATE PROCEDURE mysqltest2.p3| +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +p3 CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`( +INOUT парам1 CHAR(10), +OUT парам2 CHAR(10)) +BEGIN +DECLARE перем1 CHAR(10); +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION(_utf8 'текÑÑ‚') AS c5, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END utf8 utf8_general_ci utf8_unicode_ci + +SHOW CREATE PROCEDURE mysqltest2.p4| +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +p4 CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`( +INOUT парам1 CHAR(10) CHARACTER SET utf8, +OUT парам2 CHAR(10) CHARACTER SET utf8) +BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION(_utf8 'текÑÑ‚') AS c5, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END utf8 utf8_general_ci utf8_unicode_ci + + +SHOW PROCEDURE STATUS LIKE 'p1'| +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +mysqltest1 p1 PROCEDURE root@localhost MODIFIED CREATED DEFINER utf8 utf8_general_ci utf8_unicode_ci + +SHOW PROCEDURE STATUS LIKE 'p2'| +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +mysqltest1 p2 PROCEDURE root@localhost MODIFIED CREATED DEFINER utf8 utf8_general_ci utf8_unicode_ci + +SHOW PROCEDURE STATUS LIKE 'p3'| +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +mysqltest2 p3 PROCEDURE root@localhost MODIFIED CREATED DEFINER utf8 utf8_general_ci utf8_unicode_ci + +SHOW PROCEDURE STATUS LIKE 'p4'| +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +mysqltest2 p4 PROCEDURE root@localhost MODIFIED CREATED DEFINER utf8 utf8_general_ci utf8_unicode_ci + + +SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p1'| +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 CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +p1 NULL mysqltest1 p1 PROCEDURE NULL SQL BEGIN +DECLARE перем1 CHAR(10); +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION( 'текÑÑ‚') AS c5, +COLLATION( 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost utf8 utf8_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p2'| +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 CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +p2 NULL mysqltest1 p2 PROCEDURE NULL SQL BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION( 'текÑÑ‚') AS c5, +COLLATION( 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost utf8 utf8_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p3'| +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 CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +p3 NULL mysqltest2 p3 PROCEDURE NULL SQL BEGIN +DECLARE перем1 CHAR(10); +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION( 'текÑÑ‚') AS c5, +COLLATION( 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost utf8 utf8_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p4'| +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 CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +p4 NULL mysqltest2 p4 PROCEDURE NULL SQL BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION( 'текÑÑ‚') AS c5, +COLLATION( 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost utf8 utf8_general_ci utf8_unicode_ci + + +SET @a = '1'| +SET @b = '2'| + + +CALL p1(@a, @b)| +c1 c2 c3 +utf8_unicode_ci utf8_unicode_ci utf8_unicode_ci +c4 c5 c6 c7 c8 +utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8 +SELECT COLLATION(@a) AS ca, COLLATION(@b) cb| +ca cb +utf8_unicode_ci utf8_unicode_ci + +CALL p2(@a, @b)| +c1 c2 c3 +utf8_general_ci utf8_general_ci utf8_general_ci +c4 c5 c6 c7 c8 +utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8 +SELECT COLLATION(@a) AS ca, COLLATION(@b) cb| +ca cb +utf8_general_ci utf8_general_ci + +CALL mysqltest2.p3(@a, @b)| +c1 c2 c3 +utf8_unicode_ci utf8_unicode_ci utf8_unicode_ci +c4 c5 c6 c7 c8 +utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8 +SELECT COLLATION(@a) AS ca, COLLATION(@b) cb| +ca cb +utf8_unicode_ci utf8_unicode_ci + +CALL mysqltest2.p4(@a, @b)| +c1 c2 c3 +utf8_general_ci utf8_general_ci utf8_general_ci +c4 c5 c6 c7 c8 +utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8 +SELECT COLLATION(@a) AS ca, COLLATION(@b) cb| +ca cb +utf8_general_ci utf8_general_ci + +---> Dump of mysqltest1 + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 */; + +USE `mysqltest1`; +ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p1`( +INOUT парам1 CHAR(10), +OUT парам2 CHAR(10)) +BEGIN +DECLARE перем1 CHAR(10); +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION(_utf8 'текÑÑ‚') AS c5, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +ALTER DATABASE mysqltest1 CHARACTER SET cp866 COLLATE cp866_general_ci ; +ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p2`( +INOUT парам1 CHAR(10) CHARACTER SET utf8, +OUT парам2 CHAR(10) CHARACTER SET utf8) +BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION(_utf8 'текÑÑ‚') AS c5, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +ALTER DATABASE mysqltest1 CHARACTER SET cp866 COLLATE cp866_general_ci ; + +---> Dumping mysqltest1 to ddl_i18n_utf8sp.mysqltest1.sql + +---> Dump of mysqltest2 + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 */; + +USE `mysqltest2`; +ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p3`( +INOUT парам1 CHAR(10), +OUT парам2 CHAR(10)) +BEGIN +DECLARE перем1 CHAR(10); +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION(_utf8 'текÑÑ‚') AS c5, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +ALTER DATABASE mysqltest2 CHARACTER SET cp866 COLLATE cp866_general_ci ; +ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `p4`( +INOUT парам1 CHAR(10) CHARACTER SET utf8, +OUT парам2 CHAR(10) CHARACTER SET utf8) +BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION(_utf8 'текÑÑ‚') AS c5, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +ALTER DATABASE mysqltest2 CHARACTER SET cp866 COLLATE cp866_general_ci ; + +---> Dumping mysqltest2 to ddl_i18n_utf8sp.mysqltest2.sql + + +DROP DATABASE mysqltest1| +DROP DATABASE mysqltest2| + + +---> Restoring mysqltest1... +---> Restoring mysqltest2... + +---> connection: con3 +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| +CALL p1(@a, @b)| +c1 c2 c3 +utf8_unicode_ci utf8_unicode_ci utf8_unicode_ci +c4 c5 c6 c7 c8 +utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8 +CALL p2(@a, @b)| +c1 c2 c3 +utf8_general_ci utf8_general_ci utf8_general_ci +c4 c5 c6 c7 c8 +utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8 +CALL mysqltest2.p3(@a, @b)| +c1 c2 c3 +utf8_unicode_ci utf8_unicode_ci utf8_unicode_ci +c4 c5 c6 c7 c8 +utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8 +CALL mysqltest2.p4(@a, @b)| +c1 c2 c3 +utf8_general_ci utf8_general_ci utf8_general_ci +c4 c5 c6 c7 c8 +utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8 +set names utf8| + + +SHOW CREATE PROCEDURE p1| +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`( +INOUT парам1 CHAR(10), +OUT парам2 CHAR(10)) +BEGIN +DECLARE перем1 CHAR(10); +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION(_utf8 'текÑÑ‚') AS c5, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END utf8 utf8_general_ci utf8_unicode_ci + +SHOW CREATE PROCEDURE p2| +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +p2 CREATE DEFINER=`root`@`localhost` PROCEDURE `p2`( +INOUT парам1 CHAR(10) CHARACTER SET utf8, +OUT парам2 CHAR(10) CHARACTER SET utf8) +BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION(_utf8 'текÑÑ‚') AS c5, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END utf8 utf8_general_ci utf8_unicode_ci + +SHOW CREATE PROCEDURE mysqltest2.p3| +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +p3 CREATE DEFINER=`root`@`localhost` PROCEDURE `p3`( +INOUT парам1 CHAR(10), +OUT парам2 CHAR(10)) +BEGIN +DECLARE перем1 CHAR(10); +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION(_utf8 'текÑÑ‚') AS c5, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END utf8 utf8_general_ci utf8_unicode_ci + +SHOW CREATE PROCEDURE mysqltest2.p4| +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +p4 CREATE DEFINER=`root`@`localhost` PROCEDURE `p4`( +INOUT парам1 CHAR(10) CHARACTER SET utf8, +OUT парам2 CHAR(10) CHARACTER SET utf8) +BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION(_utf8 'текÑÑ‚') AS c5, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END utf8 utf8_general_ci utf8_unicode_ci + + +SHOW PROCEDURE STATUS LIKE 'p1'| +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +mysqltest1 p1 PROCEDURE root@localhost MODIFIED CREATED DEFINER utf8 utf8_general_ci utf8_unicode_ci + +SHOW PROCEDURE STATUS LIKE 'p2'| +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +mysqltest1 p2 PROCEDURE root@localhost MODIFIED CREATED DEFINER utf8 utf8_general_ci utf8_unicode_ci + +SHOW PROCEDURE STATUS LIKE 'p3'| +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +mysqltest2 p3 PROCEDURE root@localhost MODIFIED CREATED DEFINER utf8 utf8_general_ci utf8_unicode_ci + +SHOW PROCEDURE STATUS LIKE 'p4'| +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +mysqltest2 p4 PROCEDURE root@localhost MODIFIED CREATED DEFINER utf8 utf8_general_ci utf8_unicode_ci + + +SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p1'| +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 CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +p1 NULL mysqltest1 p1 PROCEDURE NULL SQL BEGIN +DECLARE перем1 CHAR(10); +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION( 'текÑÑ‚') AS c5, +COLLATION( 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost utf8 utf8_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p2'| +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 CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +p2 NULL mysqltest1 p2 PROCEDURE NULL SQL BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION( 'текÑÑ‚') AS c5, +COLLATION( 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost utf8 utf8_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p3'| +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 CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +p3 NULL mysqltest2 p3 PROCEDURE NULL SQL BEGIN +DECLARE перем1 CHAR(10); +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION( 'текÑÑ‚') AS c5, +COLLATION( 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost utf8 utf8_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE routine_name = 'p4'| +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 CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +p4 NULL mysqltest2 p4 PROCEDURE NULL SQL BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION(парам1) AS c2, +COLLATION(парам2) AS c3; +SELECT +COLLATION('текÑÑ‚') AS c4, +COLLATION( 'текÑÑ‚') AS c5, +COLLATION( 'текÑÑ‚') AS c6, +@@collation_connection AS c7, +@@character_set_client AS c8; +SET парам1 = 'a'; +SET парам2 = 'b'; +END NULL NULL SQL NO CONTAINS SQL NULL DEFINER CREATED ALTERED root@localhost utf8 utf8_general_ci utf8_unicode_ci + + +SET @a = '1'| +SET @b = '2'| + + +CALL p1(@a, @b)| +c1 c2 c3 +utf8_unicode_ci utf8_unicode_ci utf8_unicode_ci +c4 c5 c6 c7 c8 +utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8 +SELECT COLLATION(@a) AS ca, COLLATION(@b) cb| +ca cb +utf8_unicode_ci utf8_unicode_ci + +CALL p2(@a, @b)| +c1 c2 c3 +utf8_general_ci utf8_general_ci utf8_general_ci +c4 c5 c6 c7 c8 +utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8 +SELECT COLLATION(@a) AS ca, COLLATION(@b) cb| +ca cb +utf8_general_ci utf8_general_ci + +CALL mysqltest2.p3(@a, @b)| +c1 c2 c3 +utf8_unicode_ci utf8_unicode_ci utf8_unicode_ci +c4 c5 c6 c7 c8 +utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8 +SELECT COLLATION(@a) AS ca, COLLATION(@b) cb| +ca cb +utf8_unicode_ci utf8_unicode_ci + +CALL mysqltest2.p4(@a, @b)| +c1 c2 c3 +utf8_general_ci utf8_general_ci utf8_general_ci +c4 c5 c6 c7 c8 +utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8 +SELECT COLLATION(@a) AS ca, COLLATION(@b) cb| +ca cb +utf8_general_ci utf8_general_ci + +---> connection: default +use test| +DROP DATABASE mysqltest1| +DROP DATABASE mysqltest2| + +------------------------------------------------------------------- +Triggers +------------------------------------------------------------------- + +DROP DATABASE IF EXISTS mysqltest1| +DROP DATABASE IF EXISTS mysqltest2| +CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| +CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| +use mysqltest1| +CREATE TABLE t1(c INT)| +CREATE TABLE mysqltest2.t1(c INT)| +CREATE TABLE log(msg VARCHAR(255))| +CREATE TABLE mysqltest2.log(msg VARCHAR(255))| + +CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +DECLARE перем1 CHAR(10); +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'текÑÑ‚'; +SET @a2 = _utf8 'текÑÑ‚'; +SET @a3 = _koi8r 'ÔÅËÓÔ'; +END| + +CREATE TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW +BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'текÑÑ‚'; +SET @b2 = _utf8 'текÑÑ‚'; +SET @b3 = _koi8r 'ÔÅËÓÔ'; +END| + +CREATE TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW +BEGIN +DECLARE перем1 CHAR(10); +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'текÑÑ‚'; +SET @a2 = _utf8 'текÑÑ‚'; +SET @a3 = _koi8r 'ÔÅËÓÔ'; +END| + +CREATE TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW +BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'текÑÑ‚'; +SET @b2 = _utf8 'текÑÑ‚'; +SET @b3 = _koi8r 'ÔÅËÓÔ'; +END| + + + +SHOW CREATE TRIGGER trg1| +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +trg1 CREATE DEFINER=`root`@`localhost` TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +DECLARE перем1 CHAR(10); +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'текÑÑ‚'; +SET @a2 = _utf8 'текÑÑ‚'; +SET @a3 = _koi8r 'ÔÅËÓÔ'; +END utf8 utf8_general_ci utf8_unicode_ci + +SHOW CREATE TRIGGER trg2| +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +trg2 CREATE DEFINER=`root`@`localhost` TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW +BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'текÑÑ‚'; +SET @b2 = _utf8 'текÑÑ‚'; +SET @b3 = _koi8r 'ÔÅËÓÔ'; +END utf8 utf8_general_ci utf8_unicode_ci + +SHOW CREATE TRIGGER mysqltest2.trg3| +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +trg3 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW +BEGIN +DECLARE перем1 CHAR(10); +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'текÑÑ‚'; +SET @a2 = _utf8 'текÑÑ‚'; +SET @a3 = _koi8r 'ÔÅËÓÔ'; +END utf8 utf8_general_ci utf8_unicode_ci + +SHOW CREATE TRIGGER mysqltest2.trg4| +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +trg4 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW +BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'текÑÑ‚'; +SET @b2 = _utf8 'текÑÑ‚'; +SET @b3 = _koi8r 'ÔÅËÓÔ'; +END utf8 utf8_general_ci utf8_unicode_ci + + +SHOW TRIGGERS| +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +trg1 INSERT t1 BEGIN +DECLARE перем1 CHAR(10); +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'текÑÑ‚'; +SET @a2 = 'текÑÑ‚'; +SET @a3 = 'текÑÑ‚'; +END BEFORE NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci +trg2 INSERT t1 BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'текÑÑ‚'; +SET @b2 = 'текÑÑ‚'; +SET @b3 = 'текÑÑ‚'; +END AFTER NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci + +use mysqltest2| + +SHOW TRIGGERS| +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +trg3 INSERT t1 BEGIN +DECLARE перем1 CHAR(10); +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'текÑÑ‚'; +SET @a2 = 'текÑÑ‚'; +SET @a3 = 'текÑÑ‚'; +END BEFORE NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci +trg4 INSERT t1 BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'текÑÑ‚'; +SET @b2 = 'текÑÑ‚'; +SET @b3 = 'текÑÑ‚'; +END AFTER NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci +use mysqltest1| + + +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg1'| +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest1 trg1 INSERT NULL mysqltest1 t1 0 NULL BEGIN +DECLARE перем1 CHAR(10); +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'текÑÑ‚'; +SET @a2 = 'текÑÑ‚'; +SET @a3 = 'текÑÑ‚'; +END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg2'| +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest1 trg2 INSERT NULL mysqltest1 t1 0 NULL BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'текÑÑ‚'; +SET @b2 = 'текÑÑ‚'; +SET @b3 = 'текÑÑ‚'; +END ROW AFTER NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg3'| +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest2 trg3 INSERT NULL mysqltest2 t1 0 NULL BEGIN +DECLARE перем1 CHAR(10); +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'текÑÑ‚'; +SET @a2 = 'текÑÑ‚'; +SET @a3 = 'текÑÑ‚'; +END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg4'| +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest2 trg4 INSERT NULL mysqltest2 t1 0 NULL BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'текÑÑ‚'; +SET @b2 = 'текÑÑ‚'; +SET @b3 = 'текÑÑ‚'; +END ROW AFTER NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci utf8_unicode_ci + + +SET @a1 = '1'| +SET @a2 = '1'| +SET @a3 = '1'| +SET @b1 = '2'| +SET @b2 = '2'| +SET @b3 = '2'| + + +INSERT INTO t1 VALUES(1)| + +---> Log: +SELECT msg FROM log| +msg +utf8_unicode_ci +utf8_general_ci +utf8_general_ci +koi8r_general_ci +utf8_general_ci +utf8 +utf8_general_ci +utf8_general_ci +utf8_general_ci +koi8r_general_ci +utf8_general_ci +utf8 + +SELECT +COLLATION(@a1) AS ca1, +COLLATION(@a2) AS ca2, +COLLATION(@a3) AS ca3, +COLLATION(@b1) AS cb1, +COLLATION(@b2) AS cb2, +COLLATION(@b3) AS cb3| +ca1 ca2 ca3 cb1 cb2 cb3 +utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8_general_ci koi8r_general_ci + +DELETE FROM log| + + +INSERT INTO mysqltest2.t1 VALUES(1)| + +---> Log: +SELECT msg FROM mysqltest2.log| +msg +utf8_unicode_ci +utf8_general_ci +utf8_general_ci +koi8r_general_ci +utf8_general_ci +utf8 +utf8_general_ci +utf8_general_ci +utf8_general_ci +koi8r_general_ci +utf8_general_ci +utf8 + +SELECT +COLLATION(@a1) AS ca1, +COLLATION(@a2) AS ca2, +COLLATION(@a3) AS ca3, +COLLATION(@b1) AS cb1, +COLLATION(@b2) AS cb2, +COLLATION(@b3) AS cb3| +ca1 ca2 ca3 cb1 cb2 cb3 +utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8_general_ci koi8r_general_ci + +DELETE FROM mysqltest2.log| + + +ALTER DATABASE mysqltest1 COLLATE cp866_general_ci| +ALTER DATABASE mysqltest2 COLLATE cp866_general_ci| +ALTER TABLE t1 ADD COLUMN fake INT| +ALTER TABLE t1 DROP COLUMN fake| +ALTER TABLE mysqltest2.t1 ADD COLUMN fake INT| +ALTER TABLE mysqltest2.t1 DROP COLUMN fake| + +---> connection: con2 +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| +INSERT INTO mysqltest1.t1 VALUES(0)| +INSERT INTO mysqltest2.t1 VALUES(0)| +DELETE FROM mysqltest1.log| +DELETE FROM mysqltest2.log| +set names utf8| +use mysqltest1| + + +SHOW CREATE TRIGGER trg1| +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +trg1 CREATE DEFINER=`root`@`localhost` TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +DECLARE перем1 CHAR(10); +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'текÑÑ‚'; +SET @a2 = _utf8 'текÑÑ‚'; +SET @a3 = _koi8r 'ÔÅËÓÔ'; +END utf8 utf8_general_ci utf8_unicode_ci + +SHOW CREATE TRIGGER trg2| +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +trg2 CREATE DEFINER=`root`@`localhost` TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW +BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'текÑÑ‚'; +SET @b2 = _utf8 'текÑÑ‚'; +SET @b3 = _koi8r 'ÔÅËÓÔ'; +END utf8 utf8_general_ci utf8_unicode_ci + +SHOW CREATE TRIGGER mysqltest2.trg3| +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +trg3 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW +BEGIN +DECLARE перем1 CHAR(10); +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'текÑÑ‚'; +SET @a2 = _utf8 'текÑÑ‚'; +SET @a3 = _koi8r 'ÔÅËÓÔ'; +END utf8 utf8_general_ci utf8_unicode_ci + +SHOW CREATE TRIGGER mysqltest2.trg4| +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +trg4 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW +BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'текÑÑ‚'; +SET @b2 = _utf8 'текÑÑ‚'; +SET @b3 = _koi8r 'ÔÅËÓÔ'; +END utf8 utf8_general_ci utf8_unicode_ci + + +SHOW TRIGGERS| +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +trg1 INSERT t1 BEGIN +DECLARE перем1 CHAR(10); +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'текÑÑ‚'; +SET @a2 = 'текÑÑ‚'; +SET @a3 = 'текÑÑ‚'; +END BEFORE NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci +trg2 INSERT t1 BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'текÑÑ‚'; +SET @b2 = 'текÑÑ‚'; +SET @b3 = 'текÑÑ‚'; +END AFTER NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci + +use mysqltest2| + +SHOW TRIGGERS| +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +trg3 INSERT t1 BEGIN +DECLARE перем1 CHAR(10); +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'текÑÑ‚'; +SET @a2 = 'текÑÑ‚'; +SET @a3 = 'текÑÑ‚'; +END BEFORE NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci +trg4 INSERT t1 BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'текÑÑ‚'; +SET @b2 = 'текÑÑ‚'; +SET @b3 = 'текÑÑ‚'; +END AFTER NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci +use mysqltest1| + + +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg1'| +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest1 trg1 INSERT NULL mysqltest1 t1 0 NULL BEGIN +DECLARE перем1 CHAR(10); +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'текÑÑ‚'; +SET @a2 = 'текÑÑ‚'; +SET @a3 = 'текÑÑ‚'; +END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg2'| +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest1 trg2 INSERT NULL mysqltest1 t1 0 NULL BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'текÑÑ‚'; +SET @b2 = 'текÑÑ‚'; +SET @b3 = 'текÑÑ‚'; +END ROW AFTER NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg3'| +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest2 trg3 INSERT NULL mysqltest2 t1 0 NULL BEGIN +DECLARE перем1 CHAR(10); +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'текÑÑ‚'; +SET @a2 = 'текÑÑ‚'; +SET @a3 = 'текÑÑ‚'; +END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg4'| +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest2 trg4 INSERT NULL mysqltest2 t1 0 NULL BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'текÑÑ‚'; +SET @b2 = 'текÑÑ‚'; +SET @b3 = 'текÑÑ‚'; +END ROW AFTER NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci utf8_unicode_ci + + +SET @a1 = '1'| +SET @a2 = '1'| +SET @a3 = '1'| +SET @b1 = '2'| +SET @b2 = '2'| +SET @b3 = '2'| + + +INSERT INTO t1 VALUES(1)| + +---> Log: +SELECT msg FROM log| +msg +utf8_unicode_ci +utf8_general_ci +utf8_general_ci +koi8r_general_ci +utf8_general_ci +utf8 +utf8_general_ci +utf8_general_ci +utf8_general_ci +koi8r_general_ci +utf8_general_ci +utf8 + +SELECT +COLLATION(@a1) AS ca1, +COLLATION(@a2) AS ca2, +COLLATION(@a3) AS ca3, +COLLATION(@b1) AS cb1, +COLLATION(@b2) AS cb2, +COLLATION(@b3) AS cb3| +ca1 ca2 ca3 cb1 cb2 cb3 +utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8_general_ci koi8r_general_ci + +DELETE FROM log| + + +INSERT INTO mysqltest2.t1 VALUES(1)| + +---> Log: +SELECT msg FROM mysqltest2.log| +msg +utf8_unicode_ci +utf8_general_ci +utf8_general_ci +koi8r_general_ci +utf8_general_ci +utf8 +utf8_general_ci +utf8_general_ci +utf8_general_ci +koi8r_general_ci +utf8_general_ci +utf8 + +SELECT +COLLATION(@a1) AS ca1, +COLLATION(@a2) AS ca2, +COLLATION(@a3) AS ca3, +COLLATION(@b1) AS cb1, +COLLATION(@b2) AS cb2, +COLLATION(@b3) AS cb3| +ca1 ca2 ca3 cb1 cb2 cb3 +utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8_general_ci koi8r_general_ci + +DELETE FROM mysqltest2.log| + +---> Dump of mysqltest1 + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 */; + +USE `mysqltest1`; +CREATE TABLE `log` ( + `msg` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +CREATE TABLE `t1` ( + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +INSERT INTO `t1` VALUES (1),(0),(1); +ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +DECLARE перем1 CHAR(10); +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'текÑÑ‚'; +SET @a2 = _utf8 'текÑÑ‚'; +SET @a3 = _koi8r 'ÔÅËÓÔ'; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +ALTER DATABASE mysqltest1 CHARACTER SET cp866 COLLATE cp866_general_ci ; +ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW +BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'текÑÑ‚'; +SET @b2 = _utf8 'текÑÑ‚'; +SET @b3 = _koi8r 'ÔÅËÓÔ'; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +ALTER DATABASE mysqltest1 CHARACTER SET cp866 COLLATE cp866_general_ci ; + +---> Dumping mysqltest1 to ddl_i18n_utf8triggers.mysqltest1.sql + +---> Dump of mysqltest2 + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 */; + +USE `mysqltest2`; +CREATE TABLE `log` ( + `msg` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +CREATE TABLE `t1` ( + `c` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +INSERT INTO `t1` VALUES (1),(0),(1); +ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW +BEGIN +DECLARE перем1 CHAR(10); +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'текÑÑ‚'; +SET @a2 = _utf8 'текÑÑ‚'; +SET @a3 = _koi8r 'ÔÅËÓÔ'; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +ALTER DATABASE mysqltest2 CHARACTER SET cp866 COLLATE cp866_general_ci ; +ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = utf8 */ ; +/*!50003 SET character_set_results = utf8 */ ; +/*!50003 SET collation_connection = utf8_general_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW +BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'текÑÑ‚'; +SET @b2 = _utf8 'текÑÑ‚'; +SET @b3 = _koi8r 'ÔÅËÓÔ'; +END */;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +ALTER DATABASE mysqltest2 CHARACTER SET cp866 COLLATE cp866_general_ci ; + +---> Dumping mysqltest2 to ddl_i18n_utf8triggers.mysqltest2.sql + + +DROP DATABASE mysqltest1| +DROP DATABASE mysqltest2| + + +---> Restoring mysqltest1... +---> Restoring mysqltest2... +ALTER TABLE mysqltest1.t1 ADD COLUMN fake INT| +ALTER TABLE mysqltest1.t1 DROP COLUMN fake| +ALTER TABLE mysqltest2.t1 ADD COLUMN fake INT| +ALTER TABLE mysqltest2.t1 DROP COLUMN fake| + +---> connection: con3 +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| +INSERT INTO mysqltest1.t1 VALUES(0)| +INSERT INTO mysqltest2.t1 VALUES(0)| +DELETE FROM mysqltest1.log| +DELETE FROM mysqltest2.log| +set names utf8| +use mysqltest1| + + +SHOW CREATE TRIGGER trg1| +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +trg1 CREATE DEFINER=`root`@`localhost` TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +DECLARE перем1 CHAR(10); +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'текÑÑ‚'; +SET @a2 = _utf8 'текÑÑ‚'; +SET @a3 = _koi8r 'ÔÅËÓÔ'; +END utf8 utf8_general_ci utf8_unicode_ci + +SHOW CREATE TRIGGER trg2| +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +trg2 CREATE DEFINER=`root`@`localhost` TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW +BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'текÑÑ‚'; +SET @b2 = _utf8 'текÑÑ‚'; +SET @b3 = _koi8r 'ÔÅËÓÔ'; +END utf8 utf8_general_ci utf8_unicode_ci + +SHOW CREATE TRIGGER mysqltest2.trg3| +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +trg3 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW +BEGIN +DECLARE перем1 CHAR(10); +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'текÑÑ‚'; +SET @a2 = _utf8 'текÑÑ‚'; +SET @a3 = _koi8r 'ÔÅËÓÔ'; +END utf8 utf8_general_ci utf8_unicode_ci + +SHOW CREATE TRIGGER mysqltest2.trg4| +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +trg4 CREATE DEFINER=`root`@`localhost` TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW +BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'текÑÑ‚'; +SET @b2 = _utf8 'текÑÑ‚'; +SET @b3 = _koi8r 'ÔÅËÓÔ'; +END utf8 utf8_general_ci utf8_unicode_ci + + +SHOW TRIGGERS| +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +trg1 INSERT t1 BEGIN +DECLARE перем1 CHAR(10); +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'текÑÑ‚'; +SET @a2 = 'текÑÑ‚'; +SET @a3 = 'текÑÑ‚'; +END BEFORE NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci +trg2 INSERT t1 BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'текÑÑ‚'; +SET @b2 = 'текÑÑ‚'; +SET @b3 = 'текÑÑ‚'; +END AFTER NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci + +use mysqltest2| + +SHOW TRIGGERS| +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +trg3 INSERT t1 BEGIN +DECLARE перем1 CHAR(10); +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'текÑÑ‚'; +SET @a2 = 'текÑÑ‚'; +SET @a3 = 'текÑÑ‚'; +END BEFORE NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci +trg4 INSERT t1 BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'текÑÑ‚'; +SET @b2 = 'текÑÑ‚'; +SET @b3 = 'текÑÑ‚'; +END AFTER NULL root@localhost utf8 utf8_general_ci utf8_unicode_ci +use mysqltest1| + + +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg1'| +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest1 trg1 INSERT NULL mysqltest1 t1 0 NULL BEGIN +DECLARE перем1 CHAR(10); +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'текÑÑ‚'; +SET @a2 = 'текÑÑ‚'; +SET @a3 = 'текÑÑ‚'; +END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg2'| +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest1 trg2 INSERT NULL mysqltest1 t1 0 NULL BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'текÑÑ‚'; +SET @b2 = 'текÑÑ‚'; +SET @b3 = 'текÑÑ‚'; +END ROW AFTER NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg3'| +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest2 trg3 INSERT NULL mysqltest2 t1 0 NULL BEGIN +DECLARE перем1 CHAR(10); +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @a1 = 'текÑÑ‚'; +SET @a2 = 'текÑÑ‚'; +SET @a3 = 'текÑÑ‚'; +END ROW BEFORE NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_name = 'trg4'| +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest2 trg4 INSERT NULL mysqltest2 t1 0 NULL BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +INSERT INTO log VALUES(COLLATION(перем1)); +INSERT INTO log VALUES(COLLATION('текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(COLLATION( 'текÑÑ‚')); +INSERT INTO log VALUES(@@collation_connection); +INSERT INTO log VALUES(@@character_set_client); +SET @b1 = 'текÑÑ‚'; +SET @b2 = 'текÑÑ‚'; +SET @b3 = 'текÑÑ‚'; +END ROW AFTER NULL NULL OLD NEW CREATED root@localhost utf8 utf8_general_ci utf8_unicode_ci + + +SET @a1 = '1'| +SET @a2 = '1'| +SET @a3 = '1'| +SET @b1 = '2'| +SET @b2 = '2'| +SET @b3 = '2'| + + +INSERT INTO t1 VALUES(1)| + +---> Log: +SELECT msg FROM log| +msg +utf8_unicode_ci +utf8_general_ci +utf8_general_ci +koi8r_general_ci +utf8_general_ci +utf8 +utf8_general_ci +utf8_general_ci +utf8_general_ci +koi8r_general_ci +utf8_general_ci +utf8 + +SELECT +COLLATION(@a1) AS ca1, +COLLATION(@a2) AS ca2, +COLLATION(@a3) AS ca3, +COLLATION(@b1) AS cb1, +COLLATION(@b2) AS cb2, +COLLATION(@b3) AS cb3| +ca1 ca2 ca3 cb1 cb2 cb3 +utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8_general_ci koi8r_general_ci + +DELETE FROM log| + + +INSERT INTO mysqltest2.t1 VALUES(1)| + +---> Log: +SELECT msg FROM mysqltest2.log| +msg +utf8_unicode_ci +utf8_general_ci +utf8_general_ci +koi8r_general_ci +utf8_general_ci +utf8 +utf8_general_ci +utf8_general_ci +utf8_general_ci +koi8r_general_ci +utf8_general_ci +utf8 + +SELECT +COLLATION(@a1) AS ca1, +COLLATION(@a2) AS ca2, +COLLATION(@a3) AS ca3, +COLLATION(@b1) AS cb1, +COLLATION(@b2) AS cb2, +COLLATION(@b3) AS cb3| +ca1 ca2 ca3 cb1 cb2 cb3 +utf8_general_ci utf8_general_ci koi8r_general_ci utf8_general_ci utf8_general_ci koi8r_general_ci + +DELETE FROM mysqltest2.log| + +---> connection: default +use test| +DROP DATABASE mysqltest1| +DROP DATABASE mysqltest2| + +------------------------------------------------------------------- +Events +------------------------------------------------------------------- + +DROP DATABASE IF EXISTS mysqltest1| +DROP DATABASE IF EXISTS mysqltest2| +CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| +CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| +use mysqltest1| + +CREATE EVENT ev1 ON SCHEDULE AT '2030-01-01 00:00:00' DO +BEGIN +DECLARE перем1 CHAR(10); +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION(_utf8 'текÑÑ‚') AS c3, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END| + +CREATE EVENT ev2 ON SCHEDULE AT '2030-01-01 00:00:00' DO +BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION(_utf8 'текÑÑ‚') AS c3, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END| + +CREATE EVENT mysqltest2.ev3 ON SCHEDULE AT '2030-01-01 00:00:00' DO +BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION(_utf8 'текÑÑ‚') AS c3, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END| + +CREATE EVENT mysqltest2.ev4 ON SCHEDULE AT '2030-01-01 00:00:00' DO +BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION(_utf8 'текÑÑ‚') AS c3, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +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 +DECLARE перем1 CHAR(10); +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION(_utf8 'текÑÑ‚') AS c3, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +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 +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION(_utf8 'текÑÑ‚') AS c3, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +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 +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION(_utf8 'текÑÑ‚') AS c3, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +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 +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION(_utf8 'текÑÑ‚') AS c3, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END utf8 utf8_general_ci utf8_unicode_ci + + +SHOW EVENTS LIKE 'ev1'| +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +mysqltest1 ev1 root@localhost SYSTEM ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED 1 utf8 utf8_general_ci utf8_unicode_ci + +SHOW EVENTS LIKE 'ev2'| +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +mysqltest1 ev2 root@localhost SYSTEM ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED 1 utf8 utf8_general_ci utf8_unicode_ci + +SHOW EVENTS LIKE 'ev3'| +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation + +SHOW EVENTS LIKE 'ev4'| +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation + + +SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev1'| +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest1 ev1 root@localhost SYSTEM SQL BEGIN +DECLARE перем1 CHAR(10); +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION( 'текÑÑ‚') AS c3, +COLLATION( 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev2'| +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest1 ev2 root@localhost SYSTEM SQL BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION( 'текÑÑ‚') AS c3, +COLLATION( 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev3'| +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest2 ev3 root@localhost SYSTEM SQL BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION( 'текÑÑ‚') AS c3, +COLLATION( 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev4'| +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest2 ev4 root@localhost SYSTEM SQL BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION( 'текÑÑ‚') AS c3, +COLLATION( 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci + + +ALTER DATABASE mysqltest1 COLLATE cp866_general_ci| +ALTER DATABASE mysqltest2 COLLATE cp866_general_ci| + +---> connection: con2 +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| +SHOW CREATE EVENT ev1| +SHOW CREATE EVENT ev2| +SHOW CREATE EVENT mysqltest2.ev3| +SHOW CREATE EVENT mysqltest2.ev4| +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 +DECLARE перем1 CHAR(10); +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION(_utf8 'текÑÑ‚') AS c3, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +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 +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION(_utf8 'текÑÑ‚') AS c3, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +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 +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION(_utf8 'текÑÑ‚') AS c3, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +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 +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION(_utf8 'текÑÑ‚') AS c3, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END utf8 utf8_general_ci utf8_unicode_ci + + +SHOW EVENTS LIKE 'ev1'| +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +mysqltest1 ev1 root@localhost SYSTEM ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED 1 utf8 utf8_general_ci utf8_unicode_ci + +SHOW EVENTS LIKE 'ev2'| +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +mysqltest1 ev2 root@localhost SYSTEM ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED 1 utf8 utf8_general_ci utf8_unicode_ci + +SHOW EVENTS LIKE 'ev3'| +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation + +SHOW EVENTS LIKE 'ev4'| +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation + + +SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev1'| +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest1 ev1 root@localhost SYSTEM SQL BEGIN +DECLARE перем1 CHAR(10); +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION( 'текÑÑ‚') AS c3, +COLLATION( 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev2'| +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest1 ev2 root@localhost SYSTEM SQL BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION( 'текÑÑ‚') AS c3, +COLLATION( 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev3'| +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest2 ev3 root@localhost SYSTEM SQL BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION( 'текÑÑ‚') AS c3, +COLLATION( 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev4'| +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest2 ev4 root@localhost SYSTEM SQL BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION( 'текÑÑ‚') AS c3, +COLLATION( 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci + +---> Dump of mysqltest1 + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 */; + +USE `mysqltest1`; +/*!50106 SET @save_time_zone= @@TIME_ZONE */ ; +DELIMITER ;; +ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;; +/*!50003 SET @saved_cs_client = @@character_set_client */ ;; +/*!50003 SET @saved_cs_results = @@character_set_results */ ;; +/*!50003 SET @saved_col_connection = @@collation_connection */ ;; +/*!50003 SET character_set_client = utf8 */ ;; +/*!50003 SET character_set_results = utf8 */ ;; +/*!50003 SET collation_connection = utf8_general_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!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 +DECLARE перем1 CHAR(10); +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION(_utf8 'текÑÑ‚') AS c3, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END */ ;; +/*!50003 SET time_zone = @saved_time_zone */ ;; +/*!50003 SET sql_mode = @saved_sql_mode */ ;; +/*!50003 SET character_set_client = @saved_cs_client */ ;; +/*!50003 SET character_set_results = @saved_cs_results */ ;; +/*!50003 SET collation_connection = @saved_col_connection */ ;; +ALTER DATABASE mysqltest1 CHARACTER SET cp866 COLLATE cp866_general_ci ;; +DELIMITER ;; +ALTER DATABASE mysqltest1 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;; +/*!50003 SET @saved_cs_client = @@character_set_client */ ;; +/*!50003 SET @saved_cs_results = @@character_set_results */ ;; +/*!50003 SET @saved_col_connection = @@collation_connection */ ;; +/*!50003 SET character_set_client = utf8 */ ;; +/*!50003 SET character_set_results = utf8 */ ;; +/*!50003 SET collation_connection = utf8_general_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!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 +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION(_utf8 'текÑÑ‚') AS c3, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END */ ;; +/*!50003 SET time_zone = @saved_time_zone */ ;; +/*!50003 SET sql_mode = @saved_sql_mode */ ;; +/*!50003 SET character_set_client = @saved_cs_client */ ;; +/*!50003 SET character_set_results = @saved_cs_results */ ;; +/*!50003 SET collation_connection = @saved_col_connection */ ;; +ALTER DATABASE mysqltest1 CHARACTER SET cp866 COLLATE cp866_general_ci ;; +DELIMITER ; +/*!50106 SET TIME_ZONE= @save_time_zone */ ; + +---> Dumping mysqltest1 to ddl_i18n_utf8events.mysqltest1.sql + +---> Dump of mysqltest2 + +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 */; + +USE `mysqltest2`; +/*!50106 SET @save_time_zone= @@TIME_ZONE */ ; +DELIMITER ;; +ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;; +/*!50003 SET @saved_cs_client = @@character_set_client */ ;; +/*!50003 SET @saved_cs_results = @@character_set_results */ ;; +/*!50003 SET @saved_col_connection = @@collation_connection */ ;; +/*!50003 SET character_set_client = utf8 */ ;; +/*!50003 SET character_set_results = utf8 */ ;; +/*!50003 SET collation_connection = utf8_general_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!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 +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION(_utf8 'текÑÑ‚') AS c3, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END */ ;; +/*!50003 SET time_zone = @saved_time_zone */ ;; +/*!50003 SET sql_mode = @saved_sql_mode */ ;; +/*!50003 SET character_set_client = @saved_cs_client */ ;; +/*!50003 SET character_set_results = @saved_cs_results */ ;; +/*!50003 SET collation_connection = @saved_col_connection */ ;; +ALTER DATABASE mysqltest2 CHARACTER SET cp866 COLLATE cp866_general_ci ;; +DELIMITER ;; +ALTER DATABASE mysqltest2 CHARACTER SET utf8 COLLATE utf8_unicode_ci ;; +/*!50003 SET @saved_cs_client = @@character_set_client */ ;; +/*!50003 SET @saved_cs_results = @@character_set_results */ ;; +/*!50003 SET @saved_col_connection = @@collation_connection */ ;; +/*!50003 SET character_set_client = utf8 */ ;; +/*!50003 SET character_set_results = utf8 */ ;; +/*!50003 SET collation_connection = utf8_general_ci */ ;; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ;; +/*!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 +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION(_utf8 'текÑÑ‚') AS c3, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END */ ;; +/*!50003 SET time_zone = @saved_time_zone */ ;; +/*!50003 SET sql_mode = @saved_sql_mode */ ;; +/*!50003 SET character_set_client = @saved_cs_client */ ;; +/*!50003 SET character_set_results = @saved_cs_results */ ;; +/*!50003 SET collation_connection = @saved_col_connection */ ;; +ALTER DATABASE mysqltest2 CHARACTER SET cp866 COLLATE cp866_general_ci ;; +DELIMITER ; +/*!50106 SET TIME_ZONE= @save_time_zone */ ; + +---> Dumping mysqltest2 to ddl_i18n_utf8events.mysqltest2.sql + + +DROP DATABASE mysqltest1| +DROP DATABASE mysqltest2| + + +---> Restoring mysqltest1... +---> Restoring mysqltest2... + +---> connection: con3 +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| +SHOW CREATE EVENT ev1| +SHOW CREATE EVENT ev2| +SHOW CREATE EVENT mysqltest2.ev3| +SHOW CREATE EVENT mysqltest2.ev4| +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 +DECLARE перем1 CHAR(10); +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION(_utf8 'текÑÑ‚') AS c3, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +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 +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION(_utf8 'текÑÑ‚') AS c3, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +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 +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION(_utf8 'текÑÑ‚') AS c3, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +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 +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION(_utf8 'текÑÑ‚') AS c3, +COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END utf8 utf8_general_ci utf8_unicode_ci + + +SHOW EVENTS LIKE 'ev1'| +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +mysqltest1 ev1 root@localhost SYSTEM ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED 1 utf8 utf8_general_ci utf8_unicode_ci + +SHOW EVENTS LIKE 'ev2'| +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +mysqltest1 ev2 root@localhost SYSTEM ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED 1 utf8 utf8_general_ci utf8_unicode_ci + +SHOW EVENTS LIKE 'ev3'| +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation + +SHOW EVENTS LIKE 'ev4'| +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation + + +SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev1'| +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest1 ev1 root@localhost SYSTEM SQL BEGIN +DECLARE перем1 CHAR(10); +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION( 'текÑÑ‚') AS c3, +COLLATION( 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev2'| +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest1 ev2 root@localhost SYSTEM SQL BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION( 'текÑÑ‚') AS c3, +COLLATION( 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev3'| +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest2 ev3 root@localhost SYSTEM SQL BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION( 'текÑÑ‚') AS c3, +COLLATION( 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci + +SELECT * FROM INFORMATION_SCHEMA.EVENTS WHERE event_name = 'ev4'| +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest2 ev4 root@localhost SYSTEM SQL BEGIN +DECLARE перем1 CHAR(10) CHARACTER SET utf8; +SELECT +COLLATION(перем1) AS c1, +COLLATION('текÑÑ‚') AS c2, +COLLATION( 'текÑÑ‚') AS c3, +COLLATION( 'текÑÑ‚') AS c4, +@@collation_connection AS c5, +@@character_set_client AS c6; +END ONE TIME 2030-01-01 00:00:00 NULL NULL NULL NULL ENABLED NOT PRESERVE CREATED LAST_ALTERED NULL 1 utf8 utf8_general_ci utf8_unicode_ci + +------------------------------------------------------------------- +DDL statements within stored routine. +------------------------------------------------------------------- + +DROP DATABASE IF EXISTS mysqltest1| +DROP DATABASE IF EXISTS mysqltest2| +CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| +CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| +use mysqltest1| + +CREATE PROCEDURE p1() +BEGIN +CREATE TABLE t1(col1 VARCHAR(10)); +SHOW CREATE TABLE t1; +END| + +CREATE PROCEDURE mysqltest2.p2() +BEGIN +CREATE TABLE t2(col1 VARCHAR(10)); +SHOW CREATE TABLE t2; +END| + +CALL p1()| +Table Create Table +t1 CREATE TABLE `t1` ( + `col1` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci + +SHOW CREATE TABLE t1| +Table Create Table +t1 CREATE TABLE `t1` ( + `col1` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci + + +CALL mysqltest2.p2()| +Table Create Table +t2 CREATE TABLE `t2` ( + `col1` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci + +SHOW CREATE TABLE mysqltest2.t2| +Table Create Table +t2 CREATE TABLE `t2` ( + `col1` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci + +ALTER DATABASE mysqltest1 COLLATE cp1251_general_cs| +ALTER DATABASE mysqltest2 COLLATE cp1251_general_cs| +DROP TABLE t1| +DROP TABLE mysqltest2.t2| + +CALL p1()| +Table Create Table +t1 CREATE TABLE `t1` ( + `col1` varchar(10) COLLATE cp1251_general_cs DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs + +SHOW CREATE TABLE t1| +Table Create Table +t1 CREATE TABLE `t1` ( + `col1` varchar(10) COLLATE cp1251_general_cs DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs + + +CALL mysqltest2.p2()| +Table Create Table +t2 CREATE TABLE `t2` ( + `col1` varchar(10) COLLATE cp1251_general_cs DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs + +SHOW CREATE TABLE mysqltest2.t2| +Table Create Table +t2 CREATE TABLE `t2` ( + `col1` varchar(10) COLLATE cp1251_general_cs DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_general_cs + +---> connection: default +use test| +DROP DATABASE mysqltest1| +DROP DATABASE mysqltest2| diff --git a/mysql-test/r/errors.result b/mysql-test/r/errors.result index 94debb1785f..022a32d9c9b 100644 --- a/mysql-test/r/errors.result +++ b/mysql-test/r/errors.result @@ -41,3 +41,17 @@ SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0))); a 1 DROP TABLE t1; +CREATE TABLE t1( a INT ); +SELECT b FROM t1; +ERROR 42S22: Unknown column 'b' in 'field list' +SHOW ERRORS; +Level Code Message +Error 1054 Unknown column 'b' in 'field list' +CREATE TABLE t2 SELECT b FROM t1; +ERROR 42S22: Unknown column 'b' in 'field list' +SHOW ERRORS; +Level Code Message +Error 1054 Unknown column 'b' in 'field list' +INSERT INTO t1 SELECT b FROM t1; +ERROR 42S22: Unknown column 'b' in 'field list' +DROP TABLE t1; diff --git a/mysql-test/r/events.result b/mysql-test/r/events.result index 0b1cd67f559..579f5907882 100644 --- a/mysql-test/r/events.result +++ b/mysql-test/r/events.result @@ -122,82 +122,105 @@ drop table t_event3; 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 -root6 SYSTEM CREATE EVENT `root6` ON SCHEDULE EVERY '10:20' MINUTE_SECOND STARTS '#' ON COMPLETION PRESERVE ENABLE COMMENT 'some comment' DO select 1 +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 create event root7 on schedule every 2 year do select 1; SHOW CREATE EVENT root7; -Event sql_mode time_zone Create Event -root7 SYSTEM CREATE EVENT `root7` ON SCHEDULE EVERY 2 YEAR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 +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 create event root8 on schedule every '2:5' year_month do select 1; SHOW CREATE EVENT root8; -Event sql_mode time_zone Create Event -root8 SYSTEM CREATE EVENT `root8` ON SCHEDULE EVERY '2-5' YEAR_MONTH STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 +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 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 -root8_1 SYSTEM CREATE EVENT `root8_1` ON SCHEDULE EVERY '3-3' YEAR_MONTH STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 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 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 -root9 SYSTEM CREATE EVENT `root9` ON SCHEDULE EVERY 2 WEEK STARTS '#' ON COMPLETION PRESERVE DISABLE COMMENT 'коментар на кирилица' DO select 1 +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 create event root10 on schedule every '20:5' day_hour do select 1; SHOW CREATE EVENT root10; -Event sql_mode time_zone Create Event -root10 SYSTEM CREATE EVENT `root10` ON SCHEDULE EVERY '20 5' DAY_HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 +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 create event root11 on schedule every '20:25' day_hour do select 1; SHOW CREATE EVENT root11; -Event sql_mode time_zone Create Event -root11 SYSTEM CREATE EVENT `root11` ON SCHEDULE EVERY '21 1' DAY_HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 +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 create event root12 on schedule every '20:25' hour_minute do select 1; SHOW CREATE EVENT root12; -Event sql_mode time_zone Create Event -root12 SYSTEM CREATE EVENT `root12` ON SCHEDULE EVERY '20:25' HOUR_MINUTE STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 +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 create event root13 on schedule every '25:25' hour_minute do select 1; SHOW CREATE EVENT root13; -Event sql_mode time_zone Create Event -root13 SYSTEM CREATE EVENT `root13` ON SCHEDULE EVERY '25:25' HOUR_MINUTE STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 +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 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 -root13_1 SYSTEM CREATE EVENT `root13_1` ON SCHEDULE EVERY '12:5' HOUR_MINUTE STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 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 create event root14 on schedule every '35:35' minute_second do select 1; SHOW CREATE EVENT root14; -Event sql_mode time_zone Create Event -root14 SYSTEM CREATE EVENT `root14` ON SCHEDULE EVERY '35:35' MINUTE_SECOND STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 +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 create event root15 on schedule every '35:66' minute_second do select 1; SHOW CREATE EVENT root15; -Event sql_mode time_zone Create Event -root15 SYSTEM CREATE EVENT `root15` ON SCHEDULE EVERY '36:6' MINUTE_SECOND STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 +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 create event root16 on schedule every '35:56' day_minute do select 1; SHOW CREATE EVENT root16; -Event sql_mode time_zone Create Event -root16 SYSTEM CREATE EVENT `root16` ON SCHEDULE EVERY '1 11:56' DAY_MINUTE STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 +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 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 -root17 SYSTEM CREATE EVENT `root17` ON SCHEDULE EVERY '35 12:45' DAY_MINUTE STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 +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 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 -root17_1 SYSTEM CREATE EVENT `root17_1` ON SCHEDULE EVERY '36 2:5' DAY_MINUTE STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 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 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 -root18 SYSTEM CREATE EVENT `root18` ON SCHEDULE EVERY '35:12:45' HOUR_SECOND STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 +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 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 -root19 SYSTEM CREATE EVENT `root19` ON SCHEDULE EVERY '16:0:25' HOUR_SECOND STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 +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 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 -root20 SYSTEM CREATE EVENT `root20` ON SCHEDULE EVERY '50 20:12:45' DAY_SECOND STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 +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 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 -ðóóò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 -insert into mysql.event (db, name, body, definer, interval_value, interval_field, originator) values (database(), "root22", "select 1", user(), 100, "SECOND_MICROSECOND", 1); +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 +insert into mysql.event ( +db, +name, +body, +definer, +interval_value, +interval_field, +originator, +character_set_client, +collation_connection, +db_collation, +body_utf8) +values ( +database(), +"root22", +"select 1", +user(), +100, +"SECOND_MICROSECOND", +1, +'utf8', +'utf8_general_ci', +'utf8_general_ci', +'select 1'); show create event root22; ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND' SHOW EVENTS; @@ -231,8 +254,8 @@ Create a test event. Only event metadata is relevant, the actual schedule and body are not. CREATE EVENT intact_check ON SCHEDULE EVERY 10 HOUR DO SELECT "nothing"; SHOW EVENTS; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator -events_test intact_check root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +events_test intact_check root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci Try to alter mysql.event: the server should fail to load event information after mysql.event was tampered with. @@ -241,14 +264,14 @@ works as before ALTER TABLE mysql.event ADD dummy INT; SHOW EVENTS; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator -events_test intact_check root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +events_test intact_check root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci SELECT event_name FROM INFORMATION_SCHEMA.events; event_name intact_check SHOW CREATE EVENT intact_check; -Event sql_mode time_zone Create Event -intact_check SYSTEM CREATE EVENT `intact_check` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO SELECT "nothing" +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 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; @@ -330,7 +353,7 @@ ERROR HY000: Cannot load from mysql.event. The table is probably corrupted 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; -ERROR HY000: Column count of mysql.event is wrong. Expected 18, found 16. The table is probably corrupted +ERROR HY000: Column count of mysql.event is wrong. Expected 22, found 20. The table is probably corrupted ALTER EVENT intact_check_1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8; ERROR HY000: Unknown event 'intact_check_1' ALTER EVENT intact_check_1 RENAME TO intact_check_2; @@ -400,7 +423,7 @@ Restore the original table. CREATE TABLE mysql.event like event_like; DROP TABLE event_like; SHOW EVENTS; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation create event e_26 on schedule at '2017-01-01 00:00:00' disable do set @a = 5; select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event; db name body definer convert_tz(execute_at, 'UTC', 'SYSTEM') on_completion @@ -512,7 +535,7 @@ ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa SHOW EVENTS FROM ``; ERROR 42000: Incorrect database name '' SHOW EVENTS FROM `events\\test`; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation LOCK TABLES mode. @@ -520,8 +543,8 @@ create table t1 (a int); 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 -e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 +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 select event_name from information_schema.events; event_name e1 @@ -538,8 +561,8 @@ ERROR HY000: Table 'event' was not locked with LOCK TABLES unlock tables; lock table t1 write; show create event e1; -Event sql_mode time_zone Create Event -e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 +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 select event_name from information_schema.events; event_name e1 @@ -556,8 +579,8 @@ ERROR HY000: Table 'event' was not locked with LOCK TABLES unlock tables; lock table t1 read, mysql.event read; show create event e1; -Event sql_mode time_zone Create Event -e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 +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 select event_name from information_schema.events; event_name e1 @@ -574,8 +597,8 @@ ERROR HY000: Table 'event' was locked with a READ lock and can't be updated unlock tables; lock table t1 write, mysql.event read; show create event e1; -Event sql_mode time_zone Create Event -e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 +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 select event_name from information_schema.events; event_name e1 @@ -596,8 +619,8 @@ lock table t1 write, mysql.event write; ERROR HY000: You can't combine write-locking of system tables with other tables or lock types lock table mysql.event write; show create event e1; -Event sql_mode time_zone Create Event -e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 +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 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 fae530f556b..a01f098affb 100644 --- a/mysql-test/r/events_bugs.result +++ b/mysql-test/r/events_bugs.result @@ -33,7 +33,7 @@ create event e_55 on schedule at 20000101000000 do drop table t; Warnings: Note 1584 Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. Event has not been created show events; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation create event e_55 on schedule at 20200101000000 starts 10000101000000 do drop table t; 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 'starts 10000101000000 do drop table t' at line 1 create event e_55 on schedule at 20200101000000 ends 10000101000000 do drop table t; @@ -389,30 +389,30 @@ SET TIME_ZONE= '+00:00'; SET TIMESTAMP= UNIX_TIMESTAMP('2005-12-31 23:58:59'); CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1; SHOW EVENTS; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator -events_test e1 root@localhost +00:00 RECURRING NULL 1 DAY 2005-12-31 23:58:59 NULL ENABLED 1 +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +events_test e1 root@localhost +00:00 RECURRING NULL 1 DAY 2005-12-31 23:58:59 NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci SET TIME_ZONE= '-01:00'; ALTER EVENT e1 ON SCHEDULE EVERY 1 DAY STARTS '2000-01-01 00:00:00'; SHOW EVENTS; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator -events_test e1 root@localhost -01:00 RECURRING NULL 1 DAY 2000-01-01 00:00:00 NULL ENABLED 1 +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +events_test e1 root@localhost -01:00 RECURRING NULL 1 DAY 2000-01-01 00:00:00 NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci SET TIME_ZONE= '+02:00'; ALTER EVENT e1 ON SCHEDULE AT '2000-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE; SHOW EVENTS; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator -events_test e1 root@localhost +02:00 ONE TIME 2000-01-02 00:00:00 NULL NULL NULL NULL DISABLED 1 +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +events_test e1 root@localhost +02:00 ONE TIME 2000-01-02 00:00:00 NULL NULL NULL NULL DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci SET TIME_ZONE= '-03:00'; ALTER EVENT e1 ON SCHEDULE EVERY 1 DAY ENDS '2030-01-03 00:00:00' ON COMPLETION PRESERVE DISABLE; SHOW EVENTS; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator -events_test e1 root@localhost -03:00 RECURRING NULL 1 DAY 2005-12-31 20:58:59 2030-01-03 00:00:00 DISABLED 1 +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +events_test e1 root@localhost -03:00 RECURRING NULL 1 DAY 2005-12-31 20:58:59 2030-01-03 00:00:00 DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci SET TIME_ZONE= '+04:00'; ALTER EVENT e1 DO SELECT 2; SHOW EVENTS; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator -events_test e1 root@localhost -03:00 RECURRING NULL 1 DAY 2005-12-31 20:58:59 2030-01-03 00:00:00 ENABLED 1 +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +events_test e1 root@localhost -03:00 RECURRING NULL 1 DAY 2005-12-31 20:58:59 2030-01-03 00:00:00 ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci DROP EVENT e1; SET TIME_ZONE='+05:00'; CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' DO @@ -426,24 +426,24 @@ SET TIME_ZONE='+00:00'; CREATE EVENT e3 ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' DO SELECT 1; SELECT * FROM INFORMATION_SCHEMA.EVENTS ORDER BY event_name; -EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR -NULL events_test e1 root@localhost +05:00 SQL SELECT 1 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED NOT PRESERVE 2005-12-31 23:58:59 2005-12-31 23:58:59 NULL 1 -NULL events_test e2 root@localhost -05:00 SQL SELECT 1 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED NOT PRESERVE 2005-12-31 23:59:00 2005-12-31 23:59:00 NULL 1 -NULL events_test e3 root@localhost +00:00 SQL SELECT 1 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED NOT PRESERVE 2005-12-31 23:59:01 2005-12-31 23:59:01 NULL 1 +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL events_test e1 root@localhost +05:00 SQL SELECT 1 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED NOT PRESERVE 2005-12-31 23:58:59 2005-12-31 23:58:59 NULL 1 latin1 latin1_swedish_ci latin1_swedish_ci +NULL events_test e2 root@localhost -05:00 SQL SELECT 1 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED NOT PRESERVE 2005-12-31 23:59:00 2005-12-31 23:59:00 NULL 1 latin1 latin1_swedish_ci latin1_swedish_ci +NULL events_test e3 root@localhost +00:00 SQL SELECT 1 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED NOT PRESERVE 2005-12-31 23:59:01 2005-12-31 23:59:01 NULL 1 latin1 latin1_swedish_ci latin1_swedish_ci SHOW EVENTS; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator -events_test e1 root@localhost +05:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED 1 -events_test e2 root@localhost -05:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED 1 -events_test e3 root@localhost +00:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED 1 +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +events_test e1 root@localhost +05:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +events_test e2 root@localhost -05:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +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 -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 +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 SHOW CREATE EVENT e2; -Event sql_mode time_zone Create Event -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 +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 SHOW CREATE EVENT e3; -Event sql_mode time_zone Create Event -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 +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 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'; @@ -474,10 +474,10 @@ SELECT 1; Warnings: Note 1584 Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. Event has not been created SHOW EVENTS; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator -events_test e1 root@localhost +05:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED 1 -events_test e2 root@localhost -05:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED 1 -events_test e3 root@localhost +00:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED 1 +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +events_test e1 root@localhost +05:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +events_test e2 root@localhost -05:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +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 The following should succeed giving a warning. ALTER EVENT e1 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00' ENDS '1999-01-02 00:00:00' ON COMPLETION PRESERVE; @@ -510,15 +510,15 @@ CREATE EVENT e8 ON SCHEDULE AT '1999-01-01 00:00:00' DO SELECT 1; SHOW EVENTS; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator -events_test e1 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 1999-01-02 00:00:00 DISABLED 1 -events_test e2 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 NULL ENABLED 1 -events_test e3 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 1999-01-02 00:00:00 DISABLED 1 -events_test e4 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 1999-01-02 00:00:00 DISABLED 1 -events_test e5 root@localhost +00:00 ONE TIME 1999-01-01 00:00:00 NULL NULL NULL NULL DISABLED 1 -events_test e6 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 NULL ENABLED 1 -events_test e7 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 1999-01-02 00:00:00 DISABLED 1 -events_test e8 root@localhost +00:00 ONE TIME 1999-01-01 00:00:00 NULL NULL NULL NULL DISABLED 1 +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +events_test e1 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 1999-01-02 00:00:00 DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +events_test e2 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +events_test e3 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 1999-01-02 00:00:00 DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +events_test e4 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 1999-01-02 00:00:00 DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +events_test e5 root@localhost +00:00 ONE TIME 1999-01-01 00:00:00 NULL NULL NULL NULL DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +events_test e6 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +events_test e7 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 1999-01-02 00:00:00 DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +events_test e8 root@localhost +00:00 ONE TIME 1999-01-01 00:00:00 NULL NULL NULL NULL DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci DROP EVENT e8; DROP EVENT e7; DROP EVENT e6; @@ -557,4 +557,57 @@ CREATE EVENT new_event ON SCHEDULE AT NOW() ENDS NOW() DO SELECT 1; 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 'ENDS NOW() DO SELECT 1' at line 1 CREATE EVENT new_event ON SCHEDULE AT NOW() STARTS NOW() ENDS NOW() DO SELECT 1; 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 'STARTS NOW() ENDS NOW() DO SELECT 1' at line 1 +USE test; +SHOW GRANTS FOR CURRENT_USER; +Grants for root@localhost +GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION +SET GLOBAL event_scheduler = ON; +CREATE TABLE event_log (id int KEY AUTO_INCREMENT, +ev_nm char(40), ev_cnt int, +ev_tm timestamp) ENGINE=MyISAM; +SET @ev_base_date = 20281224180000; +SET autocommit=0; +CREATE USER evtest1@localhost; +SET PASSWORD FOR evtest1@localhost = password('ev1'); +REVOKE ALL PRIVILEGES, GRANT OPTION FROM evtest1@localhost; +GRANT create, insert, select, event ON events_test.* TO evtest1@localhost; +GRANT select,insert ON test.* TO evtest1@localhost; +SHOW GRANTS FOR evtest1@localhost; +Grants for evtest1@localhost +GRANT USAGE ON *.* TO 'evtest1'@'localhost' IDENTIFIED BY PASSWORD '*3170F3644E31580C25DE4A08F4C07CC9A2D40C32' +GRANT SELECT, INSERT ON `test`.* TO 'evtest1'@'localhost' +GRANT SELECT, INSERT, CREATE, EVENT ON `events_test`.* TO 'evtest1'@'localhost' +connection e1; +USE events_test; +CREATE EVENT ev_sched_1823 ON SCHEDULE EVERY 2 SECOND +DO BEGIN +SET AUTOCOMMIT = 0; +SET @evname = 'ev_sched_1823'; +SET @cnt = 0; +SELECT COUNT(*) INTO @cnt FROM test.event_log WHERE ev_nm = @evname; +IF @cnt < 6 THEN +INSERT INTO test.event_log VALUES (NULL,@evname,@cnt+1,current_timestamp()); +COMMIT; +END IF; +SELECT COUNT(*) INTO @cnt FROM test.event_log WHERE ev_nm = @evname; +IF @cnt < 6 THEN +INSERT INTO test.event_log VALUES (NULL,@evname,@cnt+1,current_timestamp()); +ROLLBACK; +END IF; +END;| +connection default; +DROP EVENT ev_sched_1823; +DROP USER evtest1@localhost; +USE test; +===================================================================================== +select id,ev_nm,ev_cnt from event_log order by id; +id ev_nm ev_cnt +1 ev_sched_1823 1 +2 ev_sched_1823 2 +3 ev_sched_1823 3 +4 ev_sched_1823 4 +5 ev_sched_1823 5 +6 ev_sched_1823 6 +DROP TABLE event_log; +SET GLOBAL event_scheduler = OFF; DROP DATABASE events_test; diff --git a/mysql-test/r/events_grant.result b/mysql-test/r/events_grant.result index 278cc5956f5..1aadf7e11f4 100644 --- a/mysql-test/r/events_grant.result +++ b/mysql-test/r/events_grant.result @@ -2,8 +2,8 @@ CREATE DATABASE IF NOT EXISTS events_test; use events_test; CREATE EVENT one_event ON SCHEDULE EVERY 10 SECOND DO SELECT 123; SHOW EVENTS; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator -events_test one_event root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +events_test one_event root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME; EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT NULL events_test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE @@ -29,8 +29,8 @@ ERROR 42000: Access denied for user 'ev_test'@'localhost' to database 'events_te USE events_test; "We should see one event"; SHOW EVENTS; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator -events_test one_event root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +events_test one_event root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci SELECT CONCAT("Let's create some new events from the name of ", USER()); CONCAT("Let's create some new events from the name of ", USER()) Let's create some new events from the name of ev_test@localhost @@ -40,18 +40,18 @@ CREATE EVENT two_event ON SCHEDULE EVERY 20 SECOND ON COMPLETION NOT PRESERVE CO CREATE EVENT three_event ON SCHEDULE EVERY 20 SECOND ON COMPLETION PRESERVE COMMENT "three event" DO SELECT 123; "Now we should see 3 events:"; SHOW EVENTS; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator -events_test one_event root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 -events_test three_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED 1 -events_test two_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED 1 +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +events_test one_event root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +events_test three_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +events_test two_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci "This should show us only 2 events:"; SHOW EVENTS LIKE 't%event'; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator -events_test three_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED 1 -events_test two_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED 1 +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +events_test three_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +events_test two_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci "This should show us no events:"; SHOW EVENTS FROM test LIKE '%'; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation GRANT EVENT ON events_test2.* TO ev_test@localhost; USE events_test2; CREATE EVENT four_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42; diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result index 54b29353fb8..4f64d39ccc0 100644 --- a/mysql-test/r/func_in.result +++ b/mysql-test/r/func_in.result @@ -225,8 +225,8 @@ a 46 CREATE VIEW v1 AS SELECT * FROM t1 WHERE a NOT IN (45); SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` <> 45) +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` <> 45) latin1 latin1_swedish_ci SELECT * FROM v1; a 44 diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index 4896210c19d..1529fe77ac4 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -745,10 +745,10 @@ drop table t1; drop procedure if exists fn3; create function fn3 () returns point deterministic return GeomFromText("point(1 1)"); show create function fn3; -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation fn3 CREATE DEFINER=`root`@`localhost` FUNCTION `fn3`() RETURNS point DETERMINISTIC -return GeomFromText("point(1 1)") +return GeomFromText("point(1 1)") latin1 latin1_swedish_ci latin1_swedish_ci select astext(fn3()); astext(fn3()) POINT(1 1) diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index a68cee5e52e..0d4dad39882 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -907,11 +907,11 @@ ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for tabl SHOW CREATE TABLE mysqltest2.v_yn; ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table 'v_yn' SHOW CREATE TABLE mysqltest2.v_ny; -View Create View -v_ny CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_ny` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` +View Create View character_set_client collation_connection +v_ny CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_ny` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` latin1 latin1_swedish_ci SHOW CREATE VIEW mysqltest2.v_ny; -View Create View -v_ny CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_ny` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` +View Create View character_set_client collation_connection +v_ny CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_ny` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` latin1 latin1_swedish_ci SHOW CREATE TABLE mysqltest3.t_nn; ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't_nn' SHOW CREATE VIEW mysqltest3.t_nn; @@ -928,17 +928,17 @@ t_nn CREATE TABLE `t_nn` ( SHOW CREATE VIEW mysqltest2.t_nn; ERROR HY000: 'mysqltest2.t_nn' is not VIEW SHOW CREATE VIEW mysqltest2.v_yy; -View Create View -v_yy CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_yy` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` where (`mysqltest2`.`t_nn`.`c1` = 55) +View Create View character_set_client collation_connection +v_yy CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_yy` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` where (`mysqltest2`.`t_nn`.`c1` = 55) latin1 latin1_swedish_ci SHOW CREATE TABLE mysqltest2.v_yy; -View Create View -v_yy CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_yy` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` where (`mysqltest2`.`t_nn`.`c1` = 55) +View Create View character_set_client collation_connection +v_yy CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_yy` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn` where (`mysqltest2`.`t_nn`.`c1` = 55) latin1 latin1_swedish_ci SHOW CREATE TABLE mysqltest2.v_nn; -View Create View -v_nn CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v_nn` AS select `t_nn`.`c1` AS `c1` from `t_nn` +View Create View character_set_client collation_connection +v_nn CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v_nn` AS select `t_nn`.`c1` AS `c1` from `t_nn` latin1 latin1_swedish_ci SHOW CREATE VIEW mysqltest2.v_nn; -View Create View -v_nn CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v_nn` AS select `t_nn`.`c1` AS `c1` from `t_nn` +View Create View character_set_client collation_connection +v_nn CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v_nn` AS select `t_nn`.`c1` AS `c1` from `t_nn` latin1 latin1_swedish_ci SHOW CREATE TABLE mysqltest2.t_nn; Table Create Table t_nn CREATE TABLE `t_nn` ( diff --git a/mysql-test/r/have_cp1251.require b/mysql-test/r/have_cp1251.require new file mode 100644 index 00000000000..465e8338084 --- /dev/null +++ b/mysql-test/r/have_cp1251.require @@ -0,0 +1,2 @@ +Collation Charset Id Default Compiled Sortlen +cp1251_general_ci cp1251 51 Yes 0 diff --git a/mysql-test/r/have_cp866.require b/mysql-test/r/have_cp866.require new file mode 100644 index 00000000000..da2a3e2f05e --- /dev/null +++ b/mysql-test/r/have_cp866.require @@ -0,0 +1,2 @@ +Collation Charset Id Default Compiled Sortlen +cp866_general_ci cp866 36 Yes 0 diff --git a/mysql-test/r/have_koi8r.require b/mysql-test/r/have_koi8r.require new file mode 100644 index 00000000000..b109b9ae520 --- /dev/null +++ b/mysql-test/r/have_koi8r.require @@ -0,0 +1,2 @@ +Collation Charset Id Default Compiled Sortlen +koi8r_general_ci koi8r 7 Yes 0 diff --git a/mysql-test/r/have_utf8.require b/mysql-test/r/have_utf8.require new file mode 100644 index 00000000000..71f8ccfff47 --- /dev/null +++ b/mysql-test/r/have_utf8.require @@ -0,0 +1,2 @@ +Collation Charset Id Default Compiled Sortlen +utf8_general_ci utf8 33 Yes Yes 1 diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index fc111430a4e..e290457d4ee 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -274,11 +274,11 @@ parameter_style sql_data_access dtd_identifier SQL CONTAINS SQL NULL SQL CONTAINS SQL int(11) show procedure status; -Db Name Type Definer Modified Created Security_type Comment -test sel2 PROCEDURE root@localhost # # DEFINER +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +test sel2 PROCEDURE root@localhost # # DEFINER latin1 latin1_swedish_ci latin1_swedish_ci show function status; -Db Name Type Definer Modified Created Security_type Comment -test sub1 FUNCTION root@localhost # # DEFINER +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +test sub1 FUNCTION root@localhost # # DEFINER latin1 latin1_swedish_ci latin1_swedish_ci select a.ROUTINE_NAME from information_schema.ROUTINES a, information_schema.SCHEMATA b where a.ROUTINE_SCHEMA = b.SCHEMA_NAME; @@ -327,26 +327,26 @@ sel2 NULL sub1 NULL sub2 return i+1 show create procedure sel2; -Procedure sql_mode Create Procedure -sel2 NULL +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +sel2 NULL latin1 latin1_swedish_ci latin1_swedish_ci show create function sub1; -Function sql_mode Create Function -sub1 NULL +Function sql_mode Create Function character_set_client collation_connection Database Collation +sub1 NULL latin1 latin1_swedish_ci latin1_swedish_ci show create function sub2; -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation sub2 CREATE DEFINER=`mysqltest_1`@`localhost` FUNCTION `sub2`(i int) RETURNS int(11) -return i+1 +return i+1 latin1 latin1_swedish_ci latin1_swedish_ci show function status like "sub2"; -Db Name Type Definer Modified Created Security_type Comment -test sub2 FUNCTION mysqltest_1@localhost # # DEFINER +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +test sub2 FUNCTION mysqltest_1@localhost # # DEFINER latin1 latin1_swedish_ci latin1_swedish_ci drop function sub2; show create procedure sel2; -Procedure sql_mode Create Procedure +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation sel2 CREATE DEFINER=`root`@`localhost` PROCEDURE `sel2`() begin select * from t1; select * from t2; -end +end latin1 latin1_swedish_ci latin1_swedish_ci create view v0 (c) as select schema_name from information_schema.schemata; select * from v0; c @@ -386,12 +386,12 @@ latin1_spanish_ci show keys from v4; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment select * from information_schema.views where TABLE_NAME like "v%"; -TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE -NULL test v0 /* ALGORITHM=UNDEFINED */ select `schemata`.`SCHEMA_NAME` AS `c` from `information_schema`.`schemata` NONE NO root@localhost DEFINER -NULL test v1 /* ALGORITHM=UNDEFINED */ select `tables`.`TABLE_NAME` AS `c` from `information_schema`.`tables` where (`tables`.`TABLE_NAME` = _utf8'v1') NONE NO root@localhost DEFINER -NULL test v2 /* ALGORITHM=UNDEFINED */ select `columns`.`COLUMN_NAME` AS `c` from `information_schema`.`columns` where (`columns`.`TABLE_NAME` = _utf8'v2') NONE NO root@localhost DEFINER -NULL test v3 /* ALGORITHM=UNDEFINED */ select `character_sets`.`CHARACTER_SET_NAME` AS `c` from `information_schema`.`character_sets` where (`character_sets`.`CHARACTER_SET_NAME` like _utf8'latin1%') NONE NO root@localhost DEFINER -NULL test v4 /* ALGORITHM=UNDEFINED */ select `collations`.`COLLATION_NAME` AS `c` from `information_schema`.`collations` where (`collations`.`COLLATION_NAME` like _utf8'latin1%') NONE NO root@localhost DEFINER +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION +NULL test v0 select schema_name from information_schema.schemata NONE NO root@localhost DEFINER latin1 latin1_swedish_ci +NULL test v1 select table_name from information_schema.tables NONE NO root@localhost DEFINER latin1 latin1_swedish_ci +NULL test v2 select column_name from information_schema.columns NONE NO root@localhost DEFINER latin1 latin1_swedish_ci +NULL test v3 select CHARACTER_SET_NAME from information_schema.character_sets NONE NO root@localhost DEFINER latin1 latin1_swedish_ci +NULL test v4 select COLLATION_NAME from information_schema.collations NONE NO root@localhost DEFINER latin1 latin1_swedish_ci drop view v0, v1, v2, v3, v4; create table t1 (a int); grant select,update,insert on t1 to mysqltest_1@localhost; @@ -483,10 +483,10 @@ create view v1 (c) as select a from t1 with check option; create view v2 (c) as select a from t1 WITH LOCAL CHECK OPTION; create view v3 (c) as select a from t1 WITH CASCADED CHECK OPTION; select * from information_schema.views; -TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE -NULL test v1 /* ALGORITHM=UNDEFINED */ select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES root@localhost DEFINER -NULL test v2 /* ALGORITHM=UNDEFINED */ select `test`.`t1`.`a` AS `c` from `test`.`t1` LOCAL YES root@localhost DEFINER -NULL test v3 /* ALGORITHM=UNDEFINED */ select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES root@localhost DEFINER +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION +NULL test v1 select a from t1 with check option CASCADED YES root@localhost DEFINER latin1 latin1_swedish_ci +NULL test v2 select a from t1 WITH LOCAL CHECK OPTION LOCAL YES root@localhost DEFINER latin1 latin1_swedish_ci +NULL test v3 select a from t1 WITH CASCADED CHECK OPTION CASCADED YES root@localhost DEFINER latin1 latin1_swedish_ci grant select (a) on test.t1 to joe@localhost with grant option; select * from INFORMATION_SCHEMA.COLUMN_PRIVILEGES; GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE @@ -586,6 +586,10 @@ 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') proc comment char(64) +proc character_set_client char(32) +proc collation_connection char(32) +proc db_collation char(32) +proc body_utf8 longblob drop table t115; create procedure p108 () begin declare c cursor for select data_type from information_schema.columns; open c; open c; end;// @@ -700,13 +704,13 @@ select constraint_name from information_schema.table_constraints where table_schema='test'; constraint_name show create view v2; -View Create View -v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `test`.`t1`.`f1` AS `c` from `t1` +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `test`.`t1`.`f1` AS `c` from `t1` latin1 latin1_swedish_ci Warnings: Warning 1356 View 'test.v2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them show create table v3; -View Create View -v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `sub1`(1) AS `c` +View Create View character_set_client collation_connection +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `sub1`(1) AS `c` latin1 latin1_swedish_ci Warnings: Warning 1356 View 'test.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them drop view v2; @@ -872,39 +876,39 @@ set @fired:= "Yes"; end if; end| show triggers; -Trigger Event Table Statement Timing Created sql_mode Definer +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation trg1 INSERT t1 begin if new.j > 10 then set new.j := 10; end if; -end BEFORE NULL root@localhost +end BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci trg2 UPDATE t1 begin if old.i % 2 = 0 then set new.j := -1; end if; -end BEFORE NULL root@localhost +end BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci trg3 UPDATE t1 begin if new.j = -1 then set @fired:= "Yes"; end if; -end AFTER NULL root@localhost +end AFTER NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci select * from information_schema.triggers; -TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION NULL test trg1 INSERT NULL test t1 0 NULL begin if new.j > 10 then set new.j := 10; end if; -end ROW BEFORE NULL NULL OLD NEW NULL root@localhost +end ROW BEFORE NULL NULL OLD NEW NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci NULL test trg2 UPDATE NULL test t1 0 NULL begin if old.i % 2 = 0 then set new.j := -1; end if; -end ROW BEFORE NULL NULL OLD NEW NULL root@localhost +end ROW BEFORE NULL NULL OLD NEW NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci NULL test trg3 UPDATE NULL test t1 0 NULL begin if new.j = -1 then set @fired:= "Yes"; end if; -end ROW AFTER NULL NULL OLD NEW NULL root@localhost +end ROW AFTER NULL NULL OLD NEW NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci drop trigger trg1; drop trigger trg2; drop trigger trg3; @@ -1156,7 +1160,7 @@ drop table t1; use mysql; INSERT INTO `proc` VALUES ('test','','PROCEDURE','','SQL','CONTAINS_SQL', 'NO','DEFINER','','','BEGIN\r\n \r\nEND','root@%','2006-03-02 18:40:03', -'2006-03-02 18:40:03','',''); +'2006-03-02 18:40:03','','','utf8','utf8_general_ci','utf8_general_ci','n/a'); select routine_name from information_schema.routines; routine_name @@ -1169,9 +1173,9 @@ create definer = mysqltest_1@localhost sql security definer view v2 as select 1; select * from information_schema.views where table_name='v1' or table_name='v2'; -TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE -NULL test v1 NONE YES root@localhost DEFINER -NULL test v2 /* ALGORITHM=UNDEFINED */ select 1 AS `1` NONE NO mysqltest_1@localhost DEFINER +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION +NULL test v1 NONE YES root@localhost DEFINER latin1 latin1_swedish_ci +NULL test v2 select 1 NONE NO mysqltest_1@localhost DEFINER latin1 latin1_swedish_ci drop view v1, v2; drop table t1; drop user mysqltest_1@localhost; @@ -1196,23 +1200,23 @@ ROUTINE_NAME ROUTINE_DEFINITION f1 RETURN @a + 1 p1 SET @a= 1 SHOW CREATE PROCEDURE p1; -Procedure sql_mode Create Procedure +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() -SET @a= 1 +SET @a= 1 latin1 latin1_swedish_ci latin1_swedish_ci SHOW CREATE FUNCTION f1; -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) -RETURN @a + 1 +RETURN @a + 1 latin1 latin1_swedish_ci latin1_swedish_ci SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES; ROUTINE_NAME ROUTINE_DEFINITION f1 NULL p1 NULL SHOW CREATE PROCEDURE p1; -Procedure sql_mode Create Procedure -p1 NULL +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +p1 NULL latin1 latin1_swedish_ci latin1_swedish_ci SHOW CREATE FUNCTION f1; -Function sql_mode Create Function -f1 NULL +Function sql_mode Create Function character_set_client collation_connection Database Collation +f1 NULL latin1 latin1_swedish_ci latin1_swedish_ci CALL p1(); SELECT f1(); f1() diff --git a/mysql-test/r/information_schema_db.result b/mysql-test/r/information_schema_db.result index 94ebc213122..a0fd33ac068 100644 --- a/mysql-test/r/information_schema_db.result +++ b/mysql-test/r/information_schema_db.result @@ -132,11 +132,11 @@ show fields from testdb_1.v6; Field Type Null Key Default Extra f1 char(4) YES NULL show create view testdb_1.v6; -View Create View -v6 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v6` AS select `t1`.`f1` AS `f1` from `t1` +View Create View character_set_client collation_connection +v6 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v6` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci show create view testdb_1.v7; -View Create View -v7 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such_user`@`no_such_host` SQL SECURITY DEFINER VIEW `v7` AS select `testdb_1`.`t2`.`f1` AS `f1` from `t2` +View Create View character_set_client collation_connection +v7 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such_user`@`no_such_host` SQL SECURITY DEFINER VIEW `v7` AS select `testdb_1`.`t2`.`f1` AS `f1` from `t2` latin1 latin1_swedish_ci Warnings: Warning 1356 View 'testdb_1.v7' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them show fields from testdb_1.v7; @@ -153,22 +153,22 @@ show fields from testdb_1.v5; Field Type Null Key Default Extra f1 char(4) YES NULL show create view testdb_1.v5; -View Create View -v5 CREATE ALGORITHM=UNDEFINED DEFINER=`testdb_1`@`localhost` SQL SECURITY DEFINER VIEW `testdb_1`.`v5` AS select `testdb_1`.`t1`.`f1` AS `f1` from `testdb_1`.`t1` +View Create View character_set_client collation_connection +v5 CREATE ALGORITHM=UNDEFINED DEFINER=`testdb_1`@`localhost` SQL SECURITY DEFINER VIEW `testdb_1`.`v5` AS select `testdb_1`.`t1`.`f1` AS `f1` from `testdb_1`.`t1` latin1 latin1_swedish_ci show fields from testdb_1.v6; Field Type Null Key Default Extra f1 char(4) YES NULL show create view testdb_1.v6; -View Create View -v6 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `testdb_1`.`v6` AS select `testdb_1`.`t1`.`f1` AS `f1` from `testdb_1`.`t1` +View Create View character_set_client collation_connection +v6 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `testdb_1`.`v6` AS select `testdb_1`.`t1`.`f1` AS `f1` from `testdb_1`.`t1` latin1 latin1_swedish_ci show fields from testdb_1.v7; Field Type Null Key Default Extra f1 null YES NULL Warnings: Note 1449 There is no 'no_such_user'@'no_such_host' registered show create view testdb_1.v7; -View Create View -v7 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such_user`@`no_such_host` SQL SECURITY DEFINER VIEW `v7` AS select `testdb_1`.`t2`.`f1` AS `f1` from `t2` +View Create View character_set_client collation_connection +v7 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such_user`@`no_such_host` SQL SECURITY DEFINER VIEW `v7` AS select `testdb_1`.`t2`.`f1` AS `f1` from `t2` latin1 latin1_swedish_ci Warnings: Warning 1356 View 'testdb_1.v7' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them revoke insert(f1) on v3 from testdb_2@localhost; @@ -200,8 +200,8 @@ show fields from testdb_1.v1; Field Type Null Key Default Extra f1 char(4) YES NULL show create view v2; -View Create View -v2 CREATE ALGORITHM=UNDEFINED DEFINER=`testdb_2`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v2` AS select `v1`.`f1` AS `f1` from `testdb_1`.`v1` +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`testdb_2`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v2` AS select `v1`.`f1` AS `f1` from `testdb_1`.`v1` latin1 latin1_swedish_ci show create view testdb_1.v1; ERROR 42000: SHOW VIEW command denied to user 'testdb_2'@'localhost' for table 'v1' select table_name from information_schema.columns a @@ -211,7 +211,7 @@ v2 select view_definition from information_schema.views a where a.table_name = 'v2'; view_definition -/* ALGORITHM=UNDEFINED */ select `v1`.`f1` AS `f1` from `testdb_1`.`v1` +select f1 from testdb_1.v1 select view_definition from information_schema.views a where a.table_name = 'testdb_1.v1'; view_definition diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 85ff561d1c4..ad79a2a837a 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -1100,24 +1100,24 @@ insert into t1 values (1,1),(2,2); insert into t2 values (1,1),(4,4); reset master; UPDATE t2,t1 SET t2.a=t1.a+2; -ERROR 23000: Duplicate entry '3' for key 1 +ERROR 23000: Duplicate entry '3' for key 'PRIMARY' select * from t2 /* must be (3,1), (4,4) */; a b 1 1 4 4 show master status /* there must no UPDATE in binlog */; File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 98 +master-bin.000001 106 delete from t1; delete from t2; insert into t1 values (1,2),(3,4),(4,4); insert into t2 values (1,2),(3,4),(4,4); reset master; UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a; -ERROR 23000: Duplicate entry '4' for key 1 +ERROR 23000: Duplicate entry '4' for key 'PRIMARY' show master status /* there must be no UPDATE query event */; File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 98 +master-bin.000001 106 drop table t1, t2; create table t1 (a int, b int) engine=innodb; insert into t1 values(20,null); diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result index afecf30b94f..a88d199838b 100644 --- a/mysql-test/r/innodb_mysql.result +++ b/mysql-test/r/innodb_mysql.result @@ -665,6 +665,29 @@ UPDATE t3 SET a = 'us' WHERE a = 'uk'; SELECT * FROM t3 WHERE a = 'uk'; a DROP TABLE t1,t2,t3; +create table t1 (a int) engine=innodb; +select * from t2; +ERROR 42S02: Table 'test.t2' doesn't exist +drop table t1; +drop table t2; +ERROR 42S02: Unknown table 't2' +create table t2 (a int); +drop table t2; +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +CREATE TABLE t2 (a INT) ENGINE=InnoDB; +switch to connection c1 +SET AUTOCOMMIT=0; +INSERT INTO t2 VALUES (1); +switch to connection c2 +SET AUTOCOMMIT=0; +LOCK TABLES t1 READ, t2 READ; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +switch to connection c1 +COMMIT; +INSERT INTO t1 VALUES (1); +switch to connection default +SET AUTOCOMMIT=default; +DROP TABLE t1,t2; End of 5.0 tests CREATE TABLE t1 (a int, b int); insert into t1 values (1,1),(1,2); diff --git a/mysql-test/r/lowercase_view.result b/mysql-test/r/lowercase_view.result index f09725dafcb..3653461c6b8 100644 --- a/mysql-test/r/lowercase_view.result +++ b/mysql-test/r/lowercase_view.result @@ -6,8 +6,8 @@ use MySQLTest; create table TaB (Field int); create view ViE as select * from TAb; show create table VIe; -View Create View -vie CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vie` AS select `tab`.`Field` AS `Field` from `tab` +View Create View character_set_client collation_connection +vie CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vie` AS select `tab`.`Field` AS `Field` from `tab` latin1 latin1_swedish_ci drop database MySQLTest; use test; create table t1Aa (col1 int); @@ -118,8 +118,8 @@ drop table t1Aa,t2Aa; create table t1Aa (col1 int); create view v1Aa as select col1 from t1Aa as AaA; show create view v1AA; -View Create View -v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `aaa`.`col1` AS `col1` from `t1aa` `AaA` +View Create View character_set_client collation_connection +v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `aaa`.`col1` AS `col1` from `t1aa` `AaA` latin1 latin1_swedish_ci drop view v1AA; select Aaa.col1 from t1Aa as AaA; col1 @@ -127,7 +127,7 @@ create view v1Aa as select Aaa.col1 from t1Aa as AaA; drop view v1AA; create view v1Aa as select AaA.col1 from t1Aa as AaA; show create view v1AA; -View Create View -v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `aaa`.`col1` AS `col1` from `t1aa` `AaA` +View Create View character_set_client collation_connection +v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `aaa`.`col1` AS `col1` from `t1aa` `AaA` latin1 latin1_swedish_ci drop view v1AA; drop table t1Aa; diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index b6a0e506eda..007ed57f651 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -1892,10 +1892,19 @@ DROP TABLE IF EXISTS `v2`; ) */; /*!50001 DROP TABLE IF EXISTS `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ /*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like _latin1'a%') */ /*!50002 WITH CASCADED CHECK OPTION */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -1974,9 +1983,18 @@ DROP TABLE IF EXISTS `v1`; ) */; /*!50001 DROP TABLE IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ /*!50001 VIEW `v1` AS select `t1`.`a` AS `a` from `t1` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -2033,10 +2051,19 @@ DROP TABLE IF EXISTS `v2`; ) */; /*!50001 DROP TABLE IF EXISTS `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ /*!50001 VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like _latin1'a%') */ /*!50002 WITH CASCADED CHECK OPTION */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -2143,19 +2170,46 @@ DROP TABLE IF EXISTS `v3`; ) */; /*!50001 DROP TABLE IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ /*!50001 VIEW `v1` AS select `v3`.`a` AS `a`,`v3`.`b` AS `b`,`v3`.`c` AS `c` from `v3` where (`v3`.`b` in (1,2,3,4,5,6,7)) */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; /*!50001 DROP TABLE IF EXISTS `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ /*!50001 VIEW `v2` AS select `v3`.`a` AS `a` from (`v3` join `v1`) where ((`v1`.`a` = `v3`.`a`) and (`v3`.`b` = 3)) limit 1 */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; /*!50001 DROP TABLE IF EXISTS `v3`*/; /*!50001 DROP VIEW IF EXISTS `v3`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ /*!50001 VIEW `v3` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b`,`t1`.`c` AS `c` from `t1` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -2198,21 +2252,21 @@ end if; end| set sql_mode=default| show triggers like "t1"; -Trigger Event Table Statement Timing Created sql_mode Definer +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation trg1 INSERT t1 begin if new.a > 10 then set new.a := 10; set new.a := 11; end if; -end BEFORE 0000-00-00 00:00:00 root@localhost +end BEFORE 0000-00-00 00:00:00 root@localhost latin1 latin1_swedish_ci latin1_swedish_ci trg2 UPDATE t1 begin if old.a % 2 = 0 then set new.b := 12; end if; -end BEFORE 0000-00-00 00:00:00 root@localhost +end BEFORE 0000-00-00 00:00:00 root@localhost latin1 latin1_swedish_ci latin1_swedish_ci 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 +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 INSERT INTO t1 (a) VALUES (1),(2),(3),(22); update t1 set a = 4 where a=3; @@ -2241,30 +2295,64 @@ LOCK TABLES `t1` WRITE; INSERT INTO `t1` VALUES (1,NULL),(2,NULL),(4,NULL),(11,NULL); /*!40000 ALTER TABLE `t1` ENABLE KEYS */; UNLOCK TABLES; - +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; DELIMITER ;; -/*!50003 SET SESSION SQL_MODE="" */;; -/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg1` BEFORE INSERT ON `t1` FOR EACH ROW begin +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 trigger trg1 before insert on t1 for each row +begin if new.a > 10 then set new.a := 10; set new.a := 11; end if; end */;; - -/*!50003 SET SESSION SQL_MODE="" */;; -/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg2` BEFORE UPDATE ON `t1` FOR EACH ROW begin +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 trigger trg2 before update on t1 for each row begin if old.a % 2 = 0 then set new.b := 12; end if; end */;; - -/*!50003 SET SESSION 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 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg3` AFTER UPDATE ON `t1` FOR EACH ROW begin +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!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' */ ; +DELIMITER ;; +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 trigger trg3 after update on t1 for each row +begin if new.a = -1 then set @fired:= "Yes"; end if; end */;; - DELIMITER ; -/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; DROP TABLE IF EXISTS `t2`; CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL @@ -2274,17 +2362,26 @@ LOCK TABLES `t2` WRITE; /*!40000 ALTER TABLE `t2` DISABLE KEYS */; /*!40000 ALTER TABLE `t2` ENABLE KEYS */; UNLOCK TABLES; - +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!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' */ ; DELIMITER ;; -/*!50003 SET SESSION 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 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `trg4` BEFORE INSERT ON `t2` FOR EACH ROW begin +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 trigger trg4 before insert on t2 for each row +begin if new.a > 10 then set @fired:= "No"; end if; end */;; - DELIMITER ; -/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -2346,26 +2443,26 @@ Tables_in_test t1 t2 show triggers; -Trigger Event Table Statement Timing Created sql_mode Definer +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation trg1 INSERT t1 begin if new.a > 10 then set new.a := 10; set new.a := 11; end if; -end BEFORE # root@localhost +end BEFORE # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci trg2 UPDATE t1 begin if old.a % 2 = 0 then set new.b := 12; end if; -end BEFORE # root@localhost +end BEFORE # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci 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 +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 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 +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 DROP TABLE t1, t2; # # Bugs #9136, #12917: problems with --defaults-extra-file option @@ -2394,9 +2491,9 @@ SELECT * FROM `test2`; a2 1 SHOW TRIGGERS; -Trigger Event Table Statement Timing Created sql_mode Definer +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation testref INSERT test1 BEGIN -INSERT INTO test2 SET a2 = NEW.a1; END BEFORE NULL root@localhost +INSERT INTO test2 SET a2 = NEW.a1; END BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci SELECT * FROM `test1`; a1 1 @@ -2457,38 +2554,96 @@ LOCK TABLES `t1` WRITE; INSERT INTO `t1` VALUES (1),(2),(3),(4),(5); /*!40000 ALTER TABLE `t1` ENABLE KEYS */; UNLOCK TABLES; +/*!50003 DROP FUNCTION IF EXISTS `bug9056_func1` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; DELIMITER ;; -/*!50003 DROP FUNCTION IF EXISTS `bug9056_func1` */;; -/*!50003 SET SESSION SQL_MODE=""*/;; /*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 FUNCTION `bug9056_func1`(a INT, b INT) RETURNS int(11) RETURN a+b */;; -/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;; -/*!50003 DROP FUNCTION IF EXISTS `bug9056_func2` */;; -/*!50003 SET SESSION SQL_MODE=""*/;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP FUNCTION IF EXISTS `bug9056_func2` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; /*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 FUNCTION `bug9056_func2`(f1 char binary) RETURNS char(1) CHARSET latin1 begin set f1= concat( 'hello', f1 ); return f1; end */;; -/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;; -/*!50003 DROP PROCEDURE IF EXISTS `a'b` */;; -/*!50003 SET SESSION SQL_MODE="REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI"*/;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `a'b` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI' */ ; +DELIMITER ;; /*!50003 CREATE*/ /*!50020 DEFINER="root"@"localhost"*/ /*!50003 PROCEDURE "a'b"() select 1 */;; -/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;; -/*!50003 DROP PROCEDURE IF EXISTS `bug9056_proc1` */;; -/*!50003 SET SESSION SQL_MODE=""*/;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `bug9056_proc1` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; /*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `bug9056_proc1`(IN a INT, IN b INT, OUT c INT) BEGIN SELECT a+b INTO c; end */;; -/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;; -/*!50003 DROP PROCEDURE IF EXISTS `bug9056_proc2` */;; -/*!50003 SET SESSION SQL_MODE=""*/;; +DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; +/*!50003 DROP PROCEDURE IF EXISTS `bug9056_proc2` */; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; +DELIMITER ;; /*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `bug9056_proc2`(OUT a INT) BEGIN select sum(id) from t1 into a; END */;; -/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;; DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -2631,14 +2786,22 @@ LOCK TABLES "t1 test" WRITE; INSERT INTO "t1 test" VALUES (1),(2),(3); /*!40000 ALTER TABLE "t1 test" ENABLE KEYS */; UNLOCK TABLES; - +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; DELIMITER ;; -/*!50003 SET SESSION SQL_MODE="" */;; -/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `test trig` BEFORE INSERT ON `t1 test` FOR EACH ROW BEGIN +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `test trig` BEFORE INSERT ON `t1 test` FOR EACH ROW BEGIN INSERT INTO `t2 test` SET a2 = NEW.a1; END */;; - DELIMITER ; -/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; DROP TABLE IF EXISTS "t2 test"; CREATE TABLE "t2 test" ( "a2" int(11) DEFAULT NULL @@ -2727,19 +2890,46 @@ DROP TABLE IF EXISTS `v2`; USE `test`; /*!50001 DROP TABLE IF EXISTS `v0`*/; /*!50001 DROP VIEW IF EXISTS `v0`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ /*!50001 VIEW `v0` AS select `v1`.`a` AS `a`,`v1`.`b` AS `b`,`v1`.`c` AS `c` from `v1` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; /*!50001 DROP TABLE IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ /*!50001 VIEW `v1` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b`,`t1`.`c` AS `c` from `t1` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; /*!50001 DROP TABLE IF EXISTS `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ /*!50001 VIEW `v2` AS select `v0`.`a` AS `a`,`v0`.`b` AS `b`,`v0`.`c` AS `c` from `v0` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -2791,15 +2981,25 @@ LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; /*!40000 ALTER TABLE `t1` ENABLE KEYS */; UNLOCK TABLES; - +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = 'IGNORE_SPACE' */ ; DELIMITER ;; -/*!50003 SET SESSION SQL_MODE="IGNORE_SPACE" */;; -/*!50003 CREATE */ /*!50017 DEFINER=`root`@`localhost` */ /*!50003 TRIGGER `tr1` BEFORE INSERT ON `t1` FOR EACH ROW BEGIN +/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER tr1 BEFORE INSERT ON t1 +FOR EACH ROW +BEGIN SET new.a = 0; END */;; - DELIMITER ; -/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -2927,12 +3127,12 @@ drop trigger tr1; drop trigger tr2; drop table t1, t2; show triggers; -Trigger Event Table Statement Timing Created sql_mode Definer +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation tr1 INSERT t1 set -new.created=now() BEFORE # root@localhost +new.created=now() BEFORE # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci tr2 INSERT t1 begin insert into t2 set b=new.a and created=new.created; -end AFTER # root@localhost +end AFTER # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci drop trigger tr1; drop trigger tr2; drop table t1, t2; @@ -2945,14 +3145,32 @@ insert into t values(5, 51); create view v1 as select qty, price, qty*price as value from t; create view v2 as select qty from v1; mysqldump { +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ /*!50001 VIEW `v1` AS select `t`.`qty` AS `qty`,`t`.`price` AS `price`,(`t`.`qty` * `t`.`price`) AS `value` from `t` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; } mysqldump { +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ /*!50001 VIEW `v2` AS select `v1`.`qty` AS `qty` from `v1` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; } mysqldump drop view v1; @@ -2967,13 +3185,13 @@ return 42 */| /*!50003 CREATE PROCEDURE `p`() select 42 */| show create function f; -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation f CREATE DEFINER=`root`@`localhost` FUNCTION `f`() RETURNS bigint(20) -return 42 +return 42 latin1 latin1_swedish_ci latin1_swedish_ci show create procedure p; -Procedure sql_mode Create Procedure +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation p CREATE DEFINER=`root`@`localhost` PROCEDURE `p`() -select 42 +select 42 latin1 latin1_swedish_ci latin1_swedish_ci drop function f; drop procedure p; # @@ -3035,9 +3253,18 @@ DROP TABLE IF EXISTS `v1`; USE `mysqldump_test_db`; /*!50001 DROP TABLE IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ /*!50001 VIEW `v1` AS select `t1`.`id` AS `id` from `t1` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -3080,9 +3307,18 @@ USE `mysqldump_views`; USE `mysqldump_tables`; USE `mysqldump_views`; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ /*!50001 VIEW `mysqldump_views`.`nasishnasifu` AS select `mysqldump_tables`.`basetable`.`id` AS `id` from `mysqldump_tables`.`basetable` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; drop view nasishnasifu; drop database mysqldump_views; drop table mysqldump_tables.basetable; @@ -3269,11 +3505,11 @@ create function f2() returns int return f1(); create view v3 as select bug23491_original.f1(); use bug23491_restore; show create view bug23491_restore.v2; -View Create View -v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `f1`() AS `f1()` +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `f1`() AS `f1()` latin1 latin1_swedish_ci show create view bug23491_restore.v3; -View Create View -v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `bug23491_original`.`f1`() AS `bug23491_original.f1()` +View Create View character_set_client collation_connection +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `bug23491_original`.`f1`() AS `bug23491_original.f1()` latin1 latin1_swedish_ci drop database bug23491_original; drop database bug23491_restore; use test; @@ -3289,21 +3525,25 @@ grant all privileges on mysqldump_test_db.* to user1; grant all privileges on mysqldump_test_db.* to user2; create procedure mysqldump_test_db.sp1() select 'hello'; -/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/; -DELIMITER ;; - -- insufficient privileges to SHOW CREATE PROCEDURE `sp1` -- does user2 have permissions on mysql.proc? -DELIMITER ; - -/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/; +/*!50003 SET @saved_cs_client = @@character_set_client */ ; +/*!50003 SET @saved_cs_results = @@character_set_results */ ; +/*!50003 SET @saved_col_connection = @@collation_connection */ ; +/*!50003 SET character_set_client = latin1 */ ; +/*!50003 SET character_set_results = latin1 */ ; +/*!50003 SET collation_connection = latin1_swedish_ci */ ; +/*!50003 SET @saved_sql_mode = @@sql_mode */ ; +/*!50003 SET sql_mode = '' */ ; DELIMITER ;; -/*!50003 SET SESSION SQL_MODE=""*/;; /*!50003 CREATE*/ /*!50020 DEFINER=`user1`@`%`*/ /*!50003 PROCEDURE `sp1`() select 'hello' */;; -/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;; DELIMITER ; +/*!50003 SET sql_mode = @saved_sql_mode */ ; +/*!50003 SET character_set_client = @saved_cs_client */ ; +/*!50003 SET character_set_results = @saved_cs_results */ ; +/*!50003 SET collation_connection = @saved_col_connection */ ; drop procedure sp1; drop user user1; drop user user2; @@ -3543,35 +3783,35 @@ use first; set time_zone = 'UTC'; create event ee1 on schedule at '2035-12-31 20:01:23' do set @a=5; show events; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator -first ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +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 -ee1 UTC CREATE EVENT `ee1` ON SCHEDULE AT '2035-12-31 20:01:23' ON COMPLETION NOT PRESERVE ENABLE DO set @a=5 +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 drop database first; create database second; use second; show events; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator -second ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +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 -ee1 NO_AUTO_VALUE_ON_ZERO UTC CREATE EVENT `ee1` ON SCHEDULE AT '2035-12-31 20:01:23' ON COMPLETION NOT PRESERVE ENABLE DO set @a=5 +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 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; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator -second ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 -second ee2 root@localhost UTC ONE TIME 2018-12-31 21:01:23 NULL NULL NULL NULL ENABLED 1 -second ee3 root@localhost UTC ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLED 1 +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +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 +second ee2 root@localhost UTC ONE TIME 2018-12-31 21:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +second ee3 root@localhost UTC ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci drop database second; create database third; use third; show events; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator -third ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 -third ee2 root@localhost UTC ONE TIME 2018-12-31 21:01:23 NULL NULL NULL NULL ENABLED 1 -third ee3 root@localhost UTC ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLED 1 +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation +third 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 +third ee2 root@localhost UTC ONE TIME 2018-12-31 21:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +third ee3 root@localhost UTC ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci drop database third; set time_zone = 'SYSTEM'; use test; @@ -3624,9 +3864,18 @@ DROP TABLE IF EXISTS `v1`; USE `mysqldump_test_db`; /*!50001 DROP TABLE IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = latin1 */; +/*!50001 SET character_set_results = latin1 */; +/*!50001 SET collation_connection = latin1_swedish_ci */; /*!50001 CREATE ALGORITHM=UNDEFINED */ /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ /*!50001 VIEW `v1` AS select `t1`.`id` AS `id` from `t1` */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; diff --git a/mysql-test/r/ndb_binlog_format.result b/mysql-test/r/ndb_binlog_format.result new file mode 100644 index 00000000000..ed26060e2a4 --- /dev/null +++ b/mysql-test/r/ndb_binlog_format.result @@ -0,0 +1,30 @@ +drop table if exists t1, t2, t3; +CREATE TABLE t1 (m INT, n INT) ENGINE=MYISAM; +CREATE TABLE t2 (b INT, c INT) ENGINE=BLACKHOLE; +CREATE TABLE t3 (e INT, f INT) ENGINE=NDB; +RESET MASTER; +SET SESSION BINLOG_FORMAT=STATEMENT; +INSERT INTO t1 VALUES (1,1), (1,2), (2,1), (2,2); +INSERT INTO t2 VALUES (1,1), (1,2), (2,1), (2,2); +UPDATE t1, t2 SET m = 2, b = 3 WHERE n = c; +START TRANSACTION; +INSERT INTO t3 VALUES (1,1), (1,2), (2,1), (2,2); +UPDATE t1, t3 SET m = 2, e = 3 WHERE n = f; +UPDATE t3, t2 SET e = 2, b = 3 WHERE f = c; +COMMIT; +show binlog events from <binlog_start>; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (1,2), (2,1), (2,2) +master-bin.000001 # Query # # use `test`; INSERT INTO t2 VALUES (1,1), (1,2), (2,1), (2,2) +master-bin.000001 # Query # # use `test`; UPDATE t1, t2 SET m = 2, b = 3 WHERE n = c +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t3 VALUES (1,1), (1,2), (2,1), (2,2) +master-bin.000001 # Query # # use `test`; UPDATE t1, t3 SET m = 2, e = 3 WHERE n = f +master-bin.000001 # Query # # use `test`; UPDATE t3, t2 SET e = 2, b = 3 WHERE f = c +master-bin.000001 # Query # # use `test`; COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t3) +master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +DROP TABLE t1, t2, t3; diff --git a/mysql-test/r/ndb_read_multi_range.result b/mysql-test/r/ndb_read_multi_range.result index aef009212a4..8443d0473a8 100644 --- a/mysql-test/r/ndb_read_multi_range.result +++ b/mysql-test/r/ndb_read_multi_range.result @@ -451,7 +451,7 @@ CREATE TABLE t2 ( var1 int(2) NOT NULL, var2 int(2) NOT NULL, PRIMARY KEY (var1) -) ENGINE=MyISAM DEFAULT CHARSET=ascii CHECKSUM=1; +) ENGINE=ndbcluster DEFAULT CHARSET=ascii CHECKSUM=1; CREATE TRIGGER testtrigger AFTER UPDATE ON t1 FOR EACH ROW BEGIN REPLACE INTO t2 SELECT * FROM t1 WHERE t1.var1 = NEW.var1;END| diff --git a/mysql-test/r/ndb_sp.result b/mysql-test/r/ndb_sp.result index 32e6d2eddd7..dbd0325044d 100644 --- a/mysql-test/r/ndb_sp.result +++ b/mysql-test/r/ndb_sp.result @@ -31,12 +31,12 @@ select @test_var; 10 alter procedure test_proc1 comment 'new comment'; show create procedure test_proc1; -Procedure sql_mode Create Procedure +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation test_proc1 CREATE DEFINER=`root`@`localhost` PROCEDURE `test_proc1`(in var_in int) COMMENT 'new comment' begin select * from t1 where a = var_in; -end +end latin1 latin1_swedish_ci latin1_swedish_ci drop procedure test_proc1; drop procedure test_proc2; drop procedure test_proc3; diff --git a/mysql-test/r/ndb_trigger.result b/mysql-test/r/ndb_trigger.result index 28f9f9bdc37..d074ad01c22 100644 --- a/mysql-test/r/ndb_trigger.result +++ b/mysql-test/r/ndb_trigger.result @@ -1,7 +1,7 @@ drop table if exists t1, t2, t3, t4, t5; create table t1 (id int primary key, a int not null, b decimal (63,30) default 0) engine=ndb; -create table t2 (op char(1), a int not null, b decimal (63,30)); -create table t3 select 1 as i; +create table t2 (op char(1), a int not null, b decimal (63,30)) engine=ndb; +create table t3 engine=ndb select 1 as i; create table t4 (a int not null primary key, b int) engine=ndb; create table t5 (a int not null primary key, b int) engine=ndb; create trigger t1_bu before update on t1 for each row diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 84fcb8634d6..9214d470b37 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -2118,11 +2118,11 @@ prepare abc from "show master logs"; deallocate prepare abc; create procedure proc_1() show events; call proc_1(); -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation call proc_1(); -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation call proc_1(); -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation drop procedure proc_1; create function func_1() returns int begin show events; return 1; end| ERROR 0A000: Not allowed to return a result set from a function @@ -2132,27 +2132,27 @@ drop function func_1; ERROR 42000: FUNCTION test.func_1 does not exist prepare abc from "show events"; execute abc; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation execute abc; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation execute abc; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation deallocate prepare abc; drop procedure if exists a; create procedure a() select 42; create procedure proc_1(a char(2)) show create procedure a; call proc_1("bb"); -Procedure sql_mode Create Procedure +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation a CREATE DEFINER=`root`@`localhost` PROCEDURE `a`() -select 42 +select 42 latin1 latin1_swedish_ci latin1_swedish_ci call proc_1("bb"); -Procedure sql_mode Create Procedure +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation a CREATE DEFINER=`root`@`localhost` PROCEDURE `a`() -select 42 +select 42 latin1 latin1_swedish_ci latin1_swedish_ci call proc_1("bb"); -Procedure sql_mode Create Procedure +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation a CREATE DEFINER=`root`@`localhost` PROCEDURE `a`() -select 42 +select 42 latin1 latin1_swedish_ci latin1_swedish_ci drop procedure proc_1; create function func_1() returns int begin show create procedure a; return 1; end| ERROR 0A000: Not allowed to return a result set from a function @@ -2162,34 +2162,34 @@ drop function func_1; ERROR 42000: FUNCTION test.func_1 does not exist prepare abc from "show create procedure a"; execute abc; -Procedure sql_mode Create Procedure +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation a CREATE DEFINER=`root`@`localhost` PROCEDURE `a`() -select 42 +select 42 latin1 latin1_swedish_ci latin1_swedish_ci execute abc; -Procedure sql_mode Create Procedure +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation a CREATE DEFINER=`root`@`localhost` PROCEDURE `a`() -select 42 +select 42 latin1 latin1_swedish_ci latin1_swedish_ci execute abc; -Procedure sql_mode Create Procedure +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation a CREATE DEFINER=`root`@`localhost` PROCEDURE `a`() -select 42 +select 42 latin1 latin1_swedish_ci latin1_swedish_ci deallocate prepare abc; drop procedure a; drop function if exists a; create function a() returns int return 42+13; create procedure proc_1(a char(2)) show create function a; call proc_1("bb"); -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation a CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11) -return 42+13 +return 42+13 latin1 latin1_swedish_ci latin1_swedish_ci call proc_1("bb"); -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation a CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11) -return 42+13 +return 42+13 latin1 latin1_swedish_ci latin1_swedish_ci call proc_1("bb"); -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation a CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11) -return 42+13 +return 42+13 latin1 latin1_swedish_ci latin1_swedish_ci drop procedure proc_1; create function func_1() returns int begin show create function a; return 1; end| ERROR 0A000: Not allowed to return a result set from a function @@ -2199,17 +2199,17 @@ drop function func_1; ERROR 42000: FUNCTION test.func_1 does not exist prepare abc from "show create function a"; execute abc; -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation a CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11) -return 42+13 +return 42+13 latin1 latin1_swedish_ci latin1_swedish_ci execute abc; -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation a CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11) -return 42+13 +return 42+13 latin1 latin1_swedish_ci latin1_swedish_ci execute abc; -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation a CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11) -return 42+13 +return 42+13 latin1 latin1_swedish_ci latin1_swedish_ci deallocate prepare abc; drop function a; drop table if exists tab1; @@ -2277,14 +2277,14 @@ union all (select b, count(*) from t1 group by b); create procedure proc_1() show create view v1; call proc_1(); -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`) +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`) latin1 latin1_swedish_ci call proc_1(); -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`) +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`) latin1 latin1_swedish_ci call proc_1(); -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`) +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`) latin1 latin1_swedish_ci drop procedure proc_1; create function func_1() returns int begin show create view v1; return 1; end| ERROR 0A000: Not allowed to return a result set from a function @@ -2294,14 +2294,14 @@ drop function func_1; ERROR 42000: FUNCTION test.func_1 does not exist prepare abc from "show create view v1"; execute abc; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`) +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`) latin1 latin1_swedish_ci execute abc; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`) +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`) latin1 latin1_swedish_ci execute abc; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`) +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS (select `t1`.`a` AS `a`,count(0) AS `count(*)` from `t1` group by `t1`.`a`) union all (select `t1`.`b` AS `b`,count(0) AS `count(*)` from `t1` group by `t1`.`b`) latin1 latin1_swedish_ci deallocate prepare abc; drop view v1; drop table t1; diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result index 1b22bb0f39f..a532324719c 100644 --- a/mysql-test/r/ps_1general.result +++ b/mysql-test/r/ps_1general.result @@ -378,6 +378,8 @@ prepare stmt1 from ' execute stmt2 ' ; ERROR HY000: This command is not supported in the prepared statement protocol yet prepare stmt1 from ' deallocate prepare never_prepared ' ; ERROR HY000: This command is not supported in the prepared statement protocol yet +prepare stmt1 from 'alter view v1 as select 2'; +ERROR HY000: This command is not supported in the prepared statement protocol yet prepare stmt4 from ' use test ' ; ERROR HY000: This command is not supported in the prepared statement protocol yet prepare stmt3 from ' create database mysqltest '; @@ -442,7 +444,7 @@ def table 253 64 2 Y 0 31 8 def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 -def key_len 253 4096 0 Y 128 31 63 +def key_len 253 1365 0 Y 0 31 8 def ref 253 1024 0 Y 0 31 8 def rows 8 10 1 Y 32928 0 63 def Extra 253 255 14 N 1 31 8 @@ -458,7 +460,7 @@ def table 253 64 2 Y 0 31 8 def type 253 10 5 Y 0 31 8 def possible_keys 253 4096 7 Y 0 31 8 def key 253 64 7 Y 0 31 8 -def key_len 253 4096 1 Y 128 31 63 +def key_len 253 1365 1 Y 0 31 8 def ref 253 1024 0 Y 0 31 8 def rows 8 10 1 Y 32928 0 63 def Extra 253 255 27 N 1 31 8 diff --git a/mysql-test/r/ps_2myisam.result b/mysql-test/r/ps_2myisam.result index 39a76378ad5..3ffebbdf1e4 100644 --- a/mysql-test/r/ps_2myisam.result +++ b/mysql-test/r/ps_2myisam.result @@ -1158,7 +1158,7 @@ def table 253 64 2 Y 0 31 8 def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 -def key_len 253 4096 0 Y 128 31 63 +def key_len 253 1365 0 Y 0 31 8 def ref 253 1024 0 Y 0 31 8 def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 diff --git a/mysql-test/r/ps_3innodb.result b/mysql-test/r/ps_3innodb.result index c3aac0b2395..2a11564504a 100644 --- a/mysql-test/r/ps_3innodb.result +++ b/mysql-test/r/ps_3innodb.result @@ -1158,7 +1158,7 @@ def table 253 64 2 Y 0 31 8 def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 -def key_len 253 4096 0 Y 128 31 63 +def key_len 253 1365 0 Y 0 31 8 def ref 253 1024 0 Y 0 31 8 def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 diff --git a/mysql-test/r/ps_4heap.result b/mysql-test/r/ps_4heap.result index fda3c6adf0b..e56e771564c 100644 --- a/mysql-test/r/ps_4heap.result +++ b/mysql-test/r/ps_4heap.result @@ -1159,7 +1159,7 @@ def table 253 64 2 Y 0 31 8 def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 -def key_len 253 4096 0 Y 128 31 63 +def key_len 253 1365 0 Y 0 31 8 def ref 253 1024 0 Y 0 31 8 def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 diff --git a/mysql-test/r/ps_5merge.result b/mysql-test/r/ps_5merge.result index dfb876ea827..2f51b65152c 100644 --- a/mysql-test/r/ps_5merge.result +++ b/mysql-test/r/ps_5merge.result @@ -1201,7 +1201,7 @@ def table 253 64 2 Y 0 31 8 def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 -def key_len 253 4096 0 Y 128 31 63 +def key_len 253 1365 0 Y 0 31 8 def ref 253 1024 0 Y 0 31 8 def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 @@ -4222,7 +4222,7 @@ def table 253 64 2 Y 0 31 8 def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 -def key_len 253 4096 0 Y 128 31 63 +def key_len 253 1365 0 Y 0 31 8 def ref 253 1024 0 Y 0 31 8 def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 diff --git a/mysql-test/r/ps_7ndb.result b/mysql-test/r/ps_7ndb.result index 413f1e25ab5..f59b6e4452b 100644 --- a/mysql-test/r/ps_7ndb.result +++ b/mysql-test/r/ps_7ndb.result @@ -1158,7 +1158,7 @@ def table 253 64 2 Y 0 31 8 def type 253 10 3 Y 0 31 8 def possible_keys 253 4096 0 Y 0 31 8 def key 253 64 0 Y 0 31 8 -def key_len 253 4096 0 Y 128 31 63 +def key_len 253 1365 0 Y 0 31 8 def ref 253 1024 0 Y 0 31 8 def rows 8 10 1 Y 32928 0 63 def Extra 253 255 0 N 1 31 8 diff --git a/mysql-test/r/query_cache_ps_no_prot.result b/mysql-test/r/query_cache_ps_no_prot.result index bf162439918..29d16d8a619 100644 --- a/mysql-test/r/query_cache_ps_no_prot.result +++ b/mysql-test/r/query_cache_ps_no_prot.result @@ -144,7 +144,7 @@ c1 1 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 14 +Qcache_hits 15 ---- switch to connection con1 ---- set @a=1; prepare stmt4 from "select * from t1 where c1=?"; @@ -153,50 +153,63 @@ c1 1 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 14 +Qcache_hits 16 +prepare stmt4 from "select @a from t1 where c1=?"; +execute stmt4 using @a; +@a +1 +show status like 'Qcache_hits'; +Variable_name Value +Qcache_hits 16 +execute stmt4 using @a; +@a +1 +show status like 'Qcache_hits'; +Variable_name Value +Qcache_hits 16 ---- switch to connection default ---- prepare stmt1 from "select * from t1 where c1=10"; set global query_cache_size=0; show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 14 +Qcache_hits 16 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 14 +Qcache_hits 16 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 14 +Qcache_hits 16 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 14 +Qcache_hits 16 ---- switch to connection con1 ---- execute stmt3; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 14 +Qcache_hits 16 execute stmt3; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 14 +Qcache_hits 16 execute stmt3; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 14 +Qcache_hits 16 ---- switch to connection default ---- set global query_cache_size=100000; execute stmt1; @@ -204,80 +217,80 @@ c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 14 +Qcache_hits 16 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 15 +Qcache_hits 17 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 16 +Qcache_hits 18 ---- switch to connection con1 ---- execute stmt3; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 17 +Qcache_hits 19 execute stmt3; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 18 +Qcache_hits 20 execute stmt3; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 19 +Qcache_hits 21 ---- switch to connection default ---- set global query_cache_size=0; show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 19 +Qcache_hits 21 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 19 +Qcache_hits 21 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 19 +Qcache_hits 21 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 19 +Qcache_hits 21 ---- switch to connection con1 ---- execute stmt3; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 19 +Qcache_hits 21 execute stmt3; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 19 +Qcache_hits 21 execute stmt3; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 19 +Qcache_hits 21 ---- switch to connection default ---- set global query_cache_size=0; prepare stmt1 from "select * from t1 where c1=10"; @@ -287,75 +300,75 @@ prepare stmt3 from "select * from t1 where c1=10"; set global query_cache_size=100000; show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 19 +Qcache_hits 21 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 19 +Qcache_hits 21 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 19 +Qcache_hits 21 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 19 +Qcache_hits 21 ---- switch to connection con1 ---- show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 19 +Qcache_hits 21 execute stmt3; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 19 +Qcache_hits 21 execute stmt3; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 19 +Qcache_hits 21 execute stmt3; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 19 +Qcache_hits 21 ---- switch to connection default ---- set global query_cache_size=0; prepare stmt1 from "select * from t1 where c1=?"; set global query_cache_size=100000; show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 19 +Qcache_hits 21 set @a=1; execute stmt1 using @a; c1 1 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 19 +Qcache_hits 21 set @a=100; execute stmt1 using @a; c1 100 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 19 +Qcache_hits 21 set @a=10; execute stmt1 using @a; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 19 +Qcache_hits 21 drop table t1; ---- disconnect connection con1 ---- set @@global.query_cache_size=@initial_query_cache_size; diff --git a/mysql-test/r/query_cache_ps_ps_prot.result b/mysql-test/r/query_cache_ps_ps_prot.result index 56aeda4a253..ba675d57f50 100644 --- a/mysql-test/r/query_cache_ps_ps_prot.result +++ b/mysql-test/r/query_cache_ps_ps_prot.result @@ -144,7 +144,7 @@ c1 1 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 12 +Qcache_hits 13 ---- switch to connection con1 ---- set @a=1; prepare stmt4 from "select * from t1 where c1=?"; @@ -153,50 +153,63 @@ c1 1 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 12 +Qcache_hits 14 +prepare stmt4 from "select @a from t1 where c1=?"; +execute stmt4 using @a; +@a +1 +show status like 'Qcache_hits'; +Variable_name Value +Qcache_hits 14 +execute stmt4 using @a; +@a +1 +show status like 'Qcache_hits'; +Variable_name Value +Qcache_hits 14 ---- switch to connection default ---- prepare stmt1 from "select * from t1 where c1=10"; set global query_cache_size=0; show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 12 +Qcache_hits 14 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 12 +Qcache_hits 14 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 12 +Qcache_hits 14 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 12 +Qcache_hits 14 ---- switch to connection con1 ---- execute stmt3; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 12 +Qcache_hits 14 execute stmt3; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 12 +Qcache_hits 14 execute stmt3; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 12 +Qcache_hits 14 ---- switch to connection default ---- set global query_cache_size=100000; execute stmt1; @@ -204,80 +217,80 @@ c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 12 +Qcache_hits 14 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 13 +Qcache_hits 15 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 14 +Qcache_hits 16 ---- switch to connection con1 ---- execute stmt3; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 15 +Qcache_hits 17 execute stmt3; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 16 +Qcache_hits 18 execute stmt3; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 17 +Qcache_hits 19 ---- switch to connection default ---- set global query_cache_size=0; show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 17 +Qcache_hits 19 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 17 +Qcache_hits 19 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 17 +Qcache_hits 19 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 17 +Qcache_hits 19 ---- switch to connection con1 ---- execute stmt3; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 17 +Qcache_hits 19 execute stmt3; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 17 +Qcache_hits 19 execute stmt3; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 17 +Qcache_hits 19 ---- switch to connection default ---- set global query_cache_size=0; prepare stmt1 from "select * from t1 where c1=10"; @@ -287,75 +300,75 @@ prepare stmt3 from "select * from t1 where c1=10"; set global query_cache_size=100000; show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 17 +Qcache_hits 19 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 17 +Qcache_hits 19 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 17 +Qcache_hits 19 execute stmt1; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 17 +Qcache_hits 19 ---- switch to connection con1 ---- show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 17 +Qcache_hits 19 execute stmt3; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 17 +Qcache_hits 19 execute stmt3; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 17 +Qcache_hits 19 execute stmt3; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 17 +Qcache_hits 19 ---- switch to connection default ---- set global query_cache_size=0; prepare stmt1 from "select * from t1 where c1=?"; set global query_cache_size=100000; show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 17 +Qcache_hits 19 set @a=1; execute stmt1 using @a; c1 1 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 17 +Qcache_hits 19 set @a=100; execute stmt1 using @a; c1 100 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 17 +Qcache_hits 19 set @a=10; execute stmt1 using @a; c1 10 show status like 'Qcache_hits'; Variable_name Value -Qcache_hits 17 +Qcache_hits 19 drop table t1; ---- disconnect connection con1 ---- set @@global.query_cache_size=@initial_query_cache_size; diff --git a/mysql-test/r/rpl_events.result b/mysql-test/r/rpl_events.result index 0d7e7bb28a7..18fe72a9879 100644 --- a/mysql-test/r/rpl_events.result +++ b/mysql-test/r/rpl_events.result @@ -9,153 +9,191 @@ set binlog_format=row; DROP EVENT IF EXISTS test.justonce; drop table if exists t1,t2; CREATE TABLE `t1` ( -`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, +`id` INT(10) UNSIGNED NOT NULL, `c` VARCHAR(50) NOT NULL, `ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -INSERT INTO t1 (c) VALUES ('manually'); -CREATE EVENT test.justonce ON SCHEDULE AT NOW() + INTERVAL 2 SECOND DO INSERT INTO t1 -(c) VALUES ('from justonce'); +INSERT INTO t1 (id, c) VALUES (1, 'manually'); +"Creating event test.justonce on the master" +CREATE EVENT test.justonce ON SCHEDULE EVERY 2 SECOND DO +INSERT IGNORE INTO t1 (id, c) VALUES (2, 'from justonce'); +"Checking event is active on master" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce'; db name status originator test justonce ENABLED 1 -"in the master" -SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id; +"Checking event data on the master" +SELECT * FROM t1 ORDER BY id; id c ts 1 manually TIMESTAMP 2 from justonce TIMESTAMP affected rows: 2 -"in the slave" -SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id; +"Checking event data on the slave" +SELECT * FROM t1 ORDER BY id; id c ts 1 manually TIMESTAMP 2 from justonce TIMESTAMP affected rows: 2 +"Checking event is inactive on slave" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce'; db name status originator +test justonce SLAVESIDE_DISABLED 1 +"Dropping event test.slave_once on the slave" DROP EVENT IF EXISTS test.slave_once; CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO -INSERT INTO t1(c) VALUES ('from slave_once'); +INSERT IGNORE INTO t1(id, c) VALUES (3, 'from slave_once'); +"Checking event status on the slave for originator value = slave's server_id" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once'; db name status originator test slave_once ENABLED 2 +"Dropping event test.slave_once on the slave" DROP EVENT IF EXISTS test.slave_once; +"Dropping event test.justonce on the master" DROP EVENT IF EXISTS test.justonce; +"Creating event test.er on the master" CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO -INSERT INTO t1(c) VALUES ('from er'); +INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er'); +"Checking event status on the master" SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; db name status originator body -test er ENABLED 1 INSERT INTO t1(c) VALUES ('from er') -"in the slave" +test er ENABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er') +"Checking event status on the slave" SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; db name status originator body -test er SLAVESIDE_DISABLED 1 INSERT INTO t1(c) VALUES ('from er') -"in the master" -ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO INSERT into t1(c) VALUES ('from alter er'); +test er SLAVESIDE_DISABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er') +"Altering event test.er on the master" +ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO +INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er'); +"Checking event status on the master" SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; db name status originator body -test er ENABLED 1 INSERT into t1(c) VALUES ('from alter er') -"in the slave" +test er ENABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er') +"Checking event status on the slave" SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; db name status originator body -test er SLAVESIDE_DISABLED 1 INSERT into t1(c) VALUES ('from alter er') -"in the master" +test er SLAVESIDE_DISABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er') +"Dropping event test.er on the master" DROP EVENT test.er; +"Checking event status on the master" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; db name status originator -"in the slave" +"Checking event status on the slave" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; db name status originator -CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND -DO INSERT INTO t1(c) VALUES ('from slave_terminate'); +"Creating event test.slave_terminate on the slave" +CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DO +INSERT IGNORE INTO t1(id, c) VALUES (6, 'from slave_terminate'); +"Checking event status on the slave" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate'; db name status originator test slave_terminate ENABLED 2 +"Dropping event test.slave_terminate on the slave" DROP EVENT test.slave_terminate; -CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND -DISABLE ON SLAVE DO INSERT INTO t1(c) VALUES ('from slave_terminate'); +"Creating event test.slave_terminate with DISABLE ON SLAVE on the slave" +CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DISABLE ON SLAVE DO +INSERT IGNORE INTO t1(c) VALUES (7, 'from slave_terminate'); +"Checking event status on the slave" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate'; db name status originator test slave_terminate SLAVESIDE_DISABLED 2 +"Dropping event test.slave_terminate on the slave" DROP EVENT test.slave_terminate; -"in the master" +"Cleanup" DROP TABLE t1; set binlog_format=statement; DROP EVENT IF EXISTS test.justonce; drop table if exists t1,t2; CREATE TABLE `t1` ( -`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, +`id` INT(10) UNSIGNED NOT NULL, `c` VARCHAR(50) NOT NULL, `ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -INSERT INTO t1 (c) VALUES ('manually'); -CREATE EVENT test.justonce ON SCHEDULE AT NOW() + INTERVAL 2 SECOND DO INSERT INTO t1 -(c) VALUES ('from justonce'); +INSERT INTO t1 (id, c) VALUES (1, 'manually'); +"Creating event test.justonce on the master" +CREATE EVENT test.justonce ON SCHEDULE EVERY 2 SECOND DO +INSERT IGNORE INTO t1 (id, c) VALUES (2, 'from justonce'); +"Checking event is active on master" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce'; db name status originator test justonce ENABLED 1 -"in the master" -SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id; +"Checking event data on the master" +SELECT * FROM t1 ORDER BY id; id c ts 1 manually TIMESTAMP 2 from justonce TIMESTAMP affected rows: 2 -"in the slave" -SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id; +"Checking event data on the slave" +SELECT * FROM t1 ORDER BY id; id c ts 1 manually TIMESTAMP 2 from justonce TIMESTAMP affected rows: 2 +"Checking event is inactive on slave" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce'; db name status originator +test justonce SLAVESIDE_DISABLED 1 +"Dropping event test.slave_once on the slave" DROP EVENT IF EXISTS test.slave_once; CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO -INSERT INTO t1(c) VALUES ('from slave_once'); +INSERT IGNORE INTO t1(id, c) VALUES (3, 'from slave_once'); +"Checking event status on the slave for originator value = slave's server_id" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once'; db name status originator test slave_once ENABLED 2 +"Dropping event test.slave_once on the slave" DROP EVENT IF EXISTS test.slave_once; +"Dropping event test.justonce on the master" DROP EVENT IF EXISTS test.justonce; +"Creating event test.er on the master" CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO -INSERT INTO t1(c) VALUES ('from er'); +INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er'); +"Checking event status on the master" SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; db name status originator body -test er ENABLED 1 INSERT INTO t1(c) VALUES ('from er') -"in the slave" +test er ENABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er') +"Checking event status on the slave" SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; db name status originator body -test er SLAVESIDE_DISABLED 1 INSERT INTO t1(c) VALUES ('from er') -"in the master" -ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO INSERT into t1(c) VALUES ('from alter er'); +test er SLAVESIDE_DISABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (4, 'from er') +"Altering event test.er on the master" +ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO +INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er'); +"Checking event status on the master" SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; db name status originator body -test er ENABLED 1 INSERT into t1(c) VALUES ('from alter er') -"in the slave" +test er ENABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er') +"Checking event status on the slave" SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; db name status originator body -test er SLAVESIDE_DISABLED 1 INSERT into t1(c) VALUES ('from alter er') -"in the master" +test er SLAVESIDE_DISABLED 1 INSERT IGNORE INTO t1(id, c) VALUES (5, 'from alter er') +"Dropping event test.er on the master" DROP EVENT test.er; +"Checking event status on the master" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; db name status originator -"in the slave" +"Checking event status on the slave" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; db name status originator -CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND -DO INSERT INTO t1(c) VALUES ('from slave_terminate'); +"Creating event test.slave_terminate on the slave" +CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DO +INSERT IGNORE INTO t1(id, c) VALUES (6, 'from slave_terminate'); +"Checking event status on the slave" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate'; db name status originator test slave_terminate ENABLED 2 +"Dropping event test.slave_terminate on the slave" DROP EVENT test.slave_terminate; -CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND -DISABLE ON SLAVE DO INSERT INTO t1(c) VALUES ('from slave_terminate'); +"Creating event test.slave_terminate with DISABLE ON SLAVE on the slave" +CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DISABLE ON SLAVE DO +INSERT IGNORE INTO t1(c) VALUES (7, 'from slave_terminate'); +"Checking event status on the slave" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate'; db name status originator test slave_terminate SLAVESIDE_DISABLED 2 +"Dropping event test.slave_terminate on the slave" DROP EVENT test.slave_terminate; -"in the master" +"Cleanup" DROP TABLE t1; CREATE EVENT event1 ON SCHEDULE EVERY 1 YEAR DO BEGIN diff --git a/mysql-test/r/rpl_ndb_UUID.result b/mysql-test/r/rpl_ndb_UUID.result index 422379d4f55..6babf49dcaa 100644 --- a/mysql-test/r/rpl_ndb_UUID.result +++ b/mysql-test/r/rpl_ndb_UUID.result @@ -24,7 +24,7 @@ end| select fn1(0); fn1(0) 0 -create table t2 (a int); +create table t2 (a int) engine=NDB; insert into t2 values(fn1(2)); SHOW CREATE TABLE test.t1; Table Create Table diff --git a/mysql-test/r/rpl_ndb_ctype_ucs2_def.result b/mysql-test/r/rpl_ndb_ctype_ucs2_def.result new file mode 100644 index 00000000000..2f9dc4ae616 --- /dev/null +++ b/mysql-test/r/rpl_ndb_ctype_ucs2_def.result @@ -0,0 +1,9 @@ +show variables like 'collation_server'; +Variable_name Value +collation_server ucs2_unicode_ci +show variables like "%character_set_ser%"; +Variable_name Value +character_set_server ucs2 +DROP TABLE IF EXISTS t1; +create table t1 (a int); +drop table t1; diff --git a/mysql-test/r/rpl_ndb_dd_advance.result b/mysql-test/r/rpl_ndb_dd_advance.result index a4614b4b484..7f26313894c 100644 --- a/mysql-test/r/rpl_ndb_dd_advance.result +++ b/mysql-test/r/rpl_ndb_dd_advance.result @@ -56,6 +56,7 @@ undofile.dat UNDO LOG NULL lg1 undofile02.dat UNDO LOG NULL lg1 **** Do First Set of ALTERs in the master table **** CREATE INDEX t1_i ON t1(c2, c3); +CREATE UNIQUE INDEX t1_i2 ON t1(c2); ALTER TABLE t1 ADD c4 TIMESTAMP; ALTER TABLE t1 ADD c5 DOUBLE; ALTER TABLE t1 ADD INDEX (c5); @@ -68,6 +69,7 @@ t1 CREATE TABLE `t1` ( `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `c5` double DEFAULT NULL, PRIMARY KEY (`c1`), + UNIQUE KEY `t1_i2` (`c2`), KEY `t1_i` (`c2`,`c3`), KEY `c5` (`c5`) ) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 @@ -81,6 +83,7 @@ t1 CREATE TABLE `t1` ( `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `c5` double DEFAULT NULL, PRIMARY KEY (`c1`), + UNIQUE KEY `t1_i2` (`c2`), KEY `t1_i` (`c2`,`c3`), KEY `c5` (`c5`) ) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 @@ -101,6 +104,7 @@ t1 CREATE TABLE `t1` ( `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `c5` double DEFAULT NULL, PRIMARY KEY (`c1`), + UNIQUE KEY `t1_i2` (`c2`), KEY `t1_i` (`c2`,`c3`) ) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 **** Show second set of ALTERs on SLAVE **** @@ -113,6 +117,7 @@ t1 CREATE TABLE `t1` ( `c4` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `c5` double DEFAULT NULL, PRIMARY KEY (`c1`), + UNIQUE KEY `t1_i2` (`c2`), KEY `t1_i` (`c2`,`c3`) ) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 **** Third and last set of alters for test1 **** @@ -135,6 +140,7 @@ t1 CREATE TABLE `t1` ( `c3` blob, `c5` double DEFAULT NULL, PRIMARY KEY (`c1`), + UNIQUE KEY `t1_i2` (`c2`), KEY `t1_i` (`c2`) ) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 SELECT * FROM t1 ORDER BY c1 LIMIT 5; @@ -153,8 +159,16 @@ t1 CREATE TABLE `t1` ( `c3` blob, `c5` double DEFAULT NULL, PRIMARY KEY (`c1`), + UNIQUE KEY `t1_i2` (`c2`), KEY `t1_i` (`c2`) ) /*!50100 TABLESPACE ts1 STORAGE DISK */ ENGINE=ndbcluster DEFAULT CHARSET=latin1 +SELECT * FROM t1 ORDER BY c1 LIMIT 5; +c1 c2 c3 c5 +1 2.00 b1b1b1b1b1b1b1b1b1b1 NULL +2 4.00 b1b1b1b1b1b1b1b1b1b1 NULL +3 6.00 0000-00-00 00:00:00 NULL +4 8.00 0000-00-00 00:00:00 NULL +5 10.00 0000-00-00 00:00:00 NULL SELECT * FROM t1 where c1 = 1; c1 c2 c3 c5 1 2.00 b1b1b1b1b1b1b1b1b1b1 NULL @@ -167,148 +181,44 @@ START SLAVE; CREATE TABLESPACE ts2 ADD DATAFILE 'datafile03.dat' USE LOGFILE GROUP lg1 -INITIAL_SIZE 12M +INITIAL_SIZE 10M ENGINE=NDB; ALTER TABLESPACE ts2 ADD DATAFILE 'datafile04.dat' -INITIAL_SIZE 12M +INITIAL_SIZE 5M ENGINE=NDB; DROP DATABASE IF EXISTS tpcb; -Warnings: -Note 1008 Can't drop database 'tpcb'; database doesn't exist CREATE DATABASE tpcb; -*********** Create TPCB Tables ***************** -CREATE TABLE tpcb.account + +CREATE TABLE tpcb.account (id INT, bid INT, balance DECIMAL(10,2), filler CHAR(255), PRIMARY KEY(id)) -TABLESPACE ts1 STORAGE DISK -ENGINE=NDB; -CREATE TABLE tpcb.branch +TABLESPACE ts2 STORAGE DISK +ENGINE=NDBCLUSTER; + +CREATE TABLE tpcb.branch (bid INT, balance DECIMAL(10,2), filler VARCHAR(255), -PRIMARY KEY(bid)) -ENGINE=NDB; -CREATE TABLE tpcb.teller +PRIMARY KEY(bid))TABLESPACE ts2 STORAGE DISK +ENGINE=NDBCLUSTER; + +CREATE TABLE tpcb.teller (tid INT, balance DECIMAL(10,2), filler VARCHAR(255), -PRIMARY KEY(tid)) -TABLESPACE ts2 STORAGE DISK -ENGINE=NDB; -CREATE TABLE tpcb.history +PRIMARY KEY(tid)) TABLESPACE ts2 STORAGE DISK +ENGINE=NDBCLUSTER; + +CREATE TABLE tpcb.history (id MEDIUMINT NOT NULL AUTO_INCREMENT,aid INT, tid INT, bid INT, amount DECIMAL(10,2), tdate DATETIME, teller CHAR(20), uuidf LONGBLOB, filler CHAR(80),PRIMARY KEY (id)) TABLESPACE ts2 STORAGE DISK -ENGINE=NDB; -********* Create Procedures and Functions ************ -CREATE PROCEDURE tpcb.load() -BEGIN -DECLARE acct INT DEFAULT 1000; -DECLARE brch INT DEFAULT 100; -DECLARE tell INT DEFAULT 1000; -DECLARE tmp INT DEFAULT 100; -WHILE brch > 0 DO -SET tmp = 100; -WHILE tmp > 0 DO -INSERT INTO tpcb.account VALUES (acct, brch, 0.0, "FRESH ACCOUNT"); -SET acct = acct - 1; -SET tmp = tmp -1; -END WHILE; -INSERT INTO tpcb.branch VALUES (brch, 0.0, "FRESH BRANCH"); -SET brch = brch - 1; -END WHILE; -WHILE tell > 0 DO -INSERT INTO tpcb.teller VALUES (tell, 0.0, "FRESH TELLER"); -SET tell = tell - 1; -END WHILE; -END| -CREATE FUNCTION tpcb.account_id () RETURNS INT -BEGIN -DECLARE num INT; -DECLARE ran INT; -SELECT RAND() * 10 INTO ran; -IF (ran < 2) -THEN -SELECT RAND() * 10 INTO num; -ELSEIF (ran < 4) -THEN -SELECT RAND() * 100 INTO num; -ELSE -SELECT RAND() * 1000 INTO num; -END IF; -IF (num < 1) -THEN -RETURN 1; -END IF; -RETURN num; -END| -CREATE FUNCTION tpcb.teller_id () RETURNS INT -BEGIN -DECLARE num INT; -DECLARE ran INT; -SELECT RAND() * 10 INTO ran; -IF (ran < 2) -THEN -SELECT RAND() * 10 INTO num; -ELSEIF (ran < 5) -THEN -SELECT RAND() * 100 INTO num; -ELSE -SELECT RAND() * 1000 INTO num; -END IF; -IF (num < 1) -THEN -RETURN 1; -END IF; -RETURN num; -END| -CREATE PROCEDURE tpcb.trans() -BEGIN -DECLARE acct INT DEFAULT 0; -DECLARE brch INT DEFAULT 0; -DECLARE tell INT DEFAULT 0; -DECLARE bal DECIMAL(10,2) DEFAULT 0.0; -DECLARE amount DECIMAL(10,2) DEFAULT 1.00; -DECLARE test INT DEFAULT 0; -DECLARE bbal DECIMAL(10,2) DEFAULT 0.0; -DECLARE tbal DECIMAL(10,2) DEFAULT 0.0; -DECLARE local_uuid VARCHAR(255); -DECLARE local_user VARCHAR(255); -DECLARE local_time TIMESTAMP; -SELECT RAND() * 10 INTO test; -SELECT tpcb.account_id() INTO acct; -SELECT tpcb.teller_id() INTO tell; -SELECT account.balance INTO bal FROM tpcb.account WHERE id = acct; -SELECT account.bid INTO brch FROM tpcb.account WHERE id = acct; -SELECT teller.balance INTO tbal FROM tpcb.teller WHERE tid = tell; -SELECT branch.balance INTO bbal FROM tpcb.branch WHERE bid = brch; -IF (test < 5) -THEN -SET bal = bal + amount; -SET bbal = bbal + amount; -SET tbal = tbal + amount; -UPDATE tpcb.account SET balance = bal, filler = 'account updated' - WHERE id = acct; -UPDATE tpcb.branch SET balance = bbal, filler = 'branch updated' - WHERE bid = brch; -UPDATE tpcb.teller SET balance = tbal, filler = 'teller updated' - WHERE tid = tell; -ELSE -SET bal = bal - amount; -SET bbal = bbal - amount; -SET tbal = tbal - amount; -UPDATE tpcb.account SET balance = bal, filler = 'account updated' - WHERE id = acct; -UPDATE tpcb.branch SET balance = bbal, filler = 'branch updated' - WHERE bid = brch; -UPDATE tpcb.teller SET balance = tbal, filler = 'teller updated' - WHERE tid = tell; -END IF; -SET local_uuid=UUID(); -SET local_user=USER(); -SET local_time= NOW(); -INSERT INTO tpcb.history VALUES(NULL,acct,tell,brch,amount, local_time,local_user, -local_uuid,'completed trans'); -END| +ENGINE=NDBCLUSTER; + +--- Create stored procedures & functions --- + + +*** Stored Procedures Created *** + ****** TEST 2 test time ********************************* USE tpcb; *********** Load up the database ****************** @@ -316,11 +226,11 @@ CALL tpcb.load(); ********** Check load master and slave ************** SELECT COUNT(*) FROM account; COUNT(*) -10000 +1000 USE tpcb; SELECT COUNT(*) FROM account; COUNT(*) -10000 +1000 ******** Run in some transactions *************** ***** Time to try slave sync *********** **** Must make sure slave is clean ***** @@ -351,10 +261,10 @@ DROP LOGFILE GROUP lg1 ENGINE=NDB; ********** Take a backup of the Master ************* SELECT COUNT(*) FROM history; COUNT(*) -1000 +100 SELECT COUNT(*) FROM history; COUNT(*) -2000 +200 CREATE TEMPORARY TABLE IF NOT EXISTS mysql.backup_info (id INT, backup_id INT) ENGINE = HEAP; DELETE FROM mysql.backup_info; LOAD DATA INFILE '../tmp.dat' INTO TABLE mysql.backup_info FIELDS TERMINATED BY ','; @@ -368,7 +278,7 @@ CREATE DATABASE tpcb; USE tpcb; SELECT COUNT(*) FROM account; COUNT(*) -10000 +1000 ***** Add some more records to master ********* ***** Finsh the slave sync process ******* @the_epoch:=MAX(epoch) @@ -384,12 +294,12 @@ START SLAVE; USE tpcb; SELECT COUNT(*) FROM history; COUNT(*) -4050 +400 ****** SLAVE ******** USE tpcb; SELECT COUNT(*) FROM history; COUNT(*) -4050 +400 *** DUMP MASTER & SLAVE FOR COMPARE ******** *************** TEST 2 CLEANUP SECTION ******************** DROP PROCEDURE IF EXISTS tpcb.load; diff --git a/mysql-test/r/rpl_ndb_mix_innodb.result b/mysql-test/r/rpl_ndb_mix_innodb.result new file mode 100644 index 00000000000..625d06de44b --- /dev/null +++ b/mysql-test/r/rpl_ndb_mix_innodb.result @@ -0,0 +1,129 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; + +*** Test 1 *** + +create table t1 (a int key, b int) engine innodb; +create table t2 (a int key, b int) engine innodb; + +alter table t1 engine ndb; +alter table t2 engine ndb; + +insert into t1 values (1,2); + +select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos +from mysql.ndb_apply_status; +@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos +<log_name> <start_pos> <end_pos> + +show binlog events from <start_pos> limit 1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 <start_pos> Query 1 # use `test`; insert into t1 values (1,2) + +show binlog events from <start_pos> limit 1,1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Xid 1 445 COMMIT /* XID */ + +begin; +insert into t1 values (2,3); +insert into t2 values (3,4); +commit; + +select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos +from mysql.ndb_apply_status; +@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos +<log_name> <start_pos> <end_pos> +show binlog events from <start_pos> limit 1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 <start_pos> Query 1 # use `test`; BEGIN + +show binlog events from <start_pos> limit 1,2; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; insert into t1 values (2,3) +master-bin.000001 # Query # # use `test`; insert into t2 values (3,4) + +show binlog events from <start_pos> limit 3,1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Xid 1 <end_pos> COMMIT /* XID */ + +DROP TABLE test.t1, test.t2; +SHOW TABLES; +Tables_in_test + +*** Test 2 *** + +DROP DATABASE IF EXISTS tpcb; +CREATE DATABASE tpcb; + +CREATE TABLE tpcb.account (id INT, bid INT, balance DECIMAL(10,2), +filler CHAR(255), PRIMARY KEY(id)); + +CREATE TABLE tpcb.branch (bid INT, balance DECIMAL(10,2), filler VARCHAR(255), +PRIMARY KEY(bid)); + +CREATE TABLE tpcb.teller (tid INT, balance DECIMAL(10,2), filler VARCHAR(255), +PRIMARY KEY(tid)); + +CREATE TABLE tpcb.history (id MEDIUMINT NOT NULL AUTO_INCREMENT,aid INT, +tid INT, bid INT, amount DECIMAL(10,2), +tdate DATETIME, teller CHAR(20), uuidf LONGBLOB, +filler CHAR(80),PRIMARY KEY (id)); + +--- Create stored procedures & functions --- + + +*** Stored Procedures Created *** + +USE tpcb; +ALTER TABLE account ENGINE NDB; +ALTER TABLE branch ENGINE NDB; +ALTER TABLE teller ENGINE NDB; +ALTER TABLE history ENGINE NDB; + +select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos +from mysql.ndb_apply_status; +@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos +<log_name> <start_pos> <end_pos> + +show binlog events in 'master-bin.000001' from <start_pos> limit 9,1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Xid 1 <end_pos> COMMIT /* XID */ + +** Test 3 ** + +FLUSH LOGS; + +select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos +from mysql.ndb_apply_status; +@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos +<log_name> <start_pos> <end_pos> + +show binlog events in 'master-bin.000002' from <start_pos> limit 9,1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000002 # Xid 1 <end_pos> COMMIT /* XID */ + +** Test 4 ** + +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; + +select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos +from mysql.ndb_apply_status; +@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos +<log_name> <start_pos> <end_pos> + +show binlog events in 'master-bin.000001' from <start_pos> limit 9,1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Xid 1 <end_pos> COMMIT /* XID */ + +*** DUMP MASTER & SLAVE FOR COMPARE ******** +DROP DATABASE tpcb; +****** Do dumps compare ************ diff --git a/mysql-test/r/rpl_ndb_stm_innodb.result b/mysql-test/r/rpl_ndb_stm_innodb.result index 624439754b2..426a09f945c 100644 --- a/mysql-test/r/rpl_ndb_stm_innodb.result +++ b/mysql-test/r/rpl_ndb_stm_innodb.result @@ -4,37 +4,126 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; + +*** Test 1 *** + create table t1 (a int key, b int) engine innodb; create table t2 (a int key, b int) engine innodb; + alter table t1 engine ndb; alter table t2 engine ndb; -STOP SLAVE; -SET GLOBAL BINLOG_FORMAT=MIXED; -START SLAVE; + insert into t1 values (1,2); -select @start_pos:=start_pos, @end_pos:=end_pos from mysql.ndb_apply_status; -@start_pos:=start_pos @end_pos:=end_pos -<start_pos> <end_pos> + +select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos +from mysql.ndb_apply_status; +@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos +<log_name> <start_pos> <end_pos> + show binlog events from <start_pos> limit 1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 <start_pos> Query 1 # use `test`; insert into t1 values (1,2) + show binlog events from <start_pos> limit 1,1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Xid 1 445 COMMIT /* XID */ + begin; insert into t1 values (2,3); insert into t2 values (3,4); commit; -select @start_pos:=start_pos, @end_pos:=end_pos from mysql.ndb_apply_status; -@start_pos:=start_pos @end_pos:=end_pos -<start_pos> <end_pos> + +select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos +from mysql.ndb_apply_status; +@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos +<log_name> <start_pos> <end_pos> show binlog events from <start_pos> limit 1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 <start_pos> Query 1 # use `test`; BEGIN + show binlog events from <start_pos> limit 1,2; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query # # use `test`; insert into t1 values (2,3) master-bin.000001 # Query # # use `test`; insert into t2 values (3,4) + show binlog events from <start_pos> limit 3,1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Xid 1 <end_pos> COMMIT /* XID */ + +DROP TABLE test.t1, test.t2; +SHOW TABLES; +Tables_in_test + +*** Test 2 *** + +DROP DATABASE IF EXISTS tpcb; +CREATE DATABASE tpcb; + +CREATE TABLE tpcb.account (id INT, bid INT, balance DECIMAL(10,2), +filler CHAR(255), PRIMARY KEY(id)); + +CREATE TABLE tpcb.branch (bid INT, balance DECIMAL(10,2), filler VARCHAR(255), +PRIMARY KEY(bid)); + +CREATE TABLE tpcb.teller (tid INT, balance DECIMAL(10,2), filler VARCHAR(255), +PRIMARY KEY(tid)); + +CREATE TABLE tpcb.history (id MEDIUMINT NOT NULL AUTO_INCREMENT,aid INT, +tid INT, bid INT, amount DECIMAL(10,2), +tdate DATETIME, teller CHAR(20), uuidf LONGBLOB, +filler CHAR(80),PRIMARY KEY (id)); + +--- Create stored procedures & functions --- + + +*** Stored Procedures Created *** + +USE tpcb; +ALTER TABLE account ENGINE NDB; +ALTER TABLE branch ENGINE NDB; +ALTER TABLE teller ENGINE NDB; +ALTER TABLE history ENGINE NDB; + +select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos +from mysql.ndb_apply_status; +@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos +<log_name> <start_pos> <end_pos> + +show binlog events in 'master-bin.000001' from <start_pos> limit 6,1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Xid 1 <end_pos> COMMIT /* XID */ + +** Test 3 ** + +FLUSH LOGS; + +select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos +from mysql.ndb_apply_status; +@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos +<log_name> <start_pos> <end_pos> + +show binlog events in 'master-bin.000002' from <start_pos> limit 6,1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000002 # Xid 1 <end_pos> COMMIT /* XID */ + +** Test 4 ** + +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; + +select @log_name:=log_name, @start_pos:=start_pos, @end_pos:=end_pos +from mysql.ndb_apply_status; +@log_name:=log_name @start_pos:=start_pos @end_pos:=end_pos +<log_name> <start_pos> <end_pos> + +show binlog events in 'master-bin.000001' from <start_pos> limit 6,1; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Xid 1 <end_pos> COMMIT /* XID */ + +*** DUMP MASTER & SLAVE FOR COMPARE ******** +DROP DATABASE tpcb; +****** Do dumps compare ************ diff --git a/mysql-test/r/rpl_partition.result b/mysql-test/r/rpl_partition.result new file mode 100644 index 00000000000..cdd29919c48 --- /dev/null +++ b/mysql-test/r/rpl_partition.result @@ -0,0 +1,195 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +SET GLOBAL binlog_format = 'ROW'; +SET SESSION binlog_format = 'ROW'; +select @@global.binlog_format, @@session.binlog_format; +@@global.binlog_format ROW +@@session.binlog_format ROW +DROP TABLE IF EXISTS t1, t2, t3; +Warnings: +Level Note +Code 1051 +Message Unknown table 't1' +Level Note +Code 1051 +Message Unknown table 't2' +Level Note +Code 1051 +Message Unknown table 't3' +DROP PROCEDURE IF EXISTS p1; +Warnings: +Level Note +Code 1305 +Message PROCEDURE p1 does not exist +DROP PROCEDURE IF EXISTS p2; +Warnings: +Level Note +Code 1305 +Message PROCEDURE p2 does not exist +DROP PROCEDURE IF EXISTS p3; +Warnings: +Level Note +Code 1305 +Message PROCEDURE p3 does not exist +CREATE TABLE t1(id MEDIUMINT NOT NULL AUTO_INCREMENT, +dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB, +fkid MEDIUMINT, filler VARCHAR(255), +PRIMARY KEY(id)) ENGINE='innodb'; +CREATE TABLE t2(id MEDIUMINT NOT NULL AUTO_INCREMENT, +dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB, +fkid MEDIUMINT, filler VARCHAR(255), +PRIMARY KEY(id)) ENGINE='innodb' +PARTITION BY KEY(id) partitions 5; +CREATE TABLE t3(id MEDIUMINT NOT NULL AUTO_INCREMENT, +dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB, +fkid MEDIUMINT, filler VARCHAR(255), +PRIMARY KEY(id)) ENGINE='innodb' +PARTITION BY RANGE(id) +SUBPARTITION BY hash(id) subpartitions 2 +(PARTITION pa1 values less than (10), +PARTITION pa2 values less than (20), +PARTITION pa3 values less than (30), +PARTITION pa4 values less than (40), +PARTITION pa5 values less than (50), +PARTITION pa6 values less than (60), +PARTITION pa7 values less than (70), +PARTITION pa8 values less than (80), +PARTITION pa9 values less than (90), +PARTITION pa10 values less than (100), +PARTITION pa11 values less than MAXVALUE); +CREATE PROCEDURE p1() +BEGIN +DECLARE ins_count INT DEFAULT 1000; +DECLARE del_count INT; +DECLARE cur_user VARCHAR(255); +DECLARE local_uuid VARCHAR(255); +DECLARE local_time TIMESTAMP; +SET local_time= NOW(); +SET cur_user= CURRENT_USER(); +SET local_uuid= UUID(); +WHILE ins_count > 0 DO +INSERT INTO t1 VALUES (NULL, NOW(), USER() , UUID(), +ins_count,'Going to test MBR for MySQL'); +SET ins_count = ins_count - 1; +END WHILE; +SELECT MAX(id) FROM t1 INTO del_count; +WHILE del_count > 0 DO +DELETE FROM t1 WHERE id = del_count; +SET del_count = del_count - 2; +END WHILE; +END| +CREATE PROCEDURE p2() +BEGIN +DECLARE ins_count INT DEFAULT 1000; +DECLARE del_count INT; +DECLARE cur_user VARCHAR(255); +DECLARE local_uuid VARCHAR(255); +DECLARE local_time TIMESTAMP; +SET local_time= NOW(); +SET cur_user= CURRENT_USER(); +SET local_uuid= UUID(); +WHILE ins_count > 0 DO +INSERT INTO t2 VALUES (NULL, NOW(), USER() , UUID(), +ins_count,'Going to test MBR for MySQL'); +SET ins_count = ins_count - 1; +END WHILE; +SELECT MAX(id) FROM t2 INTO del_count; +WHILE del_count > 0 DO +DELETE FROM t2 WHERE id = del_count; +SET del_count = del_count - 2; +END WHILE; +END| +CREATE PROCEDURE p3() +BEGIN +DECLARE ins_count INT DEFAULT 1000; +DECLARE del_count INT; +DECLARE cur_user VARCHAR(255); +DECLARE local_uuid VARCHAR(255); +DECLARE local_time TIMESTAMP; +SET local_time= NOW(); +SET cur_user = CURRENT_USER(); +SET local_uuid=UUID(); +WHILE ins_count > 0 DO +INSERT INTO t3 VALUES (NULL, NOW(), USER(), UUID(), +ins_count,'Going to test MBR for MySQL'); +SET ins_count = ins_count - 1; +END WHILE; +SELECT MAX(id) FROM t3 INTO del_count; +WHILE del_count > 0 DO +DELETE FROM t3 WHERE id = del_count; +SET del_count = del_count - 2; +END WHILE; +END| +CALL p1(); +SELECT count(*) as "Master regular" FROM t1; +Master regular 500 +CALL p2(); +SELECT count(*) as "Master bykey" FROM t2; +Master bykey 500 +CALL p3(); +SELECT count(*) as "Master byrange" FROM t3; +Master byrange 500 +show create table t3; +Table t3 +Create Table CREATE TABLE `t3` ( + `id` mediumint(9) NOT NULL AUTO_INCREMENT, + `dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `user` char(255) DEFAULT NULL, + `uuidf` longblob, + `fkid` mediumint(9) DEFAULT NULL, + `filler` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (id) SUBPARTITION BY HASH (id) SUBPARTITIONS 2 (PARTITION pa1 VALUES LESS THAN (10) ENGINE = MyISAM, PARTITION pa2 VALUES LESS THAN (20) ENGINE = MyISAM, PARTITION pa3 VALUES LESS THAN (30) ENGINE = MyISAM, PARTITION pa4 VALUES LESS THAN (40) ENGINE = MyISAM, PARTITION pa5 VALUES LESS THAN (50) ENGINE = MyISAM, PARTITION pa6 VALUES LESS THAN (60) ENGINE = MyISAM, PARTITION pa7 VALUES LESS THAN (70) ENGINE = MyISAM, PARTITION pa8 VALUES LESS THAN (80) ENGINE = MyISAM, PARTITION pa9 VALUES LESS THAN (90) ENGINE = MyISAM, PARTITION pa10 VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION pa11 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ +show slave status; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_MYPORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos # +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running Yes +Slave_SQL_Running Yes +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos # +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No +Last_IO_Errno # +Last_IO_Error # +Last_SQL_Errno 0 +Last_SQL_Error +SELECT count(*) "Slave norm" FROM t1; +Slave norm 500 +SELECT count(*) "Slave bykey" FROM t2; +Slave bykey 500 +SELECT count(*) "Slave byrange" FROM t3; +Slave byrange 500 +DROP TABLE t1, t2, t3; +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS p2; +DROP PROCEDURE IF EXISTS p3; diff --git a/mysql-test/r/rpl_replicate_do.result b/mysql-test/r/rpl_replicate_do.result index 2a1dc4b44af..d854a2d0f8d 100644 --- a/mysql-test/r/rpl_replicate_do.result +++ b/mysql-test/r/rpl_replicate_do.result @@ -87,27 +87,27 @@ Tables_in_test t1 t2 show triggers; -Trigger Event Table Statement Timing Created sql_mode Definer -trg1 INSERT t1 set new.b=2 BEFORE NULL root@localhost -trg2 INSERT t2 set new.b=2 BEFORE NULL root@localhost +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +trg1 INSERT t1 set new.b=2 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +trg2 INSERT t2 set new.b=2 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci *** slave *** show tables; Tables_in_test t1 show triggers; -Trigger Event Table Statement Timing Created sql_mode Definer -trg1 INSERT t1 set new.b=2 BEFORE NULL root@localhost +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +trg1 INSERT t1 set new.b=2 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci *** master *** drop trigger trg1; drop trigger trg2; show triggers; -Trigger Event Table Statement Timing Created sql_mode Definer +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation *** slave *** show tables; Tables_in_test t1 show triggers; -Trigger Event Table Statement Timing Created sql_mode Definer +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation *** master *** drop table t1; drop table t2; diff --git a/mysql-test/r/rpl_row_UUID.result b/mysql-test/r/rpl_row_UUID.result index f56dc145901..02174a7ecae 100644 --- a/mysql-test/r/rpl_row_UUID.result +++ b/mysql-test/r/rpl_row_UUID.result @@ -24,7 +24,7 @@ end| select fn1(0); fn1(0) 0 -create table t2 (a int); +create table t2 (a int) engine=myisam; insert into t2 values(fn1(2)); SHOW CREATE TABLE test.t1; Table Create Table diff --git a/mysql-test/r/rpl_sp.result b/mysql-test/r/rpl_sp.result index 208c46c5fab..0b89b6d29c7 100644 --- a/mysql-test/r/rpl_sp.result +++ b/mysql-test/r/rpl_sp.result @@ -17,21 +17,31 @@ insert into t1 values (b); insert into t1 values (unix_timestamp()); end| select * from mysql.proc where name='foo' and db='mysqltest1'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 mysqltest1 foo PROCEDURE foo SQL CONTAINS_SQL NO DEFINER begin declare b int; set b = 8; insert into t1 values (b); insert into t1 values (unix_timestamp()); -end root@localhost # # +end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin +declare b int; +set b = 8; +insert into t1 values (b); +insert into t1 values (unix_timestamp()); +end select * from mysql.proc where name='foo' and db='mysqltest1'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 mysqltest1 foo PROCEDURE foo SQL CONTAINS_SQL NO DEFINER begin declare b int; set b = 8; insert into t1 values (b); insert into t1 values (unix_timestamp()); -end root@localhost # # +end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin +declare b int; +set b = 8; +insert into t1 values (b); +insert into t1 values (unix_timestamp()); +end set timestamp=1000000000; call foo(); select * from t1; @@ -115,15 +125,17 @@ select * from t2; a 20 select * from mysql.proc where name="foo4" and db='mysqltest1'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 mysqltest1 foo4 PROCEDURE foo4 SQL CONTAINS_SQL YES DEFINER begin insert into t2 values(20),(20); -end root@localhost # # +end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin +insert into t2 values(20),(20); +end drop procedure foo4; select * from mysql.proc where name="foo4" and db='mysqltest1'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 select * from mysql.proc where name="foo4" and db='mysqltest1'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 drop procedure foo; drop procedure foo2; drop procedure foo3; @@ -202,16 +214,22 @@ select fn3(); fn3() 0 select * from mysql.proc where db='mysqltest1'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 mysqltest1 fn1 FUNCTION fn1 SQL NO_SQL NO DEFINER int(11) begin return unix_timestamp(); -end root@localhost # # +end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin +return unix_timestamp(); +end mysqltest1 fn2 FUNCTION fn2 SQL NO_SQL NO DEFINER int(11) begin return unix_timestamp(); -end zedjzlcsjhd@localhost # # +end zedjzlcsjhd@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin +return unix_timestamp(); +end mysqltest1 fn3 FUNCTION fn3 SQL READS_SQL_DATA NO DEFINER int(11) begin return 0; -end root@localhost # # +end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin +return 0; +end select * from t1; a 1000000000 @@ -220,16 +238,22 @@ select * from t1; a 1000000000 select * from mysql.proc where db='mysqltest1'; -db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment +db name type specific_name language sql_data_access is_deterministic security_type param_list returns body definer created modified sql_mode comment character_set_client collation_connection db_collation body_utf8 mysqltest1 fn1 FUNCTION fn1 SQL NO_SQL NO DEFINER int(11) begin return unix_timestamp(); -end root@localhost # # +end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin +return unix_timestamp(); +end mysqltest1 fn2 FUNCTION fn2 SQL NO_SQL NO DEFINER int(11) begin return unix_timestamp(); -end zedjzlcsjhd@localhost # # +end zedjzlcsjhd@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin +return unix_timestamp(); +end mysqltest1 fn3 FUNCTION fn3 SQL READS_SQL_DATA NO DEFINER int(11) begin return 0; -end root@localhost # # +end root@localhost # # latin1 latin1_swedish_ci latin1_swedish_ci begin +return 0; +end delete from t2; alter table t2 add unique (a); drop function fn1; @@ -337,26 +361,26 @@ DROP FUNCTION IF EXISTS f1; ---> Checking on master... SHOW CREATE PROCEDURE p1; -Procedure sql_mode Create Procedure +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() -SET @a = 1 +SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci SHOW CREATE FUNCTION f1; -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) -RETURN 0 +RETURN 0 latin1 latin1_swedish_ci latin1_swedish_ci ---> Synchronizing slave with master... ---> connection: master ---> Checking on slave... SHOW CREATE PROCEDURE p1; -Procedure sql_mode Create Procedure +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() -SET @a = 1 +SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci SHOW CREATE FUNCTION f1; -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) -RETURN 0 +RETURN 0 latin1 latin1_swedish_ci latin1_swedish_ci ---> connection: master diff --git a/mysql-test/r/rpl_switch_stm_row_mixed.result b/mysql-test/r/rpl_switch_stm_row_mixed.result index 7c796bd5449..c3f0c07b92c 100644 --- a/mysql-test/r/rpl_switch_stm_row_mixed.result +++ b/mysql-test/r/rpl_switch_stm_row_mixed.result @@ -457,7 +457,7 @@ master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE `t2` ( master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE `t3` ( - `1` varbinary(36) NOT NULL DEFAULT '' + `1` varbinary(108) NOT NULL DEFAULT '' ) master-bin.000001 # Table_map # # table_id: # (mysqltest1.t3) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F @@ -761,7 +761,7 @@ master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE `t2` ( master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE `t3` ( - `1` varbinary(36) NOT NULL DEFAULT '' + `1` varbinary(108) NOT NULL DEFAULT '' ) master-bin.000001 # Table_map # # table_id: # (mysqltest1.t3) master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F diff --git a/mysql-test/r/rpl_trigger.result b/mysql-test/r/rpl_trigger.result index 815a87eede5..b4ce3ee1d36 100644 --- a/mysql-test/r/rpl_trigger.result +++ b/mysql-test/r/rpl_trigger.result @@ -868,8 +868,8 @@ Tables_in_test (t_) t1 t2 SHOW TRIGGERS; -Trigger Event Table Statement Timing Created sql_mode Definer -trg1 INSERT t1 INSERT INTO t2 VALUES(CURRENT_USER()) AFTER NULL +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +trg1 INSERT t1 INSERT INTO t2 VALUES(CURRENT_USER()) AFTER NULL latin1 latin1_swedish_ci latin1_swedish_ci SELECT * FROM t1; c 1 @@ -895,7 +895,7 @@ RESET SLAVE; SHOW TABLES LIKE 't_'; Tables_in_test (t_) SHOW TRIGGERS; -Trigger Event Table Statement Timing Created sql_mode Definer +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation RESET MASTER; START SLAVE; diff --git a/mysql-test/r/rpl_view.result b/mysql-test/r/rpl_view.result index 0d862a2a912..12b7b46ffed 100644 --- a/mysql-test/r/rpl_view.result +++ b/mysql-test/r/rpl_view.result @@ -88,8 +88,8 @@ Field Type Null Key Default Extra a int(11) YES NULL b decimal(32,0) YES NULL show create table v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,sum(`t1`.`b`) AS `b` from `t1` group by `t1`.`a` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,sum(`t1`.`b`) AS `b` from `t1` group by `t1`.`a` latin1 latin1_swedish_ci select * from v1; a b 1 6 diff --git a/mysql-test/r/show_check.result b/mysql-test/r/show_check.result index 66cd929ee05..9ef10865cd7 100644 --- a/mysql-test/r/show_check.result +++ b/mysql-test/r/show_check.result @@ -7,60 +7,157 @@ delete from mysql.db where user='mysqltest_1' || user='mysqltest_2' || user='mys flush privileges; create table t1 (a int not null primary key, b int not null,c int not null, key(b,c)); insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4); +-- Here we enable metadata just to check that the collation of the +-- resultset is non-binary for string type. This should be changed +-- after Bug#29394 is implemented. check table t1 fast; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Table 253 42 7 Y 0 31 8 +def Op 253 3 5 Y 0 31 8 +def Msg_type 253 3 6 Y 0 31 8 +def Msg_text 253 85 27 Y 0 31 8 Table Op Msg_type Msg_text test.t1 check status Table is already up to date check table t1 fast; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Table 253 42 7 Y 0 31 8 +def Op 253 3 5 Y 0 31 8 +def Msg_type 253 3 6 Y 0 31 8 +def Msg_text 253 85 27 Y 0 31 8 Table Op Msg_type Msg_text test.t1 check status Table is already up to date check table t1 changed; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Table 253 42 7 Y 0 31 8 +def Op 253 3 5 Y 0 31 8 +def Msg_type 253 3 6 Y 0 31 8 +def Msg_text 253 85 2 Y 0 31 8 Table Op Msg_type Msg_text test.t1 check status OK insert into t1 values (5,5,5); check table t1 changed; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Table 253 42 7 Y 0 31 8 +def Op 253 3 5 Y 0 31 8 +def Msg_type 253 3 6 Y 0 31 8 +def Msg_text 253 85 2 Y 0 31 8 Table Op Msg_type Msg_text test.t1 check status OK check table t1 medium; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Table 253 42 7 Y 0 31 8 +def Op 253 3 5 Y 0 31 8 +def Msg_type 253 3 6 Y 0 31 8 +def Msg_text 253 85 2 Y 0 31 8 Table Op Msg_type Msg_text test.t1 check status OK check table t1 extended; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Table 253 42 7 Y 0 31 8 +def Op 253 3 5 Y 0 31 8 +def Msg_type 253 3 6 Y 0 31 8 +def Msg_text 253 85 2 Y 0 31 8 Table Op Msg_type Msg_text test.t1 check status OK show index from t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def STATISTICS TABLE_NAME Table 253 64 2 N 1 0 8 +def STATISTICS NON_UNIQUE Non_unique 8 1 1 N 32769 0 63 +def STATISTICS INDEX_NAME Key_name 253 64 7 N 1 0 8 +def STATISTICS SEQ_IN_INDEX Seq_in_index 8 2 1 N 32769 0 63 +def STATISTICS COLUMN_NAME Column_name 253 64 1 N 1 0 8 +def STATISTICS COLLATION Collation 253 1 1 Y 0 0 8 +def STATISTICS CARDINALITY Cardinality 8 21 1 Y 32768 0 63 +def STATISTICS SUB_PART Sub_part 8 3 0 Y 32768 0 63 +def STATISTICS PACKED Packed 253 10 0 Y 0 0 8 +def STATISTICS NULLABLE Null 253 3 0 N 1 0 8 +def STATISTICS INDEX_TYPE Index_type 253 16 5 N 1 0 8 +def STATISTICS COMMENT Comment 253 16 0 Y 0 0 8 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment t1 0 PRIMARY 1 a A 5 NULL NULL BTREE t1 1 b 1 b A 1 NULL NULL BTREE t1 1 b 2 c A 5 NULL NULL BTREE insert into t1 values (5,5,5); ERROR 23000: Duplicate entry '5' for key 'PRIMARY' +-- Here we enable metadata just to check that the collation of the +-- resultset is non-binary for string type. This should be changed +-- after Bug#29394 is implemented. optimize table t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Table 253 42 7 Y 0 31 8 +def Op 253 3 8 Y 0 31 8 +def Msg_type 253 3 6 Y 0 31 8 +def Msg_text 253 85 2 Y 0 31 8 Table Op Msg_type Msg_text test.t1 optimize status OK optimize table t1; Table Op Msg_type Msg_text test.t1 optimize status Table is already up to date drop table t1; +-- Here we enable metadata just to check that the collation of the +-- resultset is non-binary for string type. This should be changed +-- after Bug#29394 is implemented. show variables like "wait_timeout%"; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8 +def VARIABLES VARIABLE_VALUE Value 253 20480 5 Y 0 0 8 Variable_name Value wait_timeout 28800 show variables like "WAIT_timeout%"; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def VARIABLES VARIABLE_NAME Variable_name 253 64 12 N 1 0 8 +def VARIABLES VARIABLE_VALUE Value 253 20480 5 Y 0 0 8 Variable_name Value wait_timeout 28800 show variables like "this_doesn't_exists%"; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def VARIABLES VARIABLE_NAME Variable_name 253 64 0 N 1 0 8 +def VARIABLES VARIABLE_VALUE Value 253 20480 0 Y 0 0 8 Variable_name Value show table status from test like "this_doesn't_exists%"; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def TABLES TABLE_NAME Name 253 64 0 N 1 0 8 +def TABLES ENGINE Engine 253 64 0 Y 0 0 8 +def TABLES VERSION Version 8 21 0 Y 32800 0 63 +def TABLES ROW_FORMAT Row_format 253 10 0 Y 0 0 8 +def TABLES TABLE_ROWS Rows 8 21 0 Y 32800 0 63 +def TABLES AVG_ROW_LENGTH Avg_row_length 8 21 0 Y 32800 0 63 +def TABLES DATA_LENGTH Data_length 8 21 0 Y 32800 0 63 +def TABLES MAX_DATA_LENGTH Max_data_length 8 21 0 Y 32800 0 63 +def TABLES INDEX_LENGTH Index_length 8 21 0 Y 32800 0 63 +def TABLES DATA_FREE Data_free 8 21 0 Y 32800 0 63 +def TABLES AUTO_INCREMENT Auto_increment 8 21 0 Y 32800 0 63 +def TABLES CREATE_TIME Create_time 12 19 0 Y 128 0 63 +def TABLES UPDATE_TIME Update_time 12 19 0 Y 128 0 63 +def TABLES CHECK_TIME Check_time 12 19 0 Y 128 0 63 +def TABLES TABLE_COLLATION Collation 253 64 0 Y 0 0 8 +def TABLES CHECKSUM Checksum 8 21 0 Y 32800 0 63 +def TABLES CREATE_OPTIONS Create_options 253 255 0 Y 0 0 8 +def TABLES TABLE_COMMENT Comment 253 80 0 N 1 0 8 Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment show databases; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def SCHEMATA SCHEMA_NAME Database 253 64 18 N 1 0 8 Database information_schema mysql test show databases like "test%"; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def SCHEMATA SCHEMA_NAME Database (test%) 253 64 4 N 1 0 8 Database (test%) test create table t1 (f1 int not null, f2 int not null, f3 int not null, f4 int not null, primary key(f1,f2,f3,f4)); insert into t1 values (1,1,1,0),(1,1,2,0),(1,1,3,0),(1,2,1,0),(1,2,2,0),(1,2,3,0),(1,3,1,0),(1,3,2,0),(1,3,3,0),(1,1,1,1),(1,1,2,1),(1,1,3,1),(1,2,1,1),(1,2,2,1),(1,2,3,1),(1,3,1,1),(1,3,2,1),(1,3,3,1); +-- Here we enable metadata just to check that the collation of the +-- resultset is non-binary for string type. This should be changed +-- after Bug#29394 is implemented. analyze table t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Table 253 42 7 Y 0 31 8 +def Op 253 3 7 Y 0 31 8 +def Msg_type 253 3 6 Y 0 31 8 +def Msg_text 253 85 2 Y 0 31 8 Table Op Msg_type Msg_text test.t1 analyze status OK show index from t1; @@ -69,7 +166,15 @@ t1 0 PRIMARY 1 f1 A 1 NULL NULL BTREE t1 0 PRIMARY 2 f2 A 3 NULL NULL BTREE t1 0 PRIMARY 3 f3 A 9 NULL NULL BTREE t1 0 PRIMARY 4 f4 A 18 NULL NULL BTREE +-- Here we enable metadata just to check that the collation of the +-- resultset is non-binary for string type. This should be changed +-- after Bug#29394 is implemented. repair table t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Table 253 42 7 Y 0 31 8 +def Op 253 3 6 Y 0 31 8 +def Msg_type 253 3 6 Y 0 31 8 +def Msg_text 253 85 2 Y 0 31 8 Table Op Msg_type Msg_text test.t1 repair status OK show index from t1; @@ -617,48 +722,48 @@ DROP VIEW IF EXISTS v1; DROP PROCEDURE IF EXISTS p1; CREATE VIEW v1 AS SELECT 1; SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `1` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `1` binary binary DROP VIEW v1; CREATE VIEW v1 AS SELECT SQL_CACHE 1; SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_cache 1 AS `1` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_cache 1 AS `1` binary binary DROP VIEW v1; CREATE VIEW v1 AS SELECT SQL_NO_CACHE 1; SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache 1 AS `1` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache 1 AS `1` binary binary DROP VIEW v1; CREATE VIEW v1 AS SELECT NOW(); SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select now() AS `NOW()` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select now() AS `NOW()` binary binary DROP VIEW v1; CREATE VIEW v1 AS SELECT SQL_CACHE NOW(); SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_cache now() AS `NOW()` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_cache now() AS `NOW()` binary binary DROP VIEW v1; CREATE VIEW v1 AS SELECT SQL_NO_CACHE NOW(); SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache now() AS `NOW()` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache now() AS `NOW()` binary binary DROP VIEW v1; CREATE VIEW v1 AS SELECT SQL_CACHE SQL_NO_CACHE NOW(); SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache now() AS `NOW()` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache now() AS `NOW()` binary binary DROP VIEW v1; CREATE VIEW v1 AS SELECT SQL_NO_CACHE SQL_CACHE NOW(); SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache now() AS `NOW()` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache now() AS `NOW()` binary binary DROP VIEW v1; CREATE VIEW v1 AS SELECT SQL_CACHE SQL_NO_CACHE SQL_CACHE NOW(); SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache now() AS `NOW()` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache now() AS `NOW()` binary binary DROP VIEW v1; CREATE PROCEDURE p1() BEGIN @@ -669,8 +774,8 @@ DROP PREPARE stmt; END | CALL p1(); SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_cache 1 AS `1` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_cache 1 AS `1` binary binary DROP PROCEDURE p1; DROP VIEW v1; SHOW TABLES FROM no_such_database; @@ -692,6 +797,357 @@ select 1 from information_schema.tables limit 1; show status like 'slow_queries'; Variable_name Value Slow_queries 2 +DROP DATABASE IF EXISTS mysqltest1; +DROP TABLE IF EXISTS t1; +DROP VIEW IF EXISTS v1; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +CREATE DATABASE mysqltest1; +CREATE TABLE t1(c INT NOT NULL PRIMARY KEY); +CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1; +CREATE VIEW v1 AS SELECT 1; +CREATE PROCEDURE p1() SELECT 1; +CREATE FUNCTION f1() RETURNS INT RETURN 1; +set names utf8; +-- Here we enable metadata just to check that the collation of the +-- resultset is non-binary for string type. This should be changed +-- after Bug#29394 is implemented. +---------------------------------------------------------------- +SHOW CHARACTER SET LIKE 'utf8'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def CHARACTER_SETS CHARACTER_SET_NAME Charset 253 192 4 N 1 0 33 +def CHARACTER_SETS DESCRIPTION Description 253 180 13 N 1 0 33 +def CHARACTER_SETS DEFAULT_COLLATE_NAME Default collation 253 192 15 N 1 0 33 +def CHARACTER_SETS MAXLEN Maxlen 8 3 1 N 32769 0 63 +Charset Description Default collation Maxlen +utf8 UTF-8 Unicode utf8_general_ci 3 +---------------------------------------------------------------- +SHOW COLLATION LIKE 'latin1_bin'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COLLATIONS COLLATION_NAME Collation 253 192 10 N 1 0 33 +def COLLATIONS CHARACTER_SET_NAME Charset 253 192 6 N 1 0 33 +def COLLATIONS ID Id 8 11 2 N 32769 0 63 +def COLLATIONS IS_DEFAULT Default 253 9 0 N 1 0 33 +def COLLATIONS IS_COMPILED Compiled 253 9 3 N 1 0 33 +def COLLATIONS SORTLEN Sortlen 8 3 1 N 32769 0 63 +Collation Charset Id Default Compiled Sortlen +latin1_bin latin1 47 Yes 1 +---------------------------------------------------------------- +SHOW CREATE DATABASE mysqltest1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Database 253 63 10 N 1 31 33 +def Create Database 253 1023 69 N 1 31 33 +Database Create Database +mysqltest1 CREATE DATABASE `mysqltest1` /*!40100 DEFAULT CHARACTER SET latin1 */ +---------------------------------------------------------------- +SHOW DATABASES LIKE 'mysqltest1'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def SCHEMATA SCHEMA_NAME Database (mysqltest1) 253 192 10 N 1 0 33 +Database (mysqltest1) +mysqltest1 +---------------------------------------------------------------- +SHOW CREATE TABLE t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Table 253 63 2 N 1 31 33 +def Create Table 253 1023 102 N 1 31 33 +Table Create Table +t1 CREATE TABLE `t1` ( + `c` int(11) NOT NULL, + PRIMARY KEY (`c`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +---------------------------------------------------------------- +SHOW INDEX FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def STATISTICS TABLE_NAME Table 253 192 2 N 1 0 33 +def STATISTICS NON_UNIQUE Non_unique 8 1 1 N 32769 0 63 +def STATISTICS INDEX_NAME Key_name 253 192 7 N 1 0 33 +def STATISTICS SEQ_IN_INDEX Seq_in_index 8 2 1 N 32769 0 63 +def STATISTICS COLUMN_NAME Column_name 253 192 1 N 1 0 33 +def STATISTICS COLLATION Collation 253 3 1 Y 0 0 33 +def STATISTICS CARDINALITY Cardinality 8 21 1 Y 32768 0 63 +def STATISTICS SUB_PART Sub_part 8 3 0 Y 32768 0 63 +def STATISTICS PACKED Packed 253 30 0 Y 0 0 33 +def STATISTICS NULLABLE Null 253 9 0 N 1 0 33 +def STATISTICS INDEX_TYPE Index_type 253 48 5 N 1 0 33 +def STATISTICS COMMENT Comment 253 48 0 Y 0 0 33 +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment +t1 0 PRIMARY 1 c A 0 NULL NULL BTREE +---------------------------------------------------------------- +SELECT +TABLE_CATALOG, +TABLE_SCHEMA, +TABLE_NAME, +TABLE_TYPE, +ENGINE, +ROW_FORMAT, +TABLE_COLLATION, +CREATE_OPTIONS, +TABLE_COMMENT +FROM INFORMATION_SCHEMA.TABLES +WHERE table_name = 't1'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def TABLES TABLE_CATALOG TABLE_CATALOG 253 1536 0 Y 0 0 33 +def TABLES TABLE_SCHEMA TABLE_SCHEMA 253 192 4 N 1 0 33 +def TABLES TABLE_NAME TABLE_NAME 253 192 2 N 1 0 33 +def TABLES TABLE_TYPE TABLE_TYPE 253 192 10 N 1 0 33 +def TABLES ENGINE ENGINE 253 192 6 Y 0 0 33 +def TABLES ROW_FORMAT ROW_FORMAT 253 30 5 Y 0 0 33 +def TABLES TABLE_COLLATION TABLE_COLLATION 253 192 17 Y 0 0 33 +def TABLES CREATE_OPTIONS CREATE_OPTIONS 253 765 0 Y 0 0 33 +def TABLES TABLE_COMMENT TABLE_COMMENT 253 240 0 N 1 0 33 +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE ROW_FORMAT TABLE_COLLATION CREATE_OPTIONS TABLE_COMMENT +NULL test t1 BASE TABLE MyISAM Fixed latin1_swedish_ci +---------------------------------------------------------------- +SELECT +TABLE_CATALOG, +TABLE_SCHEMA, +TABLE_NAME, +COLUMN_NAME, +COLUMN_DEFAULT, +IS_NULLABLE, +DATA_TYPE, +CHARACTER_SET_NAME, +COLLATION_NAME, +COLUMN_TYPE, +COLUMN_KEY, +EXTRA, +PRIVILEGES, +COLUMN_COMMENT +FROM INFORMATION_SCHEMA.COLUMNS +WHERE table_name = 't1'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COLUMNS TABLE_CATALOG TABLE_CATALOG 253 1536 0 Y 0 0 33 +def COLUMNS TABLE_SCHEMA TABLE_SCHEMA 253 192 4 N 1 0 33 +def COLUMNS TABLE_NAME TABLE_NAME 253 192 2 N 1 0 33 +def COLUMNS COLUMN_NAME COLUMN_NAME 253 192 1 N 1 0 33 +def COLUMNS COLUMN_DEFAULT COLUMN_DEFAULT 252 589815 0 Y 16 0 33 +def COLUMNS IS_NULLABLE IS_NULLABLE 253 9 2 N 1 0 33 +def COLUMNS DATA_TYPE DATA_TYPE 253 192 3 N 1 0 33 +def COLUMNS CHARACTER_SET_NAME CHARACTER_SET_NAME 253 192 0 Y 0 0 33 +def COLUMNS COLLATION_NAME COLLATION_NAME 253 192 0 Y 0 0 33 +def COLUMNS COLUMN_TYPE COLUMN_TYPE 252 589815 7 N 17 0 33 +def COLUMNS COLUMN_KEY COLUMN_KEY 253 9 3 N 1 0 33 +def COLUMNS EXTRA EXTRA 253 60 0 N 1 0 33 +def COLUMNS PRIVILEGES PRIVILEGES 253 240 31 N 1 0 33 +def COLUMNS COLUMN_COMMENT COLUMN_COMMENT 253 765 0 N 1 0 33 +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA PRIVILEGES COLUMN_COMMENT +NULL test t1 c NULL NO int NULL NULL int(11) PRI select,insert,update,references +---------------------------------------------------------------- +SHOW TABLES LIKE 't1'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def TABLE_NAMES TABLE_NAME Tables_in_test (t1) 253 192 2 N 1 0 33 +Tables_in_test (t1) +t1 +---------------------------------------------------------------- +SHOW COLUMNS FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def COLUMNS COLUMN_NAME Field 253 192 1 N 1 0 33 +def COLUMNS COLUMN_TYPE Type 252 589815 7 N 17 0 33 +def COLUMNS IS_NULLABLE Null 253 9 2 N 1 0 33 +def COLUMNS COLUMN_KEY Key 253 9 3 N 1 0 33 +def COLUMNS COLUMN_DEFAULT Default 252 589815 0 Y 16 0 33 +def COLUMNS EXTRA Extra 253 60 0 N 1 0 33 +Field Type Null Key Default Extra +c int(11) NO PRI +---------------------------------------------------------------- +SHOW TRIGGERS LIKE 't1'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def TRIGGERS TRIGGER_NAME Trigger 253 192 5 N 1 0 33 +def TRIGGERS EVENT_MANIPULATION Event 253 18 6 N 1 0 33 +def TRIGGERS EVENT_OBJECT_TABLE Table 253 192 2 N 1 0 33 +def TRIGGERS ACTION_STATEMENT Statement 252 589815 10 N 17 0 33 +def TRIGGERS ACTION_TIMING Timing 253 18 6 N 1 0 33 +def TRIGGERS CREATED Created 12 19 0 Y 128 0 63 +def TRIGGERS SQL_MODE sql_mode 252 589815 0 N 17 0 33 +def TRIGGERS DEFINER Definer 252 589815 14 N 17 0 33 +def TRIGGERS CHARACTER_SET_CLIENT character_set_client 253 96 6 N 1 0 33 +def TRIGGERS COLLATION_CONNECTION collation_connection 253 96 6 N 1 0 33 +def TRIGGERS DATABASE_COLLATION Database Collation 253 96 17 N 1 0 33 +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +t1_bi INSERT t1 SET @a = 1 BEFORE NULL root@localhost binary binary latin1_swedish_ci +---------------------------------------------------------------- +SELECT +TRIGGER_CATALOG, +TRIGGER_SCHEMA, +TRIGGER_NAME, +EVENT_MANIPULATION, +EVENT_OBJECT_CATALOG, +EVENT_OBJECT_SCHEMA, +EVENT_OBJECT_TABLE, +ACTION_CONDITION, +ACTION_STATEMENT, +ACTION_ORIENTATION, +ACTION_TIMING, +ACTION_REFERENCE_OLD_TABLE, +ACTION_REFERENCE_NEW_TABLE, +ACTION_REFERENCE_OLD_ROW, +ACTION_REFERENCE_NEW_ROW, +SQL_MODE, +DEFINER +FROM INFORMATION_SCHEMA.TRIGGERS +WHERE trigger_name = 't1_bi'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def TRIGGERS TRIGGER_CATALOG TRIGGER_CATALOG 253 1536 0 Y 0 0 33 +def TRIGGERS TRIGGER_SCHEMA TRIGGER_SCHEMA 253 192 4 N 1 0 33 +def TRIGGERS TRIGGER_NAME TRIGGER_NAME 253 192 5 N 1 0 33 +def TRIGGERS EVENT_MANIPULATION EVENT_MANIPULATION 253 18 6 N 1 0 33 +def TRIGGERS EVENT_OBJECT_CATALOG EVENT_OBJECT_CATALOG 253 1536 0 Y 0 0 33 +def TRIGGERS EVENT_OBJECT_SCHEMA EVENT_OBJECT_SCHEMA 253 192 4 N 1 0 33 +def TRIGGERS EVENT_OBJECT_TABLE EVENT_OBJECT_TABLE 253 192 2 N 1 0 33 +def TRIGGERS ACTION_CONDITION ACTION_CONDITION 252 589815 0 Y 16 0 33 +def TRIGGERS ACTION_STATEMENT ACTION_STATEMENT 252 589815 10 N 17 0 33 +def TRIGGERS ACTION_ORIENTATION ACTION_ORIENTATION 253 27 3 N 1 0 33 +def TRIGGERS ACTION_TIMING ACTION_TIMING 253 18 6 N 1 0 33 +def TRIGGERS ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_OLD_TABLE 253 192 0 Y 0 0 33 +def TRIGGERS ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_NEW_TABLE 253 192 0 Y 0 0 33 +def TRIGGERS ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_OLD_ROW 253 9 3 N 1 0 33 +def TRIGGERS ACTION_REFERENCE_NEW_ROW ACTION_REFERENCE_NEW_ROW 253 9 3 N 1 0 33 +def TRIGGERS SQL_MODE SQL_MODE 252 589815 0 N 17 0 33 +def TRIGGERS DEFINER DEFINER 252 589815 14 N 17 0 33 +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW SQL_MODE DEFINER +NULL test t1_bi INSERT NULL test t1 NULL SET @a = 1 ROW BEFORE NULL NULL OLD NEW root@localhost +---------------------------------------------------------------- +SHOW CREATE VIEW v1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def View 253 63 2 N 1 31 33 +def Create View 253 1023 103 N 1 31 33 +def character_set_client 253 30 6 N 1 31 33 +def collation_connection 253 30 6 N 1 31 33 +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `1` binary binary +---------------------------------------------------------------- +SELECT * +FROM INFORMATION_SCHEMA.VIEWS +WHERE table_name = 'v1'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def VIEWS TABLE_CATALOG TABLE_CATALOG 253 1536 0 Y 0 0 33 +def VIEWS TABLE_SCHEMA TABLE_SCHEMA 253 192 4 N 1 0 33 +def VIEWS TABLE_NAME TABLE_NAME 253 192 2 N 1 0 33 +def VIEWS VIEW_DEFINITION VIEW_DEFINITION 252 589815 8 N 17 0 33 +def VIEWS CHECK_OPTION CHECK_OPTION 253 24 4 N 1 0 33 +def VIEWS IS_UPDATABLE IS_UPDATABLE 253 9 2 N 1 0 33 +def VIEWS DEFINER DEFINER 253 231 14 N 1 0 33 +def VIEWS SECURITY_TYPE SECURITY_TYPE 253 21 7 N 1 0 33 +def VIEWS CHARACTER_SET_CLIENT CHARACTER_SET_CLIENT 253 96 6 N 1 0 33 +def VIEWS COLLATION_CONNECTION COLLATION_CONNECTION 253 96 6 N 1 0 33 +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION +NULL test v1 SELECT 1 NONE NO root@localhost DEFINER binary binary +---------------------------------------------------------------- +SHOW CREATE PROCEDURE p1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Procedure 253 63 2 N 1 31 33 +def sql_mode 253 0 0 N 1 31 33 +def Create Procedure 253 1023 59 Y 0 31 33 +def character_set_client 253 30 6 N 1 31 33 +def collation_connection 253 30 6 N 1 31 33 +def Database Collation 253 30 17 N 1 31 33 +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() +SELECT 1 binary binary latin1_swedish_ci +---------------------------------------------------------------- +SELECT +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 +FROM INFORMATION_SCHEMA.ROUTINES +WHERE routine_name = 'p1'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def ROUTINES SPECIFIC_NAME SPECIFIC_NAME 253 192 2 N 1 0 33 +def ROUTINES ROUTINE_CATALOG ROUTINE_CATALOG 253 1536 0 Y 0 0 33 +def ROUTINES ROUTINE_SCHEMA ROUTINE_SCHEMA 253 192 4 N 1 0 33 +def ROUTINES ROUTINE_NAME ROUTINE_NAME 253 192 2 N 1 0 33 +def ROUTINES ROUTINE_TYPE ROUTINE_TYPE 253 27 9 N 1 0 33 +def ROUTINES DTD_IDENTIFIER DTD_IDENTIFIER 253 192 0 Y 0 0 33 +def ROUTINES ROUTINE_BODY ROUTINE_BODY 253 24 3 N 1 0 33 +def ROUTINES ROUTINE_DEFINITION ROUTINE_DEFINITION 252 589815 8 Y 16 0 33 +def ROUTINES EXTERNAL_NAME EXTERNAL_NAME 253 192 0 Y 0 0 33 +def ROUTINES EXTERNAL_LANGUAGE EXTERNAL_LANGUAGE 253 192 0 Y 0 0 33 +def ROUTINES PARAMETER_STYLE PARAMETER_STYLE 253 24 3 N 1 0 33 +def ROUTINES IS_DETERMINISTIC IS_DETERMINISTIC 253 9 2 N 1 0 33 +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 252 589815 0 N 17 0 33 +def ROUTINES ROUTINE_COMMENT ROUTINE_COMMENT 253 192 0 N 1 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 +---------------------------------------------------------------- +SHOW CREATE FUNCTION f1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def Function 253 63 2 N 1 31 33 +def sql_mode 253 0 0 N 1 31 33 +def Create Function 253 1023 74 Y 0 31 33 +def character_set_client 253 30 6 N 1 31 33 +def collation_connection 253 30 6 N 1 31 33 +def Database Collation 253 30 17 N 1 31 33 +Function sql_mode Create Function character_set_client collation_connection Database Collation +f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) +RETURN 1 binary binary latin1_swedish_ci +---------------------------------------------------------------- +SELECT +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 +FROM INFORMATION_SCHEMA.ROUTINES +WHERE routine_name = 'f1'; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def ROUTINES SPECIFIC_NAME SPECIFIC_NAME 253 192 2 N 1 0 33 +def ROUTINES ROUTINE_CATALOG ROUTINE_CATALOG 253 1536 0 Y 0 0 33 +def ROUTINES ROUTINE_SCHEMA ROUTINE_SCHEMA 253 192 4 N 1 0 33 +def ROUTINES ROUTINE_NAME ROUTINE_NAME 253 192 2 N 1 0 33 +def ROUTINES ROUTINE_TYPE ROUTINE_TYPE 253 27 8 N 1 0 33 +def ROUTINES DTD_IDENTIFIER DTD_IDENTIFIER 253 192 7 Y 0 0 33 +def ROUTINES ROUTINE_BODY ROUTINE_BODY 253 24 3 N 1 0 33 +def ROUTINES ROUTINE_DEFINITION ROUTINE_DEFINITION 252 589815 8 Y 16 0 33 +def ROUTINES EXTERNAL_NAME EXTERNAL_NAME 253 192 0 Y 0 0 33 +def ROUTINES EXTERNAL_LANGUAGE EXTERNAL_LANGUAGE 253 192 0 Y 0 0 33 +def ROUTINES PARAMETER_STYLE PARAMETER_STYLE 253 24 3 N 1 0 33 +def ROUTINES IS_DETERMINISTIC IS_DETERMINISTIC 253 9 2 N 1 0 33 +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 252 589815 0 N 17 0 33 +def ROUTINES ROUTINE_COMMENT ROUTINE_COMMENT 253 192 0 N 1 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 +---------------------------------------------------------------- +DROP DATABASE mysqltest1; +DROP TABLE t1; +DROP VIEW v1; +DROP PROCEDURE p1; +DROP FUNCTION f1; End of 5.0 tests. SHOW AUTHORS; create database mysqltest; @@ -754,4 +1210,76 @@ drop table `été`; set names latin1; show columns from `#mysql50#????????`; Got one of the listed errors +DROP TABLE IF EXISTS t1; +DROP PROCEDURE IF EXISTS p1; +CREATE TABLE t1(c1 INT); +CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1; +SHOW CREATE TRIGGER t1_bi; +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +CREATE PROCEDURE p1() SHOW CREATE TRIGGER t1_bi; +CALL p1(); +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +CALL p1(); +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +CALL p1(); +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +CALL p1(); +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +CALL p1(); +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +CALL p1(); +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +CALL p1(); +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +CALL p1(); +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +CALL p1(); +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +CALL p1(); +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +PREPARE stmt1 FROM 'SHOW CREATE TRIGGER t1_bi'; +EXECUTE stmt1; +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +EXECUTE stmt1; +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +EXECUTE stmt1; +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +EXECUTE stmt1; +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +EXECUTE stmt1; +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +EXECUTE stmt1; +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +EXECUTE stmt1; +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +EXECUTE stmt1; +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +EXECUTE stmt1; +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +EXECUTE stmt1; +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +t1_bi CREATE DEFINER=`root`@`localhost` TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1 latin1 latin1_swedish_ci latin1_swedish_ci +DROP TABLE t1; +DROP PROCEDURE p1; +DEALLOCATE PREPARE stmt1; End of 5.1 tests diff --git a/mysql-test/r/skip_grants.result b/mysql-test/r/skip_grants.result index 0961ffd734c..6bb8cbea2f1 100644 --- a/mysql-test/r/skip_grants.result +++ b/mysql-test/r/skip_grants.result @@ -35,16 +35,16 @@ SELECT 3; CREATE DEFINER=a@'' FUNCTION f3() RETURNS INT RETURN 3; SHOW CREATE VIEW v3; -View Create View -v3 CREATE ALGORITHM=UNDEFINED DEFINER=`a`@`` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`c` AS `c` from `t1` +View Create View character_set_client collation_connection +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`a`@`` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`c` AS `c` from `t1` latin1 latin1_swedish_ci SHOW CREATE PROCEDURE p3; -Procedure sql_mode Create Procedure +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation p3 CREATE DEFINER=`a`@`` PROCEDURE `p3`() -SELECT 3 +SELECT 3 latin1 latin1_swedish_ci latin1_swedish_ci SHOW CREATE FUNCTION f3; -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation f3 CREATE DEFINER=`a`@`` FUNCTION `f3`() RETURNS int(11) -RETURN 3 +RETURN 3 latin1 latin1_swedish_ci latin1_swedish_ci DROP TRIGGER t1_bi; DROP TRIGGER ti_ai; DROP TRIGGER ti_bu; diff --git a/mysql-test/r/sp-destruct.result b/mysql-test/r/sp-destruct.result index 4df8086c84e..ae294f05b25 100644 --- a/mysql-test/r/sp-destruct.result +++ b/mysql-test/r/sp-destruct.result @@ -37,26 +37,33 @@ insert into mysql.proc ( db, name, type, specific_name, language, sql_data_access, is_deterministic, security_type, param_list, returns, body, definer, created, modified, -sql_mode, comment +sql_mode, comment, character_set_client, collation_connection, db_collation, +body_utf8 ) values ( 'test', 'bug14233_1', 'FUNCTION', 'bug14233_1', 'SQL', 'READS_SQL_DATA', 'NO', 'DEFINER', '', 'int(10)', 'select count(*) from mysql.user', -'root@localhost', NOW() , '0000-00-00 00:00:00', '', '' +'root@localhost', NOW() , '0000-00-00 00:00:00', '', '', +'', '', '', +'select count(*) from mysql.user' ), ( 'test', 'bug14233_2', 'FUNCTION', 'bug14233_2', 'SQL', 'READS_SQL_DATA', 'NO', 'DEFINER', '', 'int(10)', 'begin declare x int; select count(*) into x from mysql.user; end', -'root@localhost', NOW() , '0000-00-00 00:00:00', '', '' +'root@localhost', NOW() , '0000-00-00 00:00:00', '', '', +'', '', '', +'begin declare x int; select count(*) into x from mysql.user; end' ), ( 'test', 'bug14233_3', 'PROCEDURE', 'bug14233_3', 'SQL', 'READS_SQL_DATA','NO', 'DEFINER', '', '', 'alksj wpsj sa ^#!@ ', -'root@localhost', NOW() , '0000-00-00 00:00:00', '', '' +'root@localhost', NOW() , '0000-00-00 00:00:00', '', '', +'', '', '', +'alksj wpsj sa ^#!@ ' ); select bug14233_1(); ERROR HY000: Failed to load routine test.bug14233_1. The table mysql.proc is missing, corrupt, or contains bad data (internal code -6) @@ -78,6 +85,6 @@ drop function bug14233_1; drop function bug14233_2; drop procedure bug14233_3; show procedure status; -Db Name Type Definer Modified Created Security_type Comment +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation show function status; -Db Name Type Definer Modified Created Security_type Comment +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation diff --git a/mysql-test/r/sp-dynamic.result b/mysql-test/r/sp-dynamic.result index f1c7e6076e5..34b76a9424f 100644 --- a/mysql-test/r/sp-dynamic.result +++ b/mysql-test/r/sp-dynamic.result @@ -87,6 +87,10 @@ prepare stmt from "create table t1 (a int)"; execute stmt; insert into t1 (a) values (1); select * from t1; +prepare stmt_alter from "alter table t1 add (b int)"; +execute stmt_alter; +insert into t1 (a,b) values (2,1); +deallocate prepare stmt_alter; deallocate prepare stmt; deallocate prepare stmt_drop; end| @@ -245,6 +249,9 @@ a 1 drop procedure p1| drop table if exists t1| +drop table if exists t2| +Warnings: +Note 1051 Unknown table 't2' create table t1 (id integer primary key auto_increment, stmt_text char(35), status varchar(20))| insert into t1 (stmt_text) values @@ -255,7 +262,10 @@ insert into t1 (stmt_text) values ("help help"), ("show databases"), ("show tables"), ("show table status"), ("show open tables"), ("show storage engines"), ("insert into t1 (id) values (1)"), ("update t1 set status=''"), -("delete from t1"), ("truncate t1"), ("call p1()"), ("foo bar")| +("delete from t1"), ("truncate t1"), ("call p1()"), ("foo bar"), +("create view v1 as select 1"), ("alter view v1 as select 2"), +("drop view v1"),("create table t2 (a int)"),("alter table t2 add (b int)"), +("drop table t2")| create procedure p1() begin declare v_stmt_text varchar(255); @@ -305,6 +315,12 @@ id stmt_text status 20 truncate t1 supported 21 call p1() supported 22 foo bar syntax error +23 create view v1 as select 1 supported +24 alter view v1 as select 2 not supported +25 drop view v1 supported +26 create table t2 (a int) supported +27 alter table t2 add (b int) supported +28 drop table t2 supported drop procedure p1| drop table t1| prepare stmt from 'select 1'| diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index 16f39e39a46..675a59f1fb7 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -682,8 +682,8 @@ create procedure bug17015_012345678901234567890123456789012345678901234567890123 begin end| show procedure status like 'bug17015%'| -Db Name Type Definer Modified Created Security_type Comment -test bug17015_0123456789012345678901234567890123456789012345678901234 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +test bug17015_0123456789012345678901234567890123456789012345678901234 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci drop procedure bug17015_0123456789012345678901234567890123456789012345678901234| drop procedure if exists bug10969| create procedure bug10969() @@ -982,9 +982,9 @@ ERROR HY000: Explicit or implicit commit is not allowed in stored function or tr CREATE FUNCTION bug_13627_f() returns int BEGIN create view v1 as select 1; return 1; END | ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN alter view v1 as select 1; END | -ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +ERROR 0A000: ALTER VIEW is not allowed in stored procedures CREATE FUNCTION bug_13627_f() returns int BEGIN alter view v1 as select 1; return 1; END | -ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. +ERROR 0A000: ALTER VIEW is not allowed in stored procedures CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN drop view v1; END | ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger. CREATE FUNCTION bug_13627_f() returns int BEGIN drop view v1; return 1; END | @@ -1087,8 +1087,8 @@ create procedure p2() select version(); ERROR 3D000: No database selected use mysqltest2; show procedure status; -Db Name Type Definer Modified Created Security_type Comment -mysqltest2 p1 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +mysqltest2 p1 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci drop database mysqltest2; use test; DROP FUNCTION IF EXISTS bug13012| @@ -1177,8 +1177,8 @@ call ` bug15658`(); 1 1 show procedure status; -Db Name Type Definer Modified Created Security_type Comment -test bug15658 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +test bug15658 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci drop procedure ` bug15658`; drop function if exists bug14270; drop table if exists t1; diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result index 7315ef40083..1a1645ca971 100644 --- a/mysql-test/r/sp-security.result +++ b/mysql-test/r/sp-security.result @@ -12,8 +12,8 @@ insert into t1 values('test', 0); create procedure stamp(i int) insert into db1_secret.t1 values (user(), i); show procedure status like 'stamp'; -Db Name Type Definer Modified Created Security_type Comment -db1_secret stamp PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +db1_secret stamp PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci create function db() returns varchar(64) begin declare v varchar(64); @@ -21,8 +21,8 @@ select u into v from t1 limit 1; return v; end| show function status like 'db'; -Db Name Type Definer Modified Created Security_type Comment -db1_secret db FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +db1_secret db FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci call stamp(1); select * from t1; u i @@ -71,12 +71,12 @@ user1@localhost 2 anon@localhost 3 alter procedure stamp sql security invoker; show procedure status like 'stamp'; -Db Name Type Definer Modified Created Security_type Comment -db1_secret stamp PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 INVOKER +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +db1_secret stamp PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 INVOKER latin1 latin1_swedish_ci latin1_swedish_ci alter function db sql security invoker; show function status like 'db'; -Db Name Type Definer Modified Created Security_type Comment -db1_secret db FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 INVOKER +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +db1_secret db FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 INVOKER latin1 latin1_swedish_ci latin1_swedish_ci call stamp(4); select * from t1; u i @@ -365,21 +365,21 @@ Note 1449 There is no 'a @ b @ c'@'localhost' registered ---> connection: con1root use mysqltest; SHOW CREATE PROCEDURE wl2897_p1; -Procedure sql_mode Create Procedure +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation wl2897_p1 CREATE DEFINER=`mysqltest_2`@`localhost` PROCEDURE `wl2897_p1`() -SELECT 1 +SELECT 1 latin1 latin1_swedish_ci latin1_swedish_ci SHOW CREATE PROCEDURE wl2897_p3; -Procedure sql_mode Create Procedure +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation wl2897_p3 CREATE DEFINER=`a @ b @ c`@`localhost` PROCEDURE `wl2897_p3`() -SELECT 3 +SELECT 3 latin1 latin1_swedish_ci latin1_swedish_ci SHOW CREATE FUNCTION wl2897_f1; -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation wl2897_f1 CREATE DEFINER=`mysqltest_2`@`localhost` FUNCTION `wl2897_f1`() RETURNS int(11) -RETURN 1 +RETURN 1 latin1 latin1_swedish_ci latin1_swedish_ci SHOW CREATE FUNCTION wl2897_f3; -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation wl2897_f3 CREATE DEFINER=`a @ b @ c`@`localhost` FUNCTION `wl2897_f3`() RETURNS int(11) -RETURN 3 +RETURN 3 latin1 latin1_swedish_ci latin1_swedish_ci DROP USER mysqltest_1@localhost; DROP USER mysqltest_2@localhost; DROP DATABASE mysqltest; @@ -443,14 +443,14 @@ SET a=1; SELECT a; END // SHOW CREATE PROCEDURE test.sp19857; -Procedure sql_mode Create Procedure +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation sp19857 CREATE DEFINER=`user19857`@`localhost` PROCEDURE `sp19857`() DETERMINISTIC BEGIN DECLARE a INT; SET a=1; SELECT a; -END +END latin1 latin1_swedish_ci latin1_swedish_ci DROP PROCEDURE IF EXISTS test.sp19857; ---> connection: root diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 98d73f7536c..b060bfb081a 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -787,11 +787,11 @@ sql security definer comment 'Characteristics procedure test' insert into t1 values ("chistics", 1)| show create procedure chistics| -Procedure sql_mode Create Procedure +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation chistics CREATE DEFINER=`root`@`localhost` PROCEDURE `chistics`() MODIFIES SQL DATA COMMENT 'Characteristics procedure test' -insert into t1 values ("chistics", 1) +insert into t1 values ("chistics", 1) latin1 latin1_swedish_ci latin1_swedish_ci call chistics()| select * from t1| id data @@ -799,12 +799,12 @@ chistics 1 delete from t1| alter procedure chistics sql security invoker| show create procedure chistics| -Procedure sql_mode Create Procedure +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation chistics CREATE DEFINER=`root`@`localhost` PROCEDURE `chistics`() MODIFIES SQL DATA SQL SECURITY INVOKER COMMENT 'Characteristics procedure test' -insert into t1 values ("chistics", 1) +insert into t1 values ("chistics", 1) latin1 latin1_swedish_ci latin1_swedish_ci drop procedure chistics| drop function if exists chistics| create function chistics() returns int @@ -814,12 +814,12 @@ sql security invoker comment 'Characteristics procedure test' return 42| show create function chistics| -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation chistics CREATE DEFINER=`root`@`localhost` FUNCTION `chistics`() RETURNS int(11) DETERMINISTIC SQL SECURITY INVOKER COMMENT 'Characteristics procedure test' -return 42 +return 42 latin1 latin1_swedish_ci latin1_swedish_ci select chistics()| chistics() 42 @@ -827,13 +827,13 @@ alter function chistics no sql comment 'Characteristics function test'| show create function chistics| -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation chistics CREATE DEFINER=`root`@`localhost` FUNCTION `chistics`() RETURNS int(11) NO SQL DETERMINISTIC SQL SECURITY INVOKER COMMENT 'Characteristics function test' -return 42 +return 42 latin1 latin1_swedish_ci latin1_swedish_ci drop function chistics| insert into t1 values ("foo", 1), ("bar", 2), ("zip", 3)| set @@sql_mode = 'ANSI'| @@ -1223,12 +1223,12 @@ n f 20 2432902008176640000 drop table t3| show function status like '%f%'| -Db Name Type Definer Modified Created Security_type Comment -test fac FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +test fac FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci drop procedure ifac| drop function fac| show function status like '%f%'| -Db Name Type Definer Modified Created Security_type Comment +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation drop table if exists t3| create table t3 ( i int unsigned not null primary key, @@ -1290,7 +1290,7 @@ end; end while; end| show create procedure opp| -Procedure sql_mode Create Procedure +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation opp CREATE DEFINER=`root`@`localhost` PROCEDURE `opp`(n bigint unsigned, out pp bool) begin declare r double; @@ -1316,11 +1316,11 @@ set s = s+1; end; end if; end loop; -end +end latin1 latin1_swedish_ci latin1_swedish_ci show procedure status like '%p%'| -Db Name Type Definer Modified Created Security_type Comment -test ip PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER -test opp PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +test ip PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci +test opp PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci call ip(200)| select * from t3 where i=45 or i=100 or i=199| i p @@ -1331,7 +1331,7 @@ drop table t3| drop procedure opp| drop procedure ip| show procedure status like '%p%'| -Db Name Type Definer Modified Created Security_type Comment +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation drop table if exists t3| create table t3 ( f bigint unsigned not null )| drop procedure if exists fib| @@ -1383,19 +1383,19 @@ create procedure bar(x char(16), y int) comment "111111111111" sql security invoker insert into test.t1 values (x, y)| show procedure status like 'bar'| -Db Name Type Definer Modified Created Security_type Comment -test bar PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 INVOKER 111111111111 +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +test bar PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 INVOKER 111111111111 latin1 latin1_swedish_ci latin1_swedish_ci alter procedure bar comment "2222222222" sql security definer| alter procedure bar comment "3333333333"| alter procedure bar| show create procedure bar| -Procedure sql_mode Create Procedure +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation bar CREATE DEFINER=`root`@`localhost` PROCEDURE `bar`(x char(16), y int) COMMENT '3333333333' -insert into test.t1 values (x, y) +insert into test.t1 values (x, y) latin1 latin1_swedish_ci latin1_swedish_ci show procedure status like 'bar'| -Db Name Type Definer Modified Created Security_type Comment -test bar PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER 3333333333 +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +test bar PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER 3333333333 latin1 latin1_swedish_ci latin1_swedish_ci drop procedure bar| drop procedure if exists p1| create procedure p1 () @@ -1960,24 +1960,24 @@ show create function bug2267_4; end| create function bug2267_4() returns int return 100| call bug2267_1()| -Db Name Type Definer Modified Created Security_type Comment -test bug2267_1 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER -test bug2267_2 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER -test bug2267_3 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER -test bug2267_4 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +test bug2267_1 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci +test bug2267_2 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci +test bug2267_3 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci +test bug2267_4 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci call bug2267_2()| -Db Name Type Definer Modified Created Security_type Comment -test bug2267_4 FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER +Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation +test bug2267_4 FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER latin1 latin1_swedish_ci latin1_swedish_ci call bug2267_3()| -Procedure sql_mode Create Procedure +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation bug2267_1 CREATE DEFINER=`root`@`localhost` PROCEDURE `bug2267_1`() begin show procedure status; -end +end latin1 latin1_swedish_ci latin1_swedish_ci call bug2267_4()| -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation bug2267_4 CREATE DEFINER=`root`@`localhost` FUNCTION `bug2267_4`() RETURNS int(11) -return 100 +return 100 latin1 latin1_swedish_ci latin1_swedish_ci drop procedure bug2267_1| drop procedure bug2267_2| drop procedure bug2267_3| @@ -2308,22 +2308,22 @@ create function bug2564_4(x int, y int) returns int return x || y$ set @@sql_mode = ''| show create procedure bug2564_1| -Procedure sql_mode Create Procedure +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation bug2564_1 CREATE DEFINER=`root`@`localhost` PROCEDURE `bug2564_1`() COMMENT 'Joe''s procedure' -insert into `t1` values ("foo", 1) +insert into `t1` values ("foo", 1) latin1 latin1_swedish_ci latin1_swedish_ci show create procedure bug2564_2| -Procedure sql_mode Create Procedure +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation bug2564_2 ANSI_QUOTES CREATE DEFINER="root"@"localhost" PROCEDURE "bug2564_2"() -insert into "t1" values ('foo', 1) +insert into "t1" values ('foo', 1) latin1 latin1_swedish_ci latin1_swedish_ci show create function bug2564_3| -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation bug2564_3 CREATE DEFINER=`root`@`localhost` FUNCTION `bug2564_3`(x int, y int) RETURNS int(11) -return x || y +return x || y latin1 latin1_swedish_ci latin1_swedish_ci show create function bug2564_4| -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation bug2564_4 REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI CREATE DEFINER="root"@"localhost" FUNCTION "bug2564_4"(x int, y int) RETURNS int(11) -return x || y +return x || y latin1 latin1_swedish_ci latin1_swedish_ci drop procedure bug2564_1| drop procedure bug2564_2| drop function bug2564_3| @@ -3999,11 +3999,11 @@ main_loop: begin return 42; end */;; show create function bug14723;; -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation bug14723 CREATE DEFINER=`root`@`localhost` FUNCTION `bug14723`() RETURNS bigint(20) main_loop: begin return 42; -end +end latin1 latin1_swedish_ci latin1_swedish_ci select bug14723();; bug14723() 42 @@ -4012,11 +4012,11 @@ main_loop: begin select 42; end */;; show create procedure bug14723;; -Procedure sql_mode Create Procedure +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation bug14723 CREATE DEFINER=`root`@`localhost` PROCEDURE `bug14723`() main_loop: begin select 42; -end +end latin1 latin1_swedish_ci latin1_swedish_ci call bug14723();; 42 42 @@ -5071,21 +5071,21 @@ RETURN ""| CREATE FUNCTION mysqltest2.bug16211_f4() RETURNS CHAR(10) CHARSET koi8r RETURN ""| SHOW CREATE FUNCTION bug16211_f1| -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation bug16211_f1 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f1`() RETURNS char(10) CHARSET utf8 -RETURN "" +RETURN "" latin1 latin1_swedish_ci utf8_general_ci SHOW CREATE FUNCTION bug16211_f2| -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation bug16211_f2 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f2`() RETURNS char(10) CHARSET koi8r -RETURN "" +RETURN "" latin1 latin1_swedish_ci utf8_general_ci SHOW CREATE FUNCTION mysqltest2.bug16211_f3| -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation bug16211_f3 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f3`() RETURNS char(10) CHARSET utf8 -RETURN "" +RETURN "" latin1 latin1_swedish_ci utf8_general_ci SHOW CREATE FUNCTION mysqltest2.bug16211_f4| -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation bug16211_f4 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f4`() RETURNS char(10) CHARSET koi8r -RETURN "" +RETURN "" latin1 latin1_swedish_ci utf8_general_ci SELECT dtd_identifier FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA = "mysqltest1" AND ROUTINE_NAME = "bug16211_f1"| @@ -5121,21 +5121,21 @@ koi8r ALTER DATABASE mysqltest1 CHARACTER SET cp1251| ALTER DATABASE mysqltest2 CHARACTER SET cp1251| SHOW CREATE FUNCTION bug16211_f1| -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation bug16211_f1 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f1`() RETURNS char(10) CHARSET utf8 -RETURN "" +RETURN "" latin1 latin1_swedish_ci utf8_general_ci SHOW CREATE FUNCTION bug16211_f2| -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation bug16211_f2 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f2`() RETURNS char(10) CHARSET koi8r -RETURN "" +RETURN "" latin1 latin1_swedish_ci utf8_general_ci SHOW CREATE FUNCTION mysqltest2.bug16211_f3| -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation bug16211_f3 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f3`() RETURNS char(10) CHARSET utf8 -RETURN "" +RETURN "" latin1 latin1_swedish_ci utf8_general_ci SHOW CREATE FUNCTION mysqltest2.bug16211_f4| -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation bug16211_f4 CREATE DEFINER=`root`@`localhost` FUNCTION `bug16211_f4`() RETURNS char(10) CHARSET koi8r -RETURN "" +RETURN "" latin1 latin1_swedish_ci utf8_general_ci SELECT dtd_identifier FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA = "mysqltest1" AND ROUTINE_NAME = "bug16211_f1"| @@ -5380,9 +5380,9 @@ ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghi drop procedure if exists bug21416| create procedure bug21416() show create procedure bug21416| call bug21416()| -Procedure sql_mode Create Procedure +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation bug21416 CREATE DEFINER=`root`@`localhost` PROCEDURE `bug21416`() -show create procedure bug21416 +show create procedure bug21416 latin1 latin1_swedish_ci latin1_swedish_ci drop procedure bug21416| DROP PROCEDURE IF EXISTS bug21414| CREATE PROCEDURE bug21414() SELECT 1| @@ -5395,7 +5395,7 @@ DROP PROCEDURE bug21414| set names utf8| drop database if exists това_е_дълго_име_за_база_данни_нали| create database това_е_дълго_име_за_база_данни_нали| -INSERT INTO mysql.proc VALUES ('това_е_дълго_име_за_база_данни_нали','това_е_процедура_Ñ_доÑта_дълго_име_нали_и_още_по_дълго','PROCEDURE','това_е_процедура_Ñ_доÑта_дълго_име_нали_и_още_по_дълго','SQL','CONTAINS_SQL','NO','DEFINER','','','bad_body','root@localhost',now(), now(),'','')| +INSERT INTO mysql.proc VALUES ('това_е_дълго_име_за_база_данни_нали','това_е_процедура_Ñ_доÑта_дълго_име_нали_и_още_по_дълго','PROCEDURE','това_е_процедура_Ñ_доÑта_дълго_име_нали_и_още_по_дълго','SQL','CONTAINS_SQL','NO','DEFINER','','','bad_body','root@localhost',now(), now(),'','', 'utf8', 'utf8_general_ci', 'utf8_general_ci', 'n/a')| call това_е_дълго_име_за_база_данни_нали.това_е_процедура_Ñ_доÑта_дълго_име_нали_и_още_по_дълго()| ERROR HY000: Failed to load routine това_е_дълго_име_за_база_данни_нали.това_е_процедура_Ñ_доÑта_дълго_име_нали_и_още_по_дълго. The table mysql.proc is missing, corrupt, or contains bad data (internal code -6) drop database това_е_дълго_име_за_база_данни_нали| @@ -6240,9 +6240,9 @@ DROP FUNCTION bug5274_f2| drop procedure if exists proc_21513| create procedure proc_21513()`my_label`:BEGIN END| show create procedure proc_21513| -Procedure sql_mode Create Procedure +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation proc_21513 CREATE DEFINER=`root`@`localhost` PROCEDURE `proc_21513`() -`my_label`:BEGIN END +`my_label`:BEGIN END utf8 utf8_general_ci latin1_swedish_ci drop procedure proc_21513| End of 5.0 tests. drop table t1,t2; @@ -6276,8 +6276,8 @@ INSERT INTO t1 VALUES (1),(2); CREATE FUNCTION metered(a INT) RETURNS INT RETURN 12; CREATE VIEW v1 AS SELECT test.metered(a) as metered FROM t1; SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`metered`(`t1`.`a`) AS `metered` from `t1` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`metered`(`t1`.`a`) AS `metered` from `t1` utf8 utf8_general_ci DROP VIEW v1; DROP FUNCTION metered; DROP TABLE t1; @@ -6314,7 +6314,7 @@ select 1 /*!,2*/ /*!00000,3*/ /*!99999,4*/ ; end $$ show create procedure proc_25411_a; -Procedure sql_mode Create Procedure +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation proc_25411_a CREATE DEFINER=`root`@`localhost` PROCEDURE `proc_25411_a`() begin /* real comment */ @@ -6323,7 +6323,7 @@ select 1; select 3; select 4; -end +end utf8 utf8_general_ci latin1_swedish_ci call proc_25411_a(); 1 1 @@ -6334,7 +6334,7 @@ call proc_25411_a(); 4 4 show create procedure proc_25411_b; -Procedure sql_mode Create Procedure +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation proc_25411_b CREATE DEFINER=`root`@`localhost` PROCEDURE `proc_25411_b`( /* real comment */ p1 int, @@ -6343,7 +6343,7 @@ proc_25411_b CREATE DEFINER=`root`@`localhost` PROCEDURE `proc_25411_b`( ) begin select p1, p2; -end +end utf8 utf8_general_ci latin1_swedish_ci select name, param_list, body from mysql.proc where name like "%25411%"; name param_list body proc_25411_a begin @@ -6373,7 +6373,7 @@ call proc_25411_b(10, 20); p1 p2 10 20 show create procedure proc_25411_c; -Procedure sql_mode Create Procedure +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation proc_25411_c CREATE DEFINER=`root`@`localhost` PROCEDURE `proc_25411_c`() begin select 1,2,3; @@ -6381,7 +6381,7 @@ select 1 ,2 ,3; select 1,2 ,3 ; select 1 ,2 ,3 ; select 1 ,2 ,3 ; -end +end utf8 utf8_general_ci latin1_swedish_ci call proc_25411_c(); 1 2 3 1 2 3 @@ -6400,9 +6400,9 @@ drop procedure if exists proc_26302; create procedure proc_26302() select 1 /* testing */; show create procedure proc_26302; -Procedure sql_mode Create Procedure +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation proc_26302 CREATE DEFINER=`root`@`localhost` PROCEDURE `proc_26302`() -select 1 /* testing */ +select 1 /* testing */ utf8 utf8_general_ci latin1_swedish_ci select ROUTINE_NAME, ROUTINE_DEFINITION from information_schema.ROUTINES where ROUTINE_NAME = "proc_26302"; ROUTINE_NAME ROUTINE_DEFINITION diff --git a/mysql-test/r/sql_mode.result b/mysql-test/r/sql_mode.result index 9998a51fdc8..2b34ff8c021 100644 --- a/mysql-test/r/sql_mode.result +++ b/mysql-test/r/sql_mode.result @@ -426,37 +426,37 @@ a\b a\'b a"\b a"\'b SET @@SQL_MODE=''; create function `foo` () returns int return 5; show create function `foo`; -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation foo CREATE DEFINER=`root`@`localhost` FUNCTION `foo`() RETURNS int(11) -return 5 +return 5 latin1 latin1_swedish_ci latin1_swedish_ci SET @@SQL_MODE='ANSI_QUOTES'; show create function `foo`; -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation foo CREATE DEFINER=`root`@`localhost` FUNCTION `foo`() RETURNS int(11) -return 5 +return 5 latin1 latin1_swedish_ci latin1_swedish_ci drop function `foo`; create function `foo` () returns int return 5; show create function `foo`; -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation foo ANSI_QUOTES CREATE DEFINER="root"@"localhost" FUNCTION "foo"() RETURNS int(11) -return 5 +return 5 latin1 latin1_swedish_ci latin1_swedish_ci SET @@SQL_MODE=''; show create function `foo`; -Function sql_mode Create Function +Function sql_mode Create Function character_set_client collation_connection Database Collation foo ANSI_QUOTES CREATE DEFINER="root"@"localhost" FUNCTION "foo"() RETURNS int(11) -return 5 +return 5 latin1 latin1_swedish_ci latin1_swedish_ci drop function `foo`; SET @@SQL_MODE=''; create table t1 (a int); create table t2 (a int); create view v1 as select a from t1; show create view v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` latin1 latin1_swedish_ci SET @@SQL_MODE='ANSI_QUOTES'; show create view v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER="root"@"localhost" SQL SECURITY DEFINER VIEW "v1" AS select "t1"."a" AS "a" from "t1" +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER="root"@"localhost" SQL SECURITY DEFINER VIEW "v1" AS select "t1"."a" AS "a" from "t1" latin1 latin1_swedish_ci create view v2 as select a from t2 where a in (select a from v1); drop view v2, v1; drop table t1, t2; diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 92cd58f2ba3..40b9e489577 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -4106,6 +4106,39 @@ d1 1 1 DROP TABLE t1,t2; +CREATE TABLE t1 (a INTEGER, b INTEGER); +CREATE TABLE t2 (x INTEGER); +INSERT INTO t1 VALUES (1,11), (2,22), (2,22); +INSERT INTO t2 VALUES (1), (2); +SELECT a, COUNT(b), (SELECT COUNT(b) FROM t2) FROM t1 GROUP BY a; +ERROR 21000: Subquery returns more than 1 row +SELECT a, COUNT(b), (SELECT COUNT(b)+0 FROM t2) FROM t1 GROUP BY a; +ERROR 21000: Subquery returns more than 1 row +SELECT (SELECT SUM(t1.a)/AVG(t2.x) FROM t2) FROM t1; +(SELECT SUM(t1.a)/AVG(t2.x) FROM t2) +3.3333 +DROP TABLE t1,t2; +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1, 2), (1,3), (1,4), (2,1), (2,2); +SELECT a1.a, COUNT(*) FROM t1 a1 WHERE a1.a = 1 +AND EXISTS( SELECT a2.a FROM t1 a2 WHERE a2.a = a1.a) +GROUP BY a1.a; +a COUNT(*) +1 3 +DROP TABLE t1; +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a INT); +INSERT INTO t1 VALUES (1),(2); +INSERT INTO t2 VALUES (1),(2); +SELECT (SELECT SUM(t1.a) FROM t2 WHERE a=0) FROM t1; +(SELECT SUM(t1.a) FROM t2 WHERE a=0) +NULL +SELECT (SELECT SUM(t1.a) FROM t2 WHERE a!=0) FROM t1; +ERROR 21000: Subquery returns more than 1 row +SELECT (SELECT SUM(t1.a) FROM t2 WHERE a=1) FROM t1; +(SELECT SUM(t1.a) FROM t2 WHERE a=1) +3 +DROP TABLE t1,t2; End of 5.0 tests. CREATE TABLE t1 (a int, b int); INSERT INTO t1 VALUES (2,22),(1,11),(2,22); diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result index 5acbace480a..7696afdf06d 100644 --- a/mysql-test/r/system_mysql_db.result +++ b/mysql-test/r/system_mysql_db.result @@ -203,6 +203,10 @@ proc CREATE TABLE `proc` ( `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') NOT NULL DEFAULT '', `comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', + `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, + `body_utf8` longblob, PRIMARY KEY (`db`,`name`,`type`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Stored Procedures' show create table event; @@ -226,6 +230,10 @@ event CREATE TABLE `event` ( `comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', `originator` int(10) NOT NULL, `time_zone` char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', + `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, + `body_utf8` longblob, PRIMARY KEY (`db`,`name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Events' show create table general_log; diff --git a/mysql-test/r/temp_table.result b/mysql-test/r/temp_table.result index 9cb4a6b2427..46724de4281 100644 --- a/mysql-test/r/temp_table.result +++ b/mysql-test/r/temp_table.result @@ -111,8 +111,8 @@ v1 CREATE TEMPORARY TABLE `v1` ( `A` varchar(19) NOT NULL DEFAULT '' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show create view v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _latin1'This is view' AS `A` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _latin1'This is view' AS `A` latin1 latin1_swedish_ci drop view v1; select * from v1; A diff --git a/mysql-test/r/trigger-compat.result b/mysql-test/r/trigger-compat.result index 068bf6c6968..1609707fb09 100644 --- a/mysql-test/r/trigger-compat.result +++ b/mysql-test/r/trigger-compat.result @@ -32,9 +32,9 @@ Warnings: Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'wl2818_trg1'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger. SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name; -TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER -NULL mysqltest_db1 wl2818_trg1 INSERT NULL mysqltest_db1 t1 0 NULL INSERT INTO t2 VALUES(CURRENT_USER()) ROW BEFORE NULL NULL OLD NEW NULL -NULL mysqltest_db1 wl2818_trg2 INSERT NULL mysqltest_db1 t1 0 NULL INSERT INTO t2 VALUES(CURRENT_USER()) ROW AFTER NULL NULL OLD NEW NULL mysqltest_dfn@localhost +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest_db1 wl2818_trg1 INSERT NULL mysqltest_db1 t1 0 NULL INSERT INTO t2 VALUES(CURRENT_USER()) ROW BEFORE NULL NULL OLD NEW NULL latin1 latin1_swedish_ci latin1_swedish_ci +NULL mysqltest_db1 wl2818_trg2 INSERT NULL mysqltest_db1 t1 0 NULL INSERT INTO t2 VALUES(CURRENT_USER()) ROW AFTER NULL NULL OLD NEW NULL mysqltest_dfn@localhost latin1 latin1_swedish_ci latin1_swedish_ci DROP TRIGGER wl2818_trg1; Warnings: Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'wl2818_trg1'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger. diff --git a/mysql-test/r/trigger-grant.result b/mysql-test/r/trigger-grant.result index 49c36513fbc..14b8c98f2fa 100644 --- a/mysql-test/r/trigger-grant.result +++ b/mysql-test/r/trigger-grant.result @@ -137,9 +137,9 @@ Note 1449 There is no 'mysqltest_nonexs'@'localhost' registered INSERT INTO t1 VALUES(6); ERROR HY000: There is no 'mysqltest_nonexs'@'localhost' registered SHOW TRIGGERS; -Trigger Event Table Statement Timing Created sql_mode Definer -trg1 INSERT t1 SET @new_sum = 0 BEFORE NULL mysqltest_inv@localhost -trg2 INSERT t1 SET @new_sum = 0 AFTER NULL mysqltest_nonexs@localhost +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +trg1 INSERT t1 SET @new_sum = 0 BEFORE NULL mysqltest_inv@localhost latin1 latin1_swedish_ci latin1_swedish_ci +trg2 INSERT t1 SET @new_sum = 0 AFTER NULL mysqltest_nonexs@localhost latin1 latin1_swedish_ci latin1_swedish_ci DROP TRIGGER trg1; DROP TRIGGER trg2; CREATE TRIGGER trg1 BEFORE INSERT ON t1 @@ -169,12 +169,12 @@ Warnings: Warning 1454 No definer attribute for trigger 'mysqltest_db1'.'trg1'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger. SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name; -TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER -NULL mysqltest_db1 trg1 INSERT NULL mysqltest_db1 t1 0 NULL SET @a = 1 ROW BEFORE NULL NULL OLD NEW NULL -NULL mysqltest_db1 trg2 INSERT NULL mysqltest_db1 t1 0 NULL SET @a = 2 ROW AFTER NULL NULL OLD NEW NULL @ -NULL mysqltest_db1 trg3 UPDATE NULL mysqltest_db1 t1 0 NULL SET @a = 3 ROW BEFORE NULL NULL OLD NEW NULL @abc@def@@ -NULL mysqltest_db1 trg4 UPDATE NULL mysqltest_db1 t1 0 NULL SET @a = 4 ROW AFTER NULL NULL OLD NEW NULL @hostname -NULL mysqltest_db1 trg5 DELETE NULL mysqltest_db1 t1 0 NULL SET @a = 5 ROW BEFORE NULL NULL OLD NEW NULL @abcdef@@@hostname +TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION +NULL mysqltest_db1 trg1 INSERT NULL mysqltest_db1 t1 0 NULL SET @a = 1 ROW BEFORE NULL NULL OLD NEW NULL latin1 latin1_swedish_ci latin1_swedish_ci +NULL mysqltest_db1 trg2 INSERT NULL mysqltest_db1 t1 0 NULL SET @a = 2 ROW AFTER NULL NULL OLD NEW NULL @ latin1 latin1_swedish_ci latin1_swedish_ci +NULL mysqltest_db1 trg3 UPDATE NULL mysqltest_db1 t1 0 NULL SET @a = 3 ROW BEFORE NULL NULL OLD NEW NULL @abc@def@@ latin1 latin1_swedish_ci latin1_swedish_ci +NULL mysqltest_db1 trg4 UPDATE NULL mysqltest_db1 t1 0 NULL SET @a = 4 ROW AFTER NULL NULL OLD NEW NULL @hostname latin1 latin1_swedish_ci latin1_swedish_ci +NULL mysqltest_db1 trg5 DELETE NULL mysqltest_db1 t1 0 NULL SET @a = 5 ROW BEFORE NULL NULL OLD NEW NULL @abcdef@@@hostname latin1 latin1_swedish_ci latin1_swedish_ci ---> connection: default DROP USER mysqltest_dfn@localhost; diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result index ecaef458e92..f901fd783e8 100644 --- a/mysql-test/r/trigger.result +++ b/mysql-test/r/trigger.result @@ -600,9 +600,9 @@ select @a; @a 10 show triggers; -Trigger Event Table Statement Timing Created sql_mode Definer -t1_bi INSERT t1 set new."t1 column" = 5 BEFORE # REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI root@localhost -t1_af INSERT t1 set @a=10 AFTER # root@localhost +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +t1_bi INSERT t1 set new."t1 column" = 5 BEFORE # REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +t1_af INSERT t1 set @a=10 AFTER # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci drop table t1; set sql_mode="traditional"; create table t1 (a date); @@ -622,8 +622,8 @@ t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 show triggers; -Trigger Event Table Statement Timing Created sql_mode Definer -t1_bi INSERT t1 set new.a = '2004-01-00' BEFORE # root@localhost +Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation +t1_bi INSERT t1 set new.a = '2004-01-00' BEFORE # root@localhost latin1 latin1_swedish_ci latin1_swedish_ci drop table t1; create table t1 (id int); create trigger t1_ai after insert on t1 for each row reset query cache; diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result index fe63ad6d69e..9535e6dd18a 100644 --- a/mysql-test/r/type_enum.result +++ b/mysql-test/r/type_enum.result @@ -1754,14 +1754,6 @@ t1 CREATE TABLE `t1` ( `f2` enum('ÿÿ') DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; -End of 4.1 tests -create table t1(f1 set('a','b'), index(f1)); -insert into t1 values(''),(''),('a'),('b'); -select * from t1 where f1=''; -f1 - - -drop table t1; create table t1(russian enum('E','F','EÿF','FÿE') NOT NULL DEFAULT'E'); show create table t1; Table Create Table @@ -1786,4 +1778,35 @@ drop table t1; create table t1(exhausting_charset enum('ABCDEFGHIJKLMNOPQRSTUVWXYZ','
!"','#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~','xx\','yy\€','zz‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ')); ERROR 42000: Field separator argument is not what is expected; check the manual +CREATE TABLE t1 ( +id INT AUTO_INCREMENT PRIMARY KEY, +c1 ENUM('a', '', 'b') +); +INSERT INTO t1 (c1) VALUES (0), ('a'), (''), ('b'); +Warnings: +Warning 1265 Data truncated for column 'c1' at row 1 +SELECT id, c1 + 0, c1 FROM t1; +id c1 + 0 c1 +1 0 +2 1 a +3 2 +4 3 b +ALTER TABLE t1 CHANGE c1 c1 ENUM('a', '') NOT NULL; +Warnings: +Warning 1265 Data truncated for column 'c1' at row 4 +SELECT id, c1 + 0, c1 FROM t1; +id c1 + 0 c1 +1 0 +2 1 a +3 2 +4 0 +DROP TABLE t1; +End of 4.1 tests +create table t1(f1 set('a','b'), index(f1)); +insert into t1 values(''),(''),('a'),('b'); +select * from t1 where f1=''; +f1 + + +drop table t1; End of 5.1 tests diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 88e12e26c4a..cfad70a9bb5 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -37,11 +37,11 @@ c 6 11 show create table v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (`t1`.`b` + 1) AS `c` from `t1` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci show create view v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (`t1`.`b` + 1) AS `c` from `t1` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci show create view t1; ERROR HY000: 'test.t1' is not VIEW drop table t1; @@ -60,8 +60,8 @@ Warnings: Note 1003 select (`test`.`t1`.`b` + 1) AS `c` from `test`.`t1` create algorithm=temptable view v2 (c) as select b+1 from t1; show create view v2; -View Create View -v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select (`t1`.`b` + 1) AS `c` from `t1` +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select (`t1`.`b` + 1) AS `c` from `t1` latin1 latin1_swedish_ci select c from v2; c 3 @@ -576,8 +576,8 @@ set sql_mode='ansi'; create table t1 ("a*b" int); create view v1 as select "a*b" from t1; show create view v1; -View Create View -v1 CREATE VIEW "v1" AS select "t1"."a*b" AS "a*b" from "t1" +View Create View character_set_client collation_connection +v1 CREATE VIEW "v1" AS select "t1"."a*b" AS "a*b" from "t1" latin1 latin1_swedish_ci drop view v1; drop table t1; set sql_mode=default; @@ -682,8 +682,8 @@ drop view v1; drop table t1; CREATE VIEW v1 (f1,f2,f3,f4) AS SELECT connection_id(), pi(), current_user(), version(); SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select connection_id() AS `f1`,pi() AS `f2`,current_user() AS `f3`,version() AS `f4` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select connection_id() AS `f1`,pi() AS `f2`,current_user() AS `f3`,version() AS `f4` latin1 latin1_swedish_ci drop view v1; create table t1 (s1 int); create table t2 (s2 int); @@ -716,14 +716,14 @@ create table t2 (a int); create view v1 as select a from t1; create view v2 as select a from t2 where a in (select a from v1); show create view v2; -View Create View -v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where `t2`.`a` in (select `v1`.`a` AS `a` from `v1`) +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where `t2`.`a` in (select `v1`.`a` AS `a` from `v1`) latin1 latin1_swedish_ci drop view v2, v1; drop table t1, t2; CREATE VIEW `v 1` AS select 5 AS `5`; show create view `v 1`; -View Create View -v 1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v 1` AS select 5 AS `5` +View Create View character_set_client collation_connection +v 1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v 1` AS select 5 AS `5` latin1 latin1_swedish_ci drop view `v 1`; create database mysqltest; create table mysqltest.t1 (a int, b int); @@ -790,15 +790,15 @@ select * from v3; a b 1 1 show create view v3; -View Create View -v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `v1`.`col1` AS `a`,`v2`.`col1` AS `b` from (`v1` join `v2`) where (`v1`.`col1` = `v2`.`col1`) +View Create View character_set_client collation_connection +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `v1`.`col1` AS `a`,`v2`.`col1` AS `b` from (`v1` join `v2`) where (`v1`.`col1` = `v2`.`col1`) latin1 latin1_swedish_ci drop view v3, v2, v1; drop table t2, t1; create function `f``1` () returns int return 5; create view v1 as select test.`f``1` (); show create view v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`f``1`() AS `test.``f````1`` ()` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`f``1`() AS `test.``f````1`` ()` latin1 latin1_swedish_ci select * from v1; test.`f``1` () 5 @@ -814,11 +814,11 @@ drop function a; create table t2 (col1 char collate latin1_german2_ci); create view v2 as select col1 collate latin1_german1_ci from t2; show create view v2; -View Create View -v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select (`t2`.`col1` collate latin1_german1_ci) AS `col1 collate latin1_german1_ci` from `t2` +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select (`t2`.`col1` collate latin1_german1_ci) AS `col1 collate latin1_german1_ci` from `t2` latin1 latin1_swedish_ci show create view v2; -View Create View -v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select (`t2`.`col1` collate latin1_german1_ci) AS `col1 collate latin1_german1_ci` from `t2` +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select (`t2`.`col1` collate latin1_german1_ci) AS `col1 collate latin1_german1_ci` from `t2` latin1 latin1_swedish_ci drop view v2; drop table t2; create table t1 (a int); @@ -844,9 +844,12 @@ drop view v1; drop table t1; create view v1 as select 99999999999999999999999999999999999999999999999999999 as col1; show create view v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 99999999999999999999999999999999999999999999999999999 AS `col1` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 99999999999999999999999999999999999999999999999999999 AS `col1` latin1 latin1_swedish_ci drop view v1; +SET @old_cs_client = @@character_set_client; +SET @old_cs_results = @@character_set_results; +SET @old_cs_connection = @@character_set_connection; set names utf8; create table tü (cü char); create view vü as select cü from tü; @@ -856,7 +859,9 @@ cü ü drop view vü; drop table tü; -set names latin1; +SET character_set_client = @old_cs_client; +SET character_set_results = @old_cs_results; +SET character_set_connection = @old_cs_connection; create table t1 (a int, b int); insert into t1 values (1,2), (1,3), (2,4), (2,5), (3,10); create view v1(c) as select a+1 from t1 where b >= 4; @@ -867,8 +872,8 @@ drop view v1; drop table t1; create view v1 as select cast(1 as char(3)); show create view v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(1 as char(3) charset latin1) AS `cast(1 as char(3))` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(1 as char(3) charset latin1) AS `cast(1 as char(3))` latin1 latin1_swedish_ci select * from v1; cast(1 as char(3)) 1 @@ -1199,20 +1204,20 @@ drop table t1; create table t1 (a int); create view v1 as select * from t1; show create view v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` latin1 latin1_swedish_ci alter algorithm=undefined view v1 as select * from t1 with check option; show create view v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` WITH CASCADED CHECK OPTION +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` WITH CASCADED CHECK OPTION latin1 latin1_swedish_ci alter algorithm=merge view v1 as select * from t1 with cascaded check option; show create view v1; -View Create View -v1 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` WITH CASCADED CHECK OPTION +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` WITH CASCADED CHECK OPTION latin1 latin1_swedish_ci alter algorithm=temptable view v1 as select * from t1; show create view v1; -View Create View -v1 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` latin1 latin1_swedish_ci drop view v1; drop table t1; create table t1 (s1 int); @@ -1885,25 +1890,25 @@ create table t1 (a timestamp default now()); create table t2 (b timestamp default now()); create view v1 as select a,b,t1.a < now() from t1,t2 where t1.a < now(); SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,`t2`.`b` AS `b`,(`t1`.`a` < now()) AS `t1.a < now()` from (`t1` join `t2`) where (`t1`.`a` < now()) +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a`,`t2`.`b` AS `b`,(`t1`.`a` < now()) AS `t1.a < now()` from (`t1` join `t2`) where (`t1`.`a` < now()) latin1 latin1_swedish_ci drop view v1; drop table t1, t2; CREATE TABLE t1 ( a varchar(50) ); CREATE VIEW v1 AS SELECT * FROM t1 WHERE a = CURRENT_USER(); SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` = current_user()) +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` = current_user()) latin1 latin1_swedish_ci DROP VIEW v1; CREATE VIEW v1 AS SELECT * FROM t1 WHERE a = VERSION(); SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` = version()) +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` = version()) latin1 latin1_swedish_ci DROP VIEW v1; CREATE VIEW v1 AS SELECT * FROM t1 WHERE a = DATABASE(); SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` = database()) +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` = database()) latin1 latin1_swedish_ci DROP VIEW v1; DROP TABLE t1; CREATE TABLE t1 (col1 time); @@ -2005,8 +2010,8 @@ drop table t1; create table t1 (s1 int); create view v1 as select var_samp(s1) from t1; show create view v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select var_samp(`t1`.`s1`) AS `var_samp(s1)` from `t1` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select var_samp(`t1`.`s1`) AS `var_samp(s1)` from `t1` latin1 latin1_swedish_ci drop view v1; drop table t1; set sql_mode='strict_all_tables'; @@ -2251,16 +2256,16 @@ CREATE TABLE t1 (date DATE NOT NULL); INSERT INTO t1 VALUES ('2005-09-06'); CREATE VIEW v1 AS SELECT DAYNAME(date) FROM t1; SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select dayname(`t1`.`date`) AS `DAYNAME(date)` from `t1` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select dayname(`t1`.`date`) AS `DAYNAME(date)` from `t1` latin1 latin1_swedish_ci CREATE VIEW v2 AS SELECT DAYOFWEEK(date) FROM t1; SHOW CREATE VIEW v2; -View Create View -v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select dayofweek(`t1`.`date`) AS `DAYOFWEEK(date)` from `t1` +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select dayofweek(`t1`.`date`) AS `DAYOFWEEK(date)` from `t1` latin1 latin1_swedish_ci CREATE VIEW v3 AS SELECT WEEKDAY(date) FROM t1; SHOW CREATE VIEW v3; -View Create View -v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select weekday(`t1`.`date`) AS `WEEKDAY(date)` from `t1` +View Create View character_set_client collation_connection +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select weekday(`t1`.`date`) AS `WEEKDAY(date)` from `t1` latin1 latin1_swedish_ci SELECT DAYNAME('2005-09-06'); DAYNAME('2005-09-06') Tuesday @@ -2419,13 +2424,13 @@ test.v1 repair error Corrupt DROP VIEW v1; create definer = current_user() sql security invoker view v1 as select 1; show create view v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `v1` AS select 1 AS `1` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `v1` AS select 1 AS `1` latin1 latin1_swedish_ci drop view v1; create definer = current_user sql security invoker view v1 as select 1; show create view v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `v1` AS select 1 AS `1` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `v1` AS select 1 AS `1` latin1 latin1_swedish_ci drop view v1; create table t1 (id INT, primary key(id)); insert into t1 values (1),(2); @@ -2454,8 +2459,8 @@ end; // call p1(); show create view v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `1` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `1` latin1 latin1_swedish_ci drop view v1; drop procedure p1; CREATE VIEW v1 AS SELECT 42 AS Meaning; @@ -2560,8 +2565,8 @@ drop table t1; show create view v1; drop view v1; // -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`id` AS `id` from `t1` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`id` AS `id` from `t1` latin1 latin1_swedish_ci create table t1(f1 int, f2 int); create view v1 as select ta.f1 as a, tb.f1 as b from t1 ta, t1 tb where ta.f1=tb .f1 and ta.f2=tb.f2; @@ -2677,8 +2682,8 @@ CREATE VIEW v1 AS SELECT id, date(d) + INTERVAL TIME_TO_SEC(d) SECOND AS t, COUNT(*) FROM t1 GROUP BY id, t; SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`id` AS `id`,(cast(`t1`.`d` as date) + interval time_to_sec(`t1`.`d`) second) AS `t`,count(0) AS `COUNT(*)` from `t1` group by `t1`.`id`,(cast(`t1`.`d` as date) + interval time_to_sec(`t1`.`d`) second) +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`id` AS `id`,(cast(`t1`.`d` as date) + interval time_to_sec(`t1`.`d`) second) AS `t`,count(0) AS `COUNT(*)` from `t1` group by `t1`.`id`,(cast(`t1`.`d` as date) + interval time_to_sec(`t1`.`d`) second) latin1 latin1_swedish_ci SELECT * FROM v1; id t COUNT(*) DROP VIEW v1; @@ -2705,8 +2710,8 @@ CREATE VIEW v1 AS SELECT (year(now())-year(DOB)) AS Age FROM t1 HAVING Age < 75; SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (year(now()) - year(`t1`.`DOB`)) AS `Age` from `t1` having (`Age` < 75) +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (year(now()) - year(`t1`.`DOB`)) AS `Age` from `t1` having (`Age` < 75) latin1 latin1_swedish_ci set timestamp=1136066400; SELECT (year(now())-year(DOB)) AS Age FROM t1 HAVING Age < 75; Age @@ -2835,12 +2840,12 @@ DROP TABLE t1; CREATE TABLE t1 (x INT, y INT); CREATE ALGORITHM=TEMPTABLE SQL SECURITY INVOKER VIEW v1 AS SELECT x FROM t1; SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `v1` AS select `t1`.`x` AS `x` from `t1` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `v1` AS select `t1`.`x` AS `x` from `t1` latin1 latin1_swedish_ci ALTER VIEW v1 AS SELECT x, y FROM t1; SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `v1` AS select `t1`.`x` AS `x`,`t1`.`y` AS `y` from `t1` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY INVOKER VIEW `v1` AS select `t1`.`x` AS `x`,`t1`.`y` AS `y` from `t1` latin1 latin1_swedish_ci DROP VIEW v1; DROP TABLE t1; CREATE TABLE t1 (s1 char); @@ -2900,8 +2905,8 @@ USE test; create table t1 (f1 datetime); create view v1 as select * from t1 where f1 between now() and now() + interval 1 minute; show create view v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` where (`t1`.`f1` between now() and (now() + interval 1 minute)) +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` where (`t1`.`f1` between now() and (now() + interval 1 minute)) latin1 latin1_swedish_ci drop view v1; drop table t1; DROP TABLE IF EXISTS t1; @@ -2977,8 +2982,8 @@ t2.ver = (SELECT MAX(t.ver) FROM t2 t WHERE t.org = t2.org); SHOW WARNINGS; Level Code Message SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`pk` AS `pk` from (`t1` join `t2` on(((`t2`.`fk` = `t1`.`pk`) and (`t2`.`ver` = (select max(`t`.`ver`) AS `MAX(t.ver)` from `t2` `t` where (`t`.`org` = `t2`.`org`)))))) +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=MERGE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`pk` AS `pk` from (`t1` join `t2` on(((`t2`.`fk` = `t1`.`pk`) and (`t2`.`ver` = (select max(`t`.`ver`) AS `MAX(t.ver)` from `t2` `t` where (`t`.`org` = `t2`.`org`)))))) latin1 latin1_swedish_ci DROP VIEW v1; DROP TABLE t1, t2; DROP FUNCTION IF EXISTS f1; @@ -3041,8 +3046,8 @@ DROP VIEW v1, v2; DROP TABLE t1; CREATE VIEW v AS SELECT !0 * 5 AS x FROM DUAL; SHOW CREATE VIEW v; -View Create View -v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select ((not(0)) * 5) AS `x` +View Create View character_set_client collation_connection +v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select ((not(0)) * 5) AS `x` latin1 latin1_swedish_ci SELECT !0 * 5 AS x FROM DUAL; x 5 @@ -3056,8 +3061,8 @@ SELECT * FROM v1; TheEnd TheEnd SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _latin1'The\ZEnd' AS `TheEnd` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select _latin1'The\ZEnd' AS `TheEnd` latin1 latin1_swedish_ci DROP VIEW v1; CREATE TABLE t1 (mydate DATETIME); INSERT INTO t1 VALUES @@ -3278,8 +3283,8 @@ old_isfalse int(1) NO 0 a IS NOT FALSE int(1) NO 0 old_isnotfalse int(1) NO 0 show create view view_24532_b; -View Create View -view_24532_b CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_24532_b` AS select (`table_24532`.`a` is true) AS `a IS TRUE`,if(ifnull(`table_24532`.`a`,0),1,0) AS `old_istrue`,(`table_24532`.`a` is not true) AS `a IS NOT TRUE`,if(ifnull(`table_24532`.`a`,0),0,1) AS `old_isnottrue`,(`table_24532`.`a` is false) AS `a IS FALSE`,if(ifnull(`table_24532`.`a`,1),0,1) AS `old_isfalse`,(`table_24532`.`a` is not false) AS `a IS NOT FALSE`,if(ifnull(`table_24532`.`a`,1),1,0) AS `old_isnotfalse` from `table_24532` +View Create View character_set_client collation_connection +view_24532_b CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_24532_b` AS select (`table_24532`.`a` is true) AS `a IS TRUE`,if(ifnull(`table_24532`.`a`,0),1,0) AS `old_istrue`,(`table_24532`.`a` is not true) AS `a IS NOT TRUE`,if(ifnull(`table_24532`.`a`,0),0,1) AS `old_isnottrue`,(`table_24532`.`a` is false) AS `a IS FALSE`,if(ifnull(`table_24532`.`a`,1),0,1) AS `old_isfalse`,(`table_24532`.`a` is not false) AS `a IS NOT FALSE`,if(ifnull(`table_24532`.`a`,1),1,0) AS `old_isnotfalse` from `table_24532` latin1 latin1_swedish_ci insert into table_24532 values (0, 0, 0, 0); select * from view_24532_b; a IS TRUE old_istrue a IS NOT TRUE old_isnottrue a IS FALSE old_isfalse a IS NOT FALSE old_isnotfalse @@ -3377,8 +3382,8 @@ col decimal(7,5) NO 0.00000 DROP VIEW v1; CREATE VIEW v1 AS SELECT CAST(1.23456789 AS DECIMAL(8,0)) AS col; SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(1.23456789 as decimal(8,0)) AS `col` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(1.23456789 as decimal(8,0)) AS `col` latin1 latin1_swedish_ci DROP VIEW v1; CREATE TABLE t1 (a INT); CREATE TABLE t2 (b INT, c INT DEFAULT 0); diff --git a/mysql-test/r/view_grant.result b/mysql-test/r/view_grant.result index 0a32b3b3fcd..49c98d8e03f 100644 --- a/mysql-test/r/view_grant.result +++ b/mysql-test/r/view_grant.result @@ -27,8 +27,8 @@ ERROR 42000: CREATE VIEW command denied to user 'mysqltest_1'@'localhost' for ta create view v2 as select * from mysqltest.t2; ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for table 't2' show create view v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1` latin1 latin1_swedish_ci grant create view,drop,select on test.* to mysqltest_1@localhost; use test; alter view v1 as select * from mysqltest.t1; @@ -127,28 +127,28 @@ explain select c from mysqltest.v1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 system NULL NULL NULL NULL 0 const row not found show create view mysqltest.v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v1` AS select (`mysqltest`.`t1`.`a` + 1) AS `c`,(`mysqltest`.`t1`.`b` + 1) AS `d` from `mysqltest`.`t1` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v1` AS select (`mysqltest`.`t1`.`a` + 1) AS `c`,(`mysqltest`.`t1`.`b` + 1) AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci explain select c from mysqltest.v2; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY <derived2> system NULL NULL NULL NULL 0 const row not found 2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table show create view mysqltest.v2; -View Create View -v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v2` AS select (`mysqltest`.`t1`.`a` + 1) AS `c`,(`mysqltest`.`t1`.`b` + 1) AS `d` from `mysqltest`.`t1` +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v2` AS select (`mysqltest`.`t1`.`a` + 1) AS `c`,(`mysqltest`.`t1`.`b` + 1) AS `d` from `mysqltest`.`t1` latin1 latin1_swedish_ci explain select c from mysqltest.v3; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 system NULL NULL NULL NULL 0 const row not found show create view mysqltest.v3; -View Create View -v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v3` AS select (`mysqltest`.`t2`.`a` + 1) AS `c`,(`mysqltest`.`t2`.`b` + 1) AS `d` from `mysqltest`.`t2` +View Create View character_set_client collation_connection +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v3` AS select (`mysqltest`.`t2`.`a` + 1) AS `c`,(`mysqltest`.`t2`.`b` + 1) AS `d` from `mysqltest`.`t2` latin1 latin1_swedish_ci explain select c from mysqltest.v4; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY <derived2> system NULL NULL NULL NULL 0 const row not found 2 DERIVED NULL NULL NULL NULL NULL NULL NULL no matching row in const table show create view mysqltest.v4; -View Create View -v4 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v4` AS select (`mysqltest`.`t2`.`a` + 1) AS `c`,(`mysqltest`.`t2`.`b` + 1) AS `d` from `mysqltest`.`t2` +View Create View character_set_client collation_connection +v4 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest`.`v4` AS select (`mysqltest`.`t2`.`a` + 1) AS `c`,(`mysqltest`.`t2`.`b` + 1) AS `d` from `mysqltest`.`t2` latin1 latin1_swedish_ci revoke all privileges on mysqltest.* from mysqltest_1@localhost; delete from mysql.user where user='mysqltest_1'; drop database mysqltest; @@ -308,8 +308,8 @@ grant select on mysqltest.t1 to mysqltest_1@localhost; grant create view,select on test.* to mysqltest_1@localhost; create view v1 as select * from mysqltest.t1; show create view v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1` latin1 latin1_swedish_ci revoke select on mysqltest.t1 from mysqltest_1@localhost; select * from v1; ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them @@ -476,15 +476,15 @@ grant all on test.* to 'test14256'@'%'; use test; create view v1 as select 42; show create view v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`test14256`@`%` SQL SECURITY DEFINER VIEW `v1` AS select 42 AS `42` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`test14256`@`%` SQL SECURITY DEFINER VIEW `v1` AS select 42 AS `42` latin1 latin1_swedish_ci select definer into @v1def1 from information_schema.views where table_schema = 'test' and table_name='v1'; drop view v1; create definer=`test14256`@`%` view v1 as select 42; show create view v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`test14256`@`%` SQL SECURITY DEFINER VIEW `v1` AS select 42 AS `42` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`test14256`@`%` SQL SECURITY DEFINER VIEW `v1` AS select 42 AS `42` latin1 latin1_swedish_ci select definer into @v1def2 from information_schema.views where table_schema = 'test' and table_name='v1'; drop view v1; @@ -500,8 +500,8 @@ use mysqltest; CREATE TABLE t1 (i INT); CREATE VIEW v1 AS SELECT * FROM t1; SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci GRANT SELECT, LOCK TABLES ON mysqltest.* TO mysqltest_1@localhost; use mysqltest; LOCK TABLES v1 READ; @@ -519,11 +519,11 @@ create definer=some_user@localhost sql security invoker view v2 as select 1; Warnings: Note 1449 There is no 'some_user'@'localhost' registered show create view v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`some_user`@`` SQL SECURITY INVOKER VIEW `v1` AS select 1 AS `1` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`some_user`@`` SQL SECURITY INVOKER VIEW `v1` AS select 1 AS `1` latin1 latin1_swedish_ci show create view v2; -View Create View -v2 CREATE ALGORITHM=UNDEFINED DEFINER=`some_user`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select 1 AS `1` +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`some_user`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select 1 AS `1` latin1 latin1_swedish_ci drop view v1; drop view v2; CREATE DATABASE mysqltest1; @@ -602,8 +602,8 @@ CREATE DEFINER = 'no-such-user'@localhost VIEW v AS SELECT a from t1; Warnings: Note 1449 There is no 'no-such-user'@'localhost' registered SHOW CREATE VIEW v; -View Create View -v CREATE ALGORITHM=UNDEFINED DEFINER=`no-such-user`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `test`.`t1`.`a` AS `a` from `t1` +View Create View character_set_client collation_connection +v CREATE ALGORITHM=UNDEFINED DEFINER=`no-such-user`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `test`.`t1`.`a` AS `a` from `t1` latin1 latin1_swedish_ci Warnings: Warning 1356 View 'test.v' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them SELECT * FROM v; @@ -619,14 +619,14 @@ CREATE TABLE t1 (f1 INTEGER); CREATE VIEW view1 AS SELECT * FROM t1; SHOW CREATE VIEW view1; -View Create View -view1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_db1`@`localhost` SQL SECURITY DEFINER VIEW `view1` AS select `t1`.`f1` AS `f1` from `t1` +View Create View character_set_client collation_connection +view1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_db1`@`localhost` SQL SECURITY DEFINER VIEW `view1` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci CREATE VIEW view2 AS SELECT * FROM view1; # Here comes a suspicious warning SHOW CREATE VIEW view2; -View Create View -view2 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_db1`@`localhost` SQL SECURITY DEFINER VIEW `view2` AS select `view1`.`f1` AS `f1` from `view1` +View Create View character_set_client collation_connection +view2 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_db1`@`localhost` SQL SECURITY DEFINER VIEW `view2` AS select `view1`.`f1` AS `f1` from `view1` latin1 latin1_swedish_ci # But the view view2 is usable SELECT * FROM view2; f1 @@ -783,8 +783,8 @@ ALTER VIEW v2 AS SELECT f2 FROM t1; ERROR 42000: DROP command denied to user 'u26813'@'localhost' for table 'v2' ALTER VIEW v3 AS SELECT f2 FROM t1; SHOW CREATE VIEW v3; -View Create View -v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`f2` AS `f2` from `t1` +View Create View character_set_client collation_connection +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`f2` AS `f2` from `t1` latin1 latin1_swedish_ci DROP USER u26813@localhost; DROP DATABASE db26813; DROP DATABASE IF EXISTS mysqltest1; @@ -882,28 +882,28 @@ CREATE TABLE t1 (i INT); CREATE VIEW v1 AS SELECT * FROM t1; ALTER VIEW v1 AS SELECT * FROM t1; SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci ALTER DEFINER=no_such@user_1 VIEW v1 AS SELECT * FROM t1; Warnings: Note 1449 There is no 'no_such'@'user_1' registered SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such`@`user_1` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i` from `t1` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such`@`user_1` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci Warnings: Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them ALTER ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1; SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=MERGE DEFINER=`no_such`@`user_1` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i` from `t1` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=MERGE DEFINER=`no_such`@`user_1` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci Warnings: Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them ALTER ALGORITHM=TEMPTABLE DEFINER=no_such@user_2 VIEW v1 AS SELECT * FROM t1; Warnings: Note 1449 There is no 'no_such'@'user_2' registered SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=TEMPTABLE DEFINER=`no_such`@`user_2` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i` from `t1` +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=TEMPTABLE DEFINER=`no_such`@`user_2` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci Warnings: Warning 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them DROP VIEW v1; diff --git a/mysql-test/t/binary.test b/mysql-test/t/binary.test index 4ab6ee9eaf1..1cc6ae07675 100644 --- a/mysql-test/t/binary.test +++ b/mysql-test/t/binary.test @@ -101,3 +101,41 @@ select hex(col1) from t1; insert into t1 values ('b'),('b '); select hex(col1) from t1; drop table t1; + +# +# Bug #29087: assertion abort for a search in a BINARY non-nullable index +# by a key with trailing spaces +# + +CREATE TABLE t1 ( + a binary(20) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', + index idx(a) +); +INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029087575'); +INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020'); +INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029080707'); + +SELECT hex(a) FROM t1 order by a; +EXPLAIN SELECT hex(a) FROM t1 order by a; + +SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020'); +EXPLAIN +SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020'); + +SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF02908'); + +DROP TABLE t1; + +CREATE TABLE t1 ( + id numeric(20) NOT NULL, + lang varchar(8) NOT NULL, + msg varchar(32) NOT NULL, + PRIMARY KEY (id,lang) +); +INSERT INTO t1 VALUES (33, 'en', 'zzzzzzz'); +INSERT INTO t1 VALUES (31, 'en', 'xxxxxxx'); +INSERT INTO t1 VALUES (32, 'en', 'yyyyyyy'); +SELECT * FROM t1 WHERE id=32; + +DROP TABLE t1; + diff --git a/mysql-test/t/binlog_multi_engine.test b/mysql-test/t/binlog_multi_engine.test index 6614b9e5d44..058aca0f715 100644 --- a/mysql-test/t/binlog_multi_engine.test +++ b/mysql-test/t/binlog_multi_engine.test @@ -1,6 +1,11 @@ +# Test to test how logging is done depending on the capabilities of +# the engines. Unfortunately, we don't have a good row-only logging +# engine, and NDB does not really cut is since it is also +# self-logging. I'm using it nevertheless. + source include/have_blackhole.inc; source include/have_ndb.inc; -source include/have_binlog_format_mixed_or_row.inc; +source include/have_log_bin.inc; CREATE TABLE t1m (m INT, n INT) ENGINE=MYISAM; CREATE TABLE t1b (b INT, c INT) ENGINE=BLACKHOLE; @@ -15,9 +20,6 @@ INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2); UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c; -# I cannot use these statements since the rows logged to the NDB table -# eventually shows up in the binary log. I use them anyway, since once -# BUG#29222 is fixed, there will be a difference here. echo *** Please look in binlog_multi_engine.test if you have a diff here ****; START TRANSACTION; INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2); @@ -40,6 +42,8 @@ INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2); INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2); UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c; +error ER_BINLOG_LOGGING_IMPOSSIBLE; +UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f; # Not possible to test this since NDB writes its own binlog, which # might cause it to be out of sync with the results from MyISAM. @@ -67,6 +71,8 @@ INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2); error ER_BINLOG_LOGGING_IMPOSSIBLE; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c; +error ER_BINLOG_LOGGING_IMPOSSIBLE; +UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f; # Not possible to test this since NDB writes its own binlog, which # might cause it to be out of sync with the results from MyISAM. diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 149982e23c5..dd3037ce88d 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -790,6 +790,339 @@ drop table t1, t2; create table t1 (upgrade int); drop table t1; + +# +# Bug #26642: create index corrupts table definition in .frm +# +# Problem with creating keys with maximum key-parts and maximum name length +# This test is made for a mysql server supporting names up to 64 bytes +# and a maximum of 16 key segements per Key +# + +create table t1 ( + c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, c8 int, + c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int, + + key a001_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a002_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a003_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a004_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a005_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a006_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a007_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a008_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a009_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + + key a010_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a011_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a012_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a013_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a014_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a015_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a016_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a017_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a018_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a019_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + + key a020_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a021_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a022_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a023_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a024_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a025_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a026_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a027_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a028_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a029_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + + key a030_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a031_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a032_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a033_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a034_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a035_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a036_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a037_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a038_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a039_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + + key a040_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a041_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a042_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a043_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a044_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a045_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a046_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a047_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a048_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a049_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + + key a050_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a051_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a052_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a053_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a054_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a055_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a056_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a057_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a058_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a059_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + + key a060_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a061_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a062_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a063_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + key a064_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16) +); + +# Check that the table is not corrupted +show create table t1; +flush tables; +show create table t1; + +# Repeat test using ALTER to add indexes + +drop table t1; +create table t1 (c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, +c8 int, c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int); + +alter table t1 + + add key a001_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a002_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a003_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a004_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a005_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a006_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a007_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a008_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a009_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + + add key a010_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a011_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a012_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a013_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a014_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a015_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a016_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a017_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a018_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a019_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + + add key a020_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a021_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a022_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a023_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a024_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a025_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a026_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a027_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a028_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a029_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + + add key a030_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a031_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a032_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a033_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a034_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a035_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a036_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a037_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a038_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a039_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + + add key a040_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a041_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a042_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a043_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a044_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a045_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a046_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a047_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a048_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a049_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + + add key a050_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a051_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a052_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a053_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a054_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a055_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a056_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a057_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a058_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a059_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + + add key a060_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a061_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a062_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a063_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16), + add key a064_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16); + +show create table t1; +flush tables; +show create table t1; + +# Test the server limits; if any of these pass, all above tests need +# to be rewritten to hit the limit +# +# Ensure limit is really 64 keys +--error 1069 +alter table t1 add key + a065_long_123456789_123456789_123456789_123456789_123456789_1234 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16); + +drop table t1; + +# Ensure limit is really 16 key parts per key + +create table t1 (c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, +c8 int, c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, +c16 int, c17 int); + +# Get error for max key parts +--error 1070 +alter table t1 add key i1 ( + c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16, c17); + +# Get error for max key-name length +--error 1059 +alter table t1 add key + a001_long_123456789_123456789_123456789_123456789_123456789_12345 (c1); + +show create table t1; + +drop table t1; + + --echo End of 5.0 tests # diff --git a/mysql-test/t/ctype_collate.test b/mysql-test/t/ctype_collate.test index aca240b46bc..4bbae42559a 100644 --- a/mysql-test/t/ctype_collate.test +++ b/mysql-test/t/ctype_collate.test @@ -207,3 +207,14 @@ EXPLAIN SELECT * FROM t1 WHERE s2 LIKE 'a' COLLATE latin1_german1_ci; DROP TABLE t1; # End of 4.1 tests + +# +# Bug#29261: Sort order of the collation wasn't used when comparing trailing +# spaces. +# +create table t1(f1 varchar(10) character set latin2 collate latin2_hungarian_ci, key(f1)); +insert into t1 set f1=0x3F3F9DC73F; +insert into t1 set f1=0x3F3F1E563F; +insert into t1 set f1=0x3F3F; +check table t1 extended; +drop table t1; diff --git a/mysql-test/t/ctype_uca.test b/mysql-test/t/ctype_uca.test index 64349bc40a6..17632e7c8fc 100644 --- a/mysql-test/t/ctype_uca.test +++ b/mysql-test/t/ctype_uca.test @@ -485,3 +485,57 @@ CREATE TABLE t1 ( insert into t1 values (''),('a'); SELECT COUNT(*), c1 FROM t1 GROUP BY c1; DROP TABLE IF EXISTS t1; + +# +# Bug#27345 Incorrect data returned when range-read from utf8_danish_ci indexes +# +set names utf8; +create table t1 ( + a varchar(255), + key a(a) +) character set utf8 collate utf8_danish_ci; +insert into t1 values ('Ã¥aaaa'),('ååaaa'),('aaaaa'); +select a as like_a from t1 where a like 'a%'; +select a as like_aa from t1 where a like 'aa%'; +select a as like_aaa from t1 where a like 'aaa%'; +select a as like_aaaa from t1 where a like 'aaaa%'; +select a as like_aaaaa from t1 where a like 'aaaaa%'; +alter table t1 convert to character set ucs2 collate ucs2_danish_ci; +select a as like_a from t1 where a like 'a%'; +select a as like_aa from t1 where a like 'aa%'; +select a as like_aaa from t1 where a like 'aaa%'; +select a as like_aaaa from t1 where a like 'aaaa%'; +select a as like_aaaaa from t1 where a like 'aaaaa%'; +drop table t1; + +create table t1 ( + a varchar(255), + key(a) +) character set utf8 collate utf8_spanish2_ci; +insert into t1 values ('aaaaa'),('lllll'),('zzzzz'); +select a as like_l from t1 where a like 'l%'; +select a as like_ll from t1 where a like 'll%'; +select a as like_lll from t1 where a like 'lll%'; +select a as like_llll from t1 where a like 'llll%'; +select a as like_lllll from t1 where a like 'lllll%'; +alter table t1 convert to character set ucs2 collate ucs2_spanish2_ci; +select a as like_l from t1 where a like 'l%'; +select a as like_ll from t1 where a like 'll%'; +select a as like_lll from t1 where a like 'lll%'; +select a as like_llll from t1 where a like 'llll%'; +select a as like_lllll from t1 where a like 'lllll%'; +drop table t1; + +create table t1 ( + a varchar(255), + key a(a) +) character set utf8 collate utf8_czech_ci; +-- In Czech 'ch' is a single letter between 'h' and 'i' +insert into t1 values +('b'),('c'),('d'),('e'),('f'),('g'),('h'),('ch'),('i'),('j'); +select * from t1 where a like 'c%'; +alter table t1 convert to character set ucs2 collate ucs2_czech_ci; +select * from t1 where a like 'c%'; +drop table t1; + +-- echo End for 5.0 tests diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index c3320159c41..8828cd10eec 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -594,4 +594,22 @@ select data_type, character_octet_length, character_maximum_length from information_schema.columns where table_name='t1'; drop table t1; +# +# Bug#28925 GROUP_CONCAT inserts wrong separators for a ucs2 column +# +create table t1 (a char(1) character set ucs2); +insert into t1 values ('a'),('b'),('c'); +select hex(group_concat(a)) from t1; +select collation(group_concat(a)) from t1; +drop table t1; + +set names latin1; +create table t1 (a char(1) character set latin1); +insert into t1 values ('a'),('b'),('c'); +set character_set_connection=ucs2; +select hex(group_concat(a separator ',')) from t1; +select collation(group_concat(a separator ',')) from t1; +drop table t1; +set names latin1; + --echo End of 5.0 tests diff --git a/mysql-test/t/ctype_ucs2_def.test b/mysql-test/t/ctype_ucs2_def.test index 050710b208b..c80444daddd 100644 --- a/mysql-test/t/ctype_ucs2_def.test +++ b/mysql-test/t/ctype_ucs2_def.test @@ -15,6 +15,16 @@ DROP TABLE IF EXISTS t1; create table t1 (a int); drop table t1; +--echo End of 4.1 tests + +# +# Bug #28925 GROUP_CONCAT inserts wrong separators for a ucs2 column +# Check that GROUP_CONCAT works fine with --default-character-set=ucs2 +# +create table t1 (a char(1) character set latin1); +insert into t1 values ('a'),('b'),('c'); +select hex(group_concat(a)) from t1; +drop table t1; # # Bug #27643: query failed : 1114 (The table '' is full) # diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index 03b3df44c73..204d59589e4 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -1339,3 +1339,28 @@ 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; DROP TABLE t1, t2; + +# +# Bug#29205: truncation of UTF8 values when the UNION statement +# forces collation to the binary charset +# + +SELECT 'н1234567890' UNION SELECT _binary '1'; +SELECT 'н1234567890' UNION SELECT 1; + +SELECT '1' UNION SELECT 'н1234567890'; +SELECT 1 UNION SELECT 'н1234567890'; + +CREATE TABLE t1 (c VARCHAR(11)) CHARACTER SET utf8; +CREATE TABLE t2 (b CHAR(1) CHARACTER SET binary, i INT); + +INSERT INTO t1 (c) VALUES ('н1234567890'); +INSERT INTO t2 (b, i) VALUES ('1', 1); + +SELECT c FROM t1 UNION SELECT b FROM t2; +SELECT c FROM t1 UNION SELECT i FROM t2; + +SELECT b FROM t2 UNION SELECT c FROM t1; +SELECT i FROM t2 UNION SELECT c FROM t1; + +DROP TABLE t1, t2; diff --git a/mysql-test/t/ddl_i18n_koi8r.test b/mysql-test/t/ddl_i18n_koi8r.test new file mode 100644 index 00000000000..e636d801b07 --- /dev/null +++ b/mysql-test/t/ddl_i18n_koi8r.test @@ -0,0 +1,1112 @@ +# Objects to test: +# - stored procedures/functions; +# - triggers; +# - events; +# - views; +# +# For stored routines: +# - create a database with collation utf8_unicode_ci; +# - create an object, which +# - contains SP-var with explicit CHARSET-clause; +# - contains SP-var without CHARSET-clause; +# - contains text constant; +# - has localized routine/parameter names; +# - check: +# - execute; +# - SHOW CREATE output; +# - SHOW output; +# - SELECT FROM INFORMATION_SCHEMA output; +# - alter database character set; +# - change connection collation; +# - check again; +# - dump definition using mysqldump; +# - drop object; +# - restore object; +# + +########################################################################### +# +# NOTE: this file contains text in UTF8 and KOI8-R encodings. +# +########################################################################### + +--source include/have_utf8.inc +--source include/have_cp866.inc +--source include/have_cp1251.inc +--source include/have_koi8r.inc + +########################################################################### + +set names koi8r; +delimiter |; + +########################################################################### +# +# * Views. +# +########################################################################### + +--echo +--echo ------------------------------------------------------------------- +--echo Views +--echo ------------------------------------------------------------------- +--echo + +# +# Preparation: +# + +# - Create database with fixed, pre-defined character set. + +--disable_warnings +DROP DATABASE IF EXISTS mysqltest1| +--enable_warnings + +CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| + +use mysqltest1| + +CREATE TABLE t1(ËÏÌ INT)| +INSERT INTO t1 VALUES(1)| + +# - Create views; + +--echo + +CREATE VIEW v1 AS + SELECT 'ÔÅÓÔ' AS c1, ËÏÌ AS c2 + FROM t1| + +--echo + +CREATE VIEW v2 AS SELECT _utf8'теÑÑ‚' as c1| + +--echo + +# +# First-round checks. +# + +--source include/ddl_i18n.check_views.inc + +# +# Change running environment (alter database character set, change session +# variables). +# + +--echo +--echo + +ALTER DATABASE mysqltest1 COLLATE cp866_general_ci| + +# +# Second-round checks: +# + +# - Change connection to flush cache; + +--connect (con2,localhost,root,,) +--echo +--echo ---> connection: con2 + +# - Switch environment variables and trigger loading views; + +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| + +--disable_result_log +SELECT * FROM mysqltest1.v1| +SELECT * FROM mysqltest1.v2| +--enable_result_log + +use mysqltest1| + +# - Restore environment; + +set names koi8r| + +# - Check! + +--source include/ddl_i18n.check_views.inc + +# +# Check mysqldump. +# + +# - Dump mysqltest1; + +--echo +--echo ---> Dumping mysqltest1 to ddl_i18n_koi8r.views.mysqltest1.sql + +--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.views.mysqltest1.sql + +# - Clean mysqltest1; + +--echo +--echo + +DROP DATABASE mysqltest1| + +# - Restore mysqltest1; + +--echo +--echo + +--echo ---> Restoring mysqltest1... +--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.views.mysqltest1.sql + +# +# Third-round checks. +# + +# - Change connection to flush cache; + +--connect (con3,localhost,root,,) +--echo +--echo ---> connection: con3 + +# - Switch environment variables and trigger loading stored procedures; + +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| + +--disable_result_log +SELECT * FROM mysqltest1.v1| +SELECT * FROM mysqltest1.v2| +--enable_result_log + +use mysqltest1| + +# - Restore environment; + +set names koi8r| + +# - Check! + +--source include/ddl_i18n.check_views.inc + +# +# Cleanup. +# + +--connection default +--echo +--echo ---> connection: default + +--disconnect con2 +--disconnect con3 + +use test| + +DROP DATABASE mysqltest1| + +########################################################################### +# +# * Stored procedures/functions. +# +########################################################################### + +--echo +--echo ------------------------------------------------------------------- +--echo Stored procedures/functions +--echo ------------------------------------------------------------------- +--echo + +# +# Preparation: +# + +# - Create database with fixed, pre-defined character set. + +--disable_warnings +DROP DATABASE IF EXISTS mysqltest1| +DROP DATABASE IF EXISTS mysqltest2| +--enable_warnings + +CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| +CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| + +use mysqltest1| + +# - Create two stored routines -- with and without explicit +# CHARSET-clause for SP-variable; +# + +--echo + +# - Procedure p1 + +CREATE PROCEDURE p1( + INOUT ÐÁÒÁÍ1 CHAR(10), + OUT ÐÁÒÁÍ2 CHAR(10)) +BEGIN + DECLARE ÐÅÒÅÍ1 CHAR(10); + + SELECT + COLLATION(ÐÅÒÅÍ1) AS c1, + COLLATION(ÐÁÒÁÍ1) AS c2, + COLLATION(ÐÁÒÁÍ2) AS c3; + + SELECT + COLLATION('ÔÅËÓÔ') AS c4, + COLLATION(_koi8r 'ÔÅËÓÔ') AS c5, + COLLATION(_utf8 'текÑÑ‚') AS c6, + @@collation_connection AS c7, + @@character_set_client AS c8; + + SET ÐÁÒÁÍ1 = 'a'; + SET ÐÁÒÁÍ2 = 'b'; +END| + +--echo + +# - Procedure p2 + +CREATE PROCEDURE p2( + INOUT ÐÁÒÁÍ1 CHAR(10) CHARACTER SET utf8, + OUT ÐÁÒÁÍ2 CHAR(10) CHARACTER SET utf8) +BEGIN + DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; + + SELECT + COLLATION(ÐÅÒÅÍ1) AS c1, + COLLATION(ÐÁÒÁÍ1) AS c2, + COLLATION(ÐÁÒÁÍ2) AS c3; + + SELECT + COLLATION('ÔÅËÓÔ') AS c4, + COLLATION(_koi8r 'ÔÅËÓÔ') AS c5, + COLLATION(_utf8 'текÑÑ‚') AS c6, + @@collation_connection AS c7, + @@character_set_client AS c8; + + SET ÐÁÒÁÍ1 = 'a'; + SET ÐÁÒÁÍ2 = 'b'; +END| + +--echo + +# - Procedure p3 + +CREATE PROCEDURE mysqltest2.p3( + INOUT ÐÁÒÁÍ1 CHAR(10), + OUT ÐÁÒÁÍ2 CHAR(10)) +BEGIN + DECLARE ÐÅÒÅÍ1 CHAR(10); + + SELECT + COLLATION(ÐÅÒÅÍ1) AS c1, + COLLATION(ÐÁÒÁÍ1) AS c2, + COLLATION(ÐÁÒÁÍ2) AS c3; + + SELECT + COLLATION('ÔÅËÓÔ') AS c4, + COLLATION(_koi8r 'ÔÅËÓÔ') AS c5, + COLLATION(_utf8 'текÑÑ‚') AS c6, + @@collation_connection AS c7, + @@character_set_client AS c8; + + SET ÐÁÒÁÍ1 = 'a'; + SET ÐÁÒÁÍ2 = 'b'; +END| + +--echo + +# - Procedure p4 + +CREATE PROCEDURE mysqltest2.p4( + INOUT ÐÁÒÁÍ1 CHAR(10) CHARACTER SET utf8, + OUT ÐÁÒÁÍ2 CHAR(10) CHARACTER SET utf8) +BEGIN + DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; + + SELECT + COLLATION(ÐÅÒÅÍ1) AS c1, + COLLATION(ÐÁÒÁÍ1) AS c2, + COLLATION(ÐÁÒÁÍ2) AS c3; + + SELECT + COLLATION('ÔÅËÓÔ') AS c4, + COLLATION(_koi8r 'ÔÅËÓÔ') AS c5, + COLLATION(_utf8 'текÑÑ‚') AS c6, + @@collation_connection AS c7, + @@character_set_client AS c8; + + SET ÐÁÒÁÍ1 = 'a'; + SET ÐÁÒÁÍ2 = 'b'; +END| + +# +# First-round checks. +# + +--source include/ddl_i18n.check_sp.inc + +# +# Change running environment (alter database character set, change session +# variables). +# + +--echo +--echo + +ALTER DATABASE mysqltest1 COLLATE cp866_general_ci| +ALTER DATABASE mysqltest2 COLLATE cp866_general_ci| + +# +# Second-round checks: +# + +# - Change connection to flush SP-cache; + +--connect (con2,localhost,root,,mysqltest1) +--echo +--echo ---> connection: con2 + +# - Switch environment variables and trigger loading stored procedures; + +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| + +CALL p1(@a, @b)| +CALL p2(@a, @b)| +CALL mysqltest2.p3(@a, @b)| +CALL mysqltest2.p4(@a, @b)| + +# - Restore environment; + +set names koi8r| + +# - Check! + +--source include/ddl_i18n.check_sp.inc + +# +# Check mysqldump. +# + +# - Dump mysqltest1, mysqltest2; + +--echo +--echo ---> Dump of mysqltest1 + +--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest1 + +--echo +--echo ---> Dumping mysqltest1 to ddl_i18n_koi8r.sp.mysqltest1.sql + +--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.sp.mysqltest1.sql + +--echo +--echo ---> Dump of mysqltest2 + +--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest2 + +--echo +--echo ---> Dumping mysqltest2 to ddl_i18n_koi8r.sp.mysqltest2.sql + +--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest2 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.sp.mysqltest2.sql + +# - Clean mysqltest1, mysqltest2; + +--echo +--echo + +DROP DATABASE mysqltest1| +DROP DATABASE mysqltest2| + +# - Restore mysqltest1; + +--echo +--echo + +--echo ---> Restoring mysqltest1... +--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.sp.mysqltest1.sql + +--echo ---> Restoring mysqltest2... +--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.sp.mysqltest2.sql + +# +# Third-round checks. +# + +# - Change connection to flush SP-cache; + +--connect (con3,localhost,root,,mysqltest1) +--echo +--echo ---> connection: con3 + +# - Switch environment variables and trigger loading stored procedures; + +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| + +CALL p1(@a, @b)| +CALL p2(@a, @b)| +CALL mysqltest2.p3(@a, @b)| +CALL mysqltest2.p4(@a, @b)| + +# - Restore environment; + +set names koi8r| + +# - Check! + +--source include/ddl_i18n.check_sp.inc + +# +# Cleanup. +# + +--connection default +--echo +--echo ---> connection: default + +--disconnect con2 +--disconnect con3 + +use test| + +DROP DATABASE mysqltest1| +DROP DATABASE mysqltest2| + +########################################################################### +# +# * Triggers. +# +########################################################################### + +--echo +--echo ------------------------------------------------------------------- +--echo Triggers +--echo ------------------------------------------------------------------- +--echo + +# +# Preparation: +# + +# - Create database with fixed, pre-defined character set; + +--disable_warnings +DROP DATABASE IF EXISTS mysqltest1| +DROP DATABASE IF EXISTS mysqltest2| +--enable_warnings + +CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| +CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| + +use mysqltest1| + +# - Create tables for triggers; + +CREATE TABLE t1(c INT)| +CREATE TABLE mysqltest2.t1(c INT)| + +# - Create log tables; + +CREATE TABLE log(msg VARCHAR(255))| +CREATE TABLE mysqltest2.log(msg VARCHAR(255))| + + +# - Create triggers -- with and without explicit CHARSET-clause for +# SP-variable; +# + +--echo + +# - Trigger trg1 + +CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN + DECLARE ÐÅÒÅÍ1 CHAR(10); + + INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); + INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); + INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); + INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); + INSERT INTO log VALUES(@@collation_connection); + INSERT INTO log VALUES(@@character_set_client); + + SET @a1 = 'ÔÅËÓÔ'; + SET @a1 = _koi8r 'ÔÅËÓÔ'; + SET @a2 = _utf8 'текÑÑ‚'; +END| + +--echo + +# - Trigger trg2 + +CREATE TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW +BEGIN + DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; + + INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); + INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); + INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); + INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); + INSERT INTO log VALUES(@@collation_connection); + INSERT INTO log VALUES(@@character_set_client); + + SET @b1 = 'ÔÅËÓÔ'; + SET @b1 = _koi8r 'ÔÅËÓÔ'; + SET @b2 = _utf8 'текÑÑ‚'; +END| + +--echo + +# - Trigger trg3 + +CREATE TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW +BEGIN + DECLARE ÐÅÒÅÍ1 CHAR(10); + + INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); + INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); + INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); + INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); + INSERT INTO log VALUES(@@collation_connection); + INSERT INTO log VALUES(@@character_set_client); + + SET @a1 = 'ÔÅËÓÔ'; + SET @a1 = _koi8r 'ÔÅËÓÔ'; + SET @a2 = _utf8 'текÑÑ‚'; +END| + +--echo + +# - Trigger trg4 + +CREATE TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW +BEGIN + DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; + + INSERT INTO log VALUES(COLLATION(ÐÅÒÅÍ1)); + INSERT INTO log VALUES(COLLATION('ÔÅËÓÔ')); + INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); + INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); + INSERT INTO log VALUES(@@collation_connection); + INSERT INTO log VALUES(@@character_set_client); + + SET @b1 = 'ÔÅËÓÔ'; + SET @b1 = _koi8r 'ÔÅËÓÔ'; + SET @b2 = _utf8 'текÑÑ‚'; +END| + +--echo + +# +# First-round checks. +# + +--source include/ddl_i18n.check_triggers.inc + +# +# Change running environment (alter database character set, change session +# variables). +# + +--echo +--echo + +ALTER DATABASE mysqltest1 COLLATE cp866_general_ci| +ALTER DATABASE mysqltest2 COLLATE cp866_general_ci| + +# +# Second-round checks: +# + +# - Flush table cache; + +ALTER TABLE t1 ADD COLUMN fake INT| +ALTER TABLE t1 DROP COLUMN fake| + +ALTER TABLE mysqltest2.t1 ADD COLUMN fake INT| +ALTER TABLE mysqltest2.t1 DROP COLUMN fake| + +# - Switch environment variables and initiate loading of triggers +# (connect using NULL database); + +--connect (con2,localhost,root,,) +--echo +--echo ---> connection: con2 + +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| + +INSERT INTO mysqltest1.t1 VALUES(0)| +INSERT INTO mysqltest2.t1 VALUES(0)| + +DELETE FROM mysqltest1.log| +DELETE FROM mysqltest2.log| + +# - Restore environment; + +set names koi8r| + +use mysqltest1| + +# - Check! + +--source include/ddl_i18n.check_triggers.inc + +# +# Check mysqldump. +# + +# - Dump mysqltest1, mysqltest2; + +--echo +--echo ---> Dump of mysqltest1 + +--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest1 + +--echo +--echo ---> Dumping mysqltest1 to ddl_i18n_koi8r.triggers.mysqltest1.sql + +--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.triggers.mysqltest1.sql + +--echo +--echo ---> Dump of mysqltest2 + +--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest2 + +--echo +--echo ---> Dumping mysqltest2 to ddl_i18n_koi8r.triggers.mysqltest2.sql + +--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest2 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.triggers.mysqltest2.sql + +# - Clean mysqltest1, mysqltest2; + +--echo +--echo + +DROP DATABASE mysqltest1| +DROP DATABASE mysqltest2| + +# - Restore mysqltest1; + +--echo +--echo + +--echo ---> Restoring mysqltest1... +--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.triggers.mysqltest1.sql + +--echo ---> Restoring mysqltest2... +--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.triggers.mysqltest2.sql + +# +# Third-round checks. +# + +# - Flush table cache; + +ALTER TABLE mysqltest1.t1 ADD COLUMN fake INT| +ALTER TABLE mysqltest1.t1 DROP COLUMN fake| + +ALTER TABLE mysqltest2.t1 ADD COLUMN fake INT| +ALTER TABLE mysqltest2.t1 DROP COLUMN fake| + +# - Switch environment variables and initiate loading of triggers +# (connect using NULL database); + +--connect (con3,localhost,root,,) +--echo +--echo ---> connection: con3 + +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| + +INSERT INTO mysqltest1.t1 VALUES(0)| +INSERT INTO mysqltest2.t1 VALUES(0)| + +DELETE FROM mysqltest1.log| +DELETE FROM mysqltest2.log| + +# - Restore environment; + +set names koi8r| + +use mysqltest1| + +# - Check! + +--source include/ddl_i18n.check_triggers.inc + +# +# Cleanup. +# + +--connection default +--echo +--echo ---> connection: default + +--disconnect con2 +--disconnect con3 + +use test| + +DROP DATABASE mysqltest1| +DROP DATABASE mysqltest2| + +########################################################################### +# +# * Events +# +# We don't have EXECUTE EVENT so far, so this test is limited. It checks that +# event with non-latin1 symbols can be created, dumped, restored and SHOW +# statements work properly. +# +########################################################################### + +--echo +--echo ------------------------------------------------------------------- +--echo Events +--echo ------------------------------------------------------------------- +--echo + +# +# Preparation: +# + +# - Create database with fixed, pre-defined character set. + +--disable_warnings +DROP DATABASE IF EXISTS mysqltest1| +DROP DATABASE IF EXISTS mysqltest2| +--enable_warnings + +CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| +CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| + +use mysqltest1| + +# - Create two stored routines -- with and without explicit +# CHARSET-clause for SP-variable; +# + +--echo + +# - Event ev1 + +CREATE EVENT ev1 ON SCHEDULE AT '2030-01-01 00:00:00' DO +BEGIN + DECLARE ÐÅÒÅÍ1 CHAR(10); + + SELECT + COLLATION(ÐÅÒÅÍ1) AS c1, + COLLATION('ÔÅËÓÔ') AS c2, + COLLATION(_koi8r 'ÔÅËÓÔ') AS c3, + COLLATION(_utf8 'текÑÑ‚') AS c4, + @@collation_connection AS c5, + @@character_set_client AS c6; +END| + +--echo + +# - Event ev2 + +CREATE EVENT ev2 ON SCHEDULE AT '2030-01-01 00:00:00' DO +BEGIN + DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; + + SELECT + COLLATION(ÐÅÒÅÍ1) AS c1, + COLLATION('ÔÅËÓÔ') AS c2, + COLLATION(_koi8r 'ÔÅËÓÔ') AS c3, + COLLATION(_utf8 'текÑÑ‚') AS c4, + @@collation_connection AS c5, + @@character_set_client AS c6; +END| + +--echo + +# - Event ev3 + +CREATE EVENT mysqltest2.ev3 ON SCHEDULE AT '2030-01-01 00:00:00' DO +BEGIN + DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; + + SELECT + COLLATION(ÐÅÒÅÍ1) AS c1, + COLLATION('ÔÅËÓÔ') AS c2, + COLLATION(_koi8r 'ÔÅËÓÔ') AS c3, + COLLATION(_utf8 'текÑÑ‚') AS c4, + @@collation_connection AS c5, + @@character_set_client AS c6; +END| + +--echo + +# - Event ev4 + +CREATE EVENT mysqltest2.ev4 ON SCHEDULE AT '2030-01-01 00:00:00' DO +BEGIN + DECLARE ÐÅÒÅÍ1 CHAR(10) CHARACTER SET utf8; + + SELECT + COLLATION(ÐÅÒÅÍ1) AS c1, + COLLATION('ÔÅËÓÔ') AS c2, + COLLATION(_koi8r 'ÔÅËÓÔ') AS c3, + COLLATION(_utf8 'текÑÑ‚') AS c4, + @@collation_connection AS c5, + @@character_set_client AS c6; +END| + +--echo + + +# +# First-round checks. +# + +--source include/ddl_i18n.check_events.inc + +# +# Change running environment (alter database character set, change session +# variables). +# + +--echo +--echo + +ALTER DATABASE mysqltest1 COLLATE cp866_general_ci| +ALTER DATABASE mysqltest2 COLLATE cp866_general_ci| + +# +# Second-round checks: +# + +# - Change connection to flush cache; + +--connect (con2,localhost,root,,mysqltest1) +--echo +--echo ---> connection: con2 + +# - Switch environment variables and trigger loading stored procedures; + +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| + +--disable_result_log +SHOW CREATE EVENT ev1| +SHOW CREATE EVENT ev2| +SHOW CREATE EVENT mysqltest2.ev3| +SHOW CREATE EVENT mysqltest2.ev4| +--enable_result_log + +# - Restore environment; + +set names koi8r| + +# - Check! + +--source include/ddl_i18n.check_events.inc + +# +# Check mysqldump. +# + +# - Dump mysqltest1, mysqltest2; + +--echo +--echo ---> Dump of mysqltest1 + +--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest1 + +--echo +--echo ---> Dumping mysqltest1 to ddl_i18n_koi8r.events.mysqltest1.sql + +--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.events.mysqltest1.sql + +--echo +--echo ---> Dump of mysqltest2 + +--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest2 + +--echo +--echo ---> Dumping mysqltest2 to ddl_i18n_koi8r.events.mysqltest2.sql + +--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest2 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.events.mysqltest2.sql + +# - Clean mysqltest1, mysqltest2; + +--echo +--echo + +DROP DATABASE mysqltest1| +DROP DATABASE mysqltest2| + +# - Restore mysqltest1; + +--echo +--echo + +--echo ---> Restoring mysqltest1... +--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.events.mysqltest1.sql + +--echo ---> Restoring mysqltest2... +--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_koi8r.events.mysqltest2.sql + +# +# Third-round checks. +# + +# - Change connection to flush cache; + +--connect (con3,localhost,root,,mysqltest1) +--echo +--echo ---> connection: con3 + +# - Switch environment variables and trigger loading stored procedures; + +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| + +--disable_result_log +SHOW CREATE EVENT ev1| +SHOW CREATE EVENT ev2| +SHOW CREATE EVENT mysqltest2.ev3| +SHOW CREATE EVENT mysqltest2.ev4| +--enable_result_log + +# - Restore environment; + +set names koi8r| + +# - Check! + +--source include/ddl_i18n.check_events.inc + +########################################################################### +# +# * DDL statements inside stored routine. +# +# Here we check that DDL statements use actual database collation even if they +# are called from stored routine. +# +########################################################################### + +--echo +--echo ------------------------------------------------------------------- +--echo DDL statements within stored routine. +--echo ------------------------------------------------------------------- +--echo + +# +# Preparation: +# + +# - Create database with fixed, pre-defined character set. + +--disable_warnings +DROP DATABASE IF EXISTS mysqltest1| +DROP DATABASE IF EXISTS mysqltest2| +--enable_warnings + +CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| +CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| + +use mysqltest1| + +# - Create procedures; + +--echo + +CREATE PROCEDURE p1() +BEGIN + CREATE TABLE t1(col1 VARCHAR(10)); + SHOW CREATE TABLE t1; +END| + +--echo + +CREATE PROCEDURE mysqltest2.p2() +BEGIN + CREATE TABLE t2(col1 VARCHAR(10)); + SHOW CREATE TABLE t2; +END| + +--echo + +# +# First-round checks. +# + +CALL p1()| + +--echo + +SHOW CREATE TABLE t1| + +--echo +--echo + +CALL mysqltest2.p2()| + +--echo + +SHOW CREATE TABLE mysqltest2.t2| + +# +# Alter database. +# + +--echo + +ALTER DATABASE mysqltest1 COLLATE cp1251_general_cs| +ALTER DATABASE mysqltest2 COLLATE cp1251_general_cs| + +DROP TABLE t1| +DROP TABLE mysqltest2.t2| + +--echo + +# +# Second-round checks. +# + +CALL p1()| + +--echo + +SHOW CREATE TABLE t1| + +--echo +--echo + +CALL mysqltest2.p2()| + +--echo + +SHOW CREATE TABLE mysqltest2.t2| + +########################################################################### +# +# That's it. +# +########################################################################### + +# +# Cleanup. +# + +--connection default +--echo +--echo ---> connection: default + +--disconnect con2 +--disconnect con3 + +use test| + +DROP DATABASE mysqltest1| +DROP DATABASE mysqltest2| diff --git a/mysql-test/t/ddl_i18n_utf8.test b/mysql-test/t/ddl_i18n_utf8.test new file mode 100644 index 00000000000..5f032232e56 --- /dev/null +++ b/mysql-test/t/ddl_i18n_utf8.test @@ -0,0 +1,1112 @@ +# Objects to test: +# - stored procedures/functions; +# - triggers; +# - events; +# - views; +# +# For stored routines: +# - create a database with collation utf8_unicode_ci; +# - create an object, which +# - contains SP-var with explicit CHARSET-clause; +# - contains SP-var without CHARSET-clause; +# - contains text constant; +# - has localized routine/parameter names; +# - check: +# - execute; +# - SHOW CREATE output; +# - SHOW output; +# - SELECT FROM INFORMATION_SCHEMA output; +# - alter database character set; +# - change connection collation; +# - check again; +# - dump definition using mysqldump; +# - drop object; +# - restore object; +# + +########################################################################### +# +# NOTE: this file contains text in UTF8 and KOI8-R encodings. +# +########################################################################### + +--source include/have_utf8.inc +--source include/have_cp866.inc +--source include/have_cp1251.inc +--source include/have_koi8r.inc + +########################################################################### + +set names utf8; +delimiter |; + +########################################################################### +# +# * Views. +# +########################################################################### + +--echo +--echo ------------------------------------------------------------------- +--echo Views +--echo ------------------------------------------------------------------- +--echo + +# +# Preparation: +# + +# - Create database with fixed, pre-defined character set. + +--disable_warnings +DROP DATABASE IF EXISTS mysqltest1| +--enable_warnings + +CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| + +use mysqltest1| + +CREATE TABLE t1(кол INT)| +INSERT INTO t1 VALUES(1)| + +# - Create views; + +--echo + +CREATE VIEW v1 AS + SELECT 'теÑÑ‚' AS c1, кол AS c2 + FROM t1| + +--echo + +CREATE VIEW v2 AS SELECT _koi8r'ÔÅÓÔ' as c1| + +--echo + +# +# First-round checks. +# + +--source include/ddl_i18n.check_views.inc + +# +# Change running environment (alter database character set, change session +# variables). +# + +--echo +--echo + +ALTER DATABASE mysqltest1 COLLATE cp866_general_ci| + +# +# Second-round checks: +# + +# - Change connection to flush cache; + +--connect (con2,localhost,root,,) +--echo +--echo ---> connection: con2 + +# - Switch environment variables and trigger loading views; + +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| + +--disable_result_log +SELECT * FROM mysqltest1.v1| +SELECT * FROM mysqltest1.v2| +--enable_result_log + +use mysqltest1| + +# - Restore environment; + +set names utf8| + +# - Check! + +--source include/ddl_i18n.check_views.inc + +# +# Check mysqldump. +# + +# - Dump mysqltest1; + +--echo +--echo ---> Dumping mysqltest1 to ddl_i18n_utf8views.mysqltest1.sql + +--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8views.mysqltest1.sql + +# - Clean mysqltest1; + +--echo +--echo + +DROP DATABASE mysqltest1| + +# - Restore mysqltest1; + +--echo +--echo + +--echo ---> Restoring mysqltest1... +--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8views.mysqltest1.sql + +# +# Third-round checks. +# + +# - Change connection to flush cache; + +--connect (con3,localhost,root,,) +--echo +--echo ---> connection: con3 + +# - Switch environment variables and trigger loading stored procedures; + +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| + +--disable_result_log +SELECT * FROM mysqltest1.v1| +SELECT * FROM mysqltest1.v2| +--enable_result_log + +use mysqltest1| + +# - Restore environment; + +set names utf8| + +# - Check! + +--source include/ddl_i18n.check_views.inc + +# +# Cleanup. +# + +--connection default +--echo +--echo ---> connection: default + +--disconnect con2 +--disconnect con3 + +use test| + +DROP DATABASE mysqltest1| + +########################################################################### +# +# * Stored procedures/functions. +# +########################################################################### + +--echo +--echo ------------------------------------------------------------------- +--echo Stored procedures/functions +--echo ------------------------------------------------------------------- +--echo + +# +# Preparation: +# + +# - Create database with fixed, pre-defined character set. + +--disable_warnings +DROP DATABASE IF EXISTS mysqltest1| +DROP DATABASE IF EXISTS mysqltest2| +--enable_warnings + +CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| +CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| + +use mysqltest1| + +# - Create two stored routines -- with and without explicit +# CHARSET-clause for SP-variable; +# + +--echo + +# - Procedure p1 + +CREATE PROCEDURE p1( + INOUT парам1 CHAR(10), + OUT парам2 CHAR(10)) +BEGIN + DECLARE перем1 CHAR(10); + + SELECT + COLLATION(перем1) AS c1, + COLLATION(парам1) AS c2, + COLLATION(парам2) AS c3; + + SELECT + COLLATION('текÑÑ‚') AS c4, + COLLATION(_utf8 'текÑÑ‚') AS c5, + COLLATION(_koi8r 'ÔÅËÓÔ') AS c6, + @@collation_connection AS c7, + @@character_set_client AS c8; + + SET парам1 = 'a'; + SET парам2 = 'b'; +END| + +--echo + +# - Procedure p2 + +CREATE PROCEDURE p2( + INOUT парам1 CHAR(10) CHARACTER SET utf8, + OUT парам2 CHAR(10) CHARACTER SET utf8) +BEGIN + DECLARE перем1 CHAR(10) CHARACTER SET utf8; + + SELECT + COLLATION(перем1) AS c1, + COLLATION(парам1) AS c2, + COLLATION(парам2) AS c3; + + SELECT + COLLATION('текÑÑ‚') AS c4, + COLLATION(_utf8 'текÑÑ‚') AS c5, + COLLATION(_koi8r 'ÔÅËÓÔ') AS c6, + @@collation_connection AS c7, + @@character_set_client AS c8; + + SET парам1 = 'a'; + SET парам2 = 'b'; +END| + +--echo + +# - Procedure p3 + +CREATE PROCEDURE mysqltest2.p3( + INOUT парам1 CHAR(10), + OUT парам2 CHAR(10)) +BEGIN + DECLARE перем1 CHAR(10); + + SELECT + COLLATION(перем1) AS c1, + COLLATION(парам1) AS c2, + COLLATION(парам2) AS c3; + + SELECT + COLLATION('текÑÑ‚') AS c4, + COLLATION(_utf8 'текÑÑ‚') AS c5, + COLLATION(_koi8r 'ÔÅËÓÔ') AS c6, + @@collation_connection AS c7, + @@character_set_client AS c8; + + SET парам1 = 'a'; + SET парам2 = 'b'; +END| + +--echo + +# - Procedure p4 + +CREATE PROCEDURE mysqltest2.p4( + INOUT парам1 CHAR(10) CHARACTER SET utf8, + OUT парам2 CHAR(10) CHARACTER SET utf8) +BEGIN + DECLARE перем1 CHAR(10) CHARACTER SET utf8; + + SELECT + COLLATION(перем1) AS c1, + COLLATION(парам1) AS c2, + COLLATION(парам2) AS c3; + + SELECT + COLLATION('текÑÑ‚') AS c4, + COLLATION(_utf8 'текÑÑ‚') AS c5, + COLLATION(_koi8r 'ÔÅËÓÔ') AS c6, + @@collation_connection AS c7, + @@character_set_client AS c8; + + SET парам1 = 'a'; + SET парам2 = 'b'; +END| + +# +# First-round checks. +# + +--source include/ddl_i18n.check_sp.inc + +# +# Change running environment (alter database character set, change session +# variables). +# + +--echo +--echo + +ALTER DATABASE mysqltest1 COLLATE cp866_general_ci| +ALTER DATABASE mysqltest2 COLLATE cp866_general_ci| + +# +# Second-round checks: +# + +# - Change connection to flush SP-cache; + +--connect (con2,localhost,root,,mysqltest1) +--echo +--echo ---> connection: con2 + +# - Switch environment variables and trigger loading stored procedures; + +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| + +CALL p1(@a, @b)| +CALL p2(@a, @b)| +CALL mysqltest2.p3(@a, @b)| +CALL mysqltest2.p4(@a, @b)| + +# - Restore environment; + +set names utf8| + +# - Check! + +--source include/ddl_i18n.check_sp.inc + +# +# Check mysqldump. +# + +# - Dump mysqltest1, mysqltest2; + +--echo +--echo ---> Dump of mysqltest1 + +--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest1 + +--echo +--echo ---> Dumping mysqltest1 to ddl_i18n_utf8sp.mysqltest1.sql + +--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8sp.mysqltest1.sql + +--echo +--echo ---> Dump of mysqltest2 + +--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest2 + +--echo +--echo ---> Dumping mysqltest2 to ddl_i18n_utf8sp.mysqltest2.sql + +--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --routines --databases mysqltest2 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8sp.mysqltest2.sql + +# - Clean mysqltest1, mysqltest2; + +--echo +--echo + +DROP DATABASE mysqltest1| +DROP DATABASE mysqltest2| + +# - Restore mysqltest1; + +--echo +--echo + +--echo ---> Restoring mysqltest1... +--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8sp.mysqltest1.sql + +--echo ---> Restoring mysqltest2... +--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8sp.mysqltest2.sql + +# +# Third-round checks. +# + +# - Change connection to flush SP-cache; + +--connect (con3,localhost,root,,mysqltest1) +--echo +--echo ---> connection: con3 + +# - Switch environment variables and trigger loading stored procedures; + +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| + +CALL p1(@a, @b)| +CALL p2(@a, @b)| +CALL mysqltest2.p3(@a, @b)| +CALL mysqltest2.p4(@a, @b)| + +# - Restore environment; + +set names utf8| + +# - Check! + +--source include/ddl_i18n.check_sp.inc + +# +# Cleanup. +# + +--connection default +--echo +--echo ---> connection: default + +--disconnect con2 +--disconnect con3 + +use test| + +DROP DATABASE mysqltest1| +DROP DATABASE mysqltest2| + +########################################################################### +# +# * Triggers. +# +########################################################################### + +--echo +--echo ------------------------------------------------------------------- +--echo Triggers +--echo ------------------------------------------------------------------- +--echo + +# +# Preparation: +# + +# - Create database with fixed, pre-defined character set; + +--disable_warnings +DROP DATABASE IF EXISTS mysqltest1| +DROP DATABASE IF EXISTS mysqltest2| +--enable_warnings + +CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| +CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| + +use mysqltest1| + +# - Create tables for triggers; + +CREATE TABLE t1(c INT)| +CREATE TABLE mysqltest2.t1(c INT)| + +# - Create log tables; + +CREATE TABLE log(msg VARCHAR(255))| +CREATE TABLE mysqltest2.log(msg VARCHAR(255))| + + +# - Create triggers -- with and without explicit CHARSET-clause for +# SP-variable; +# + +--echo + +# - Trigger trg1 + +CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN + DECLARE перем1 CHAR(10); + + INSERT INTO log VALUES(COLLATION(перем1)); + INSERT INTO log VALUES(COLLATION('текÑÑ‚')); + INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); + INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); + INSERT INTO log VALUES(@@collation_connection); + INSERT INTO log VALUES(@@character_set_client); + + SET @a1 = 'текÑÑ‚'; + SET @a2 = _utf8 'текÑÑ‚'; + SET @a3 = _koi8r 'ÔÅËÓÔ'; +END| + +--echo + +# - Trigger trg2 + +CREATE TRIGGER trg2 AFTER INSERT ON t1 FOR EACH ROW +BEGIN + DECLARE перем1 CHAR(10) CHARACTER SET utf8; + + INSERT INTO log VALUES(COLLATION(перем1)); + INSERT INTO log VALUES(COLLATION('текÑÑ‚')); + INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); + INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); + INSERT INTO log VALUES(@@collation_connection); + INSERT INTO log VALUES(@@character_set_client); + + SET @b1 = 'текÑÑ‚'; + SET @b2 = _utf8 'текÑÑ‚'; + SET @b3 = _koi8r 'ÔÅËÓÔ'; +END| + +--echo + +# - Trigger trg3 + +CREATE TRIGGER mysqltest2.trg3 BEFORE INSERT ON mysqltest2.t1 FOR EACH ROW +BEGIN + DECLARE перем1 CHAR(10); + + INSERT INTO log VALUES(COLLATION(перем1)); + INSERT INTO log VALUES(COLLATION('текÑÑ‚')); + INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); + INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); + INSERT INTO log VALUES(@@collation_connection); + INSERT INTO log VALUES(@@character_set_client); + + SET @a1 = 'текÑÑ‚'; + SET @a2 = _utf8 'текÑÑ‚'; + SET @a3 = _koi8r 'ÔÅËÓÔ'; +END| + +--echo + +# - Trigger trg4 + +CREATE TRIGGER mysqltest2.trg4 AFTER INSERT ON mysqltest2.t1 FOR EACH ROW +BEGIN + DECLARE перем1 CHAR(10) CHARACTER SET utf8; + + INSERT INTO log VALUES(COLLATION(перем1)); + INSERT INTO log VALUES(COLLATION('текÑÑ‚')); + INSERT INTO log VALUES(COLLATION(_utf8 'текÑÑ‚')); + INSERT INTO log VALUES(COLLATION(_koi8r 'ÔÅËÓÔ')); + INSERT INTO log VALUES(@@collation_connection); + INSERT INTO log VALUES(@@character_set_client); + + SET @b1 = 'текÑÑ‚'; + SET @b2 = _utf8 'текÑÑ‚'; + SET @b3 = _koi8r 'ÔÅËÓÔ'; +END| + +--echo + +# +# First-round checks. +# + +--source include/ddl_i18n.check_triggers.inc + +# +# Change running environment (alter database character set, change session +# variables). +# + +--echo +--echo + +ALTER DATABASE mysqltest1 COLLATE cp866_general_ci| +ALTER DATABASE mysqltest2 COLLATE cp866_general_ci| + +# +# Second-round checks: +# + +# - Flush table cache; + +ALTER TABLE t1 ADD COLUMN fake INT| +ALTER TABLE t1 DROP COLUMN fake| + +ALTER TABLE mysqltest2.t1 ADD COLUMN fake INT| +ALTER TABLE mysqltest2.t1 DROP COLUMN fake| + +# - Switch environment variables and initiate loading of triggers +# (connect using NULL database); + +--connect (con2,localhost,root,,) +--echo +--echo ---> connection: con2 + +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| + +INSERT INTO mysqltest1.t1 VALUES(0)| +INSERT INTO mysqltest2.t1 VALUES(0)| + +DELETE FROM mysqltest1.log| +DELETE FROM mysqltest2.log| + +# - Restore environment; + +set names utf8| + +use mysqltest1| + +# - Check! + +--source include/ddl_i18n.check_triggers.inc + +# +# Check mysqldump. +# + +# - Dump mysqltest1, mysqltest2; + +--echo +--echo ---> Dump of mysqltest1 + +--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest1 + +--echo +--echo ---> Dumping mysqltest1 to ddl_i18n_utf8triggers.mysqltest1.sql + +--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8triggers.mysqltest1.sql + +--echo +--echo ---> Dump of mysqltest2 + +--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest2 + +--echo +--echo ---> Dumping mysqltest2 to ddl_i18n_utf8triggers.mysqltest2.sql + +--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --triggers --databases mysqltest2 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8triggers.mysqltest2.sql + +# - Clean mysqltest1, mysqltest2; + +--echo +--echo + +DROP DATABASE mysqltest1| +DROP DATABASE mysqltest2| + +# - Restore mysqltest1; + +--echo +--echo + +--echo ---> Restoring mysqltest1... +--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8triggers.mysqltest1.sql + +--echo ---> Restoring mysqltest2... +--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8triggers.mysqltest2.sql + +# +# Third-round checks. +# + +# - Flush table cache; + +ALTER TABLE mysqltest1.t1 ADD COLUMN fake INT| +ALTER TABLE mysqltest1.t1 DROP COLUMN fake| + +ALTER TABLE mysqltest2.t1 ADD COLUMN fake INT| +ALTER TABLE mysqltest2.t1 DROP COLUMN fake| + +# - Switch environment variables and initiate loading of triggers +# (connect using NULL database); + +--connect (con3,localhost,root,,) +--echo +--echo ---> connection: con3 + +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| + +INSERT INTO mysqltest1.t1 VALUES(0)| +INSERT INTO mysqltest2.t1 VALUES(0)| + +DELETE FROM mysqltest1.log| +DELETE FROM mysqltest2.log| + +# - Restore environment; + +set names utf8| + +use mysqltest1| + +# - Check! + +--source include/ddl_i18n.check_triggers.inc + +# +# Cleanup. +# + +--connection default +--echo +--echo ---> connection: default + +--disconnect con2 +--disconnect con3 + +use test| + +DROP DATABASE mysqltest1| +DROP DATABASE mysqltest2| + +########################################################################### +# +# * Events +# +# We don't have EXECUTE EVENT so far, so this test is limited. It checks that +# event with non-latin1 symbols can be created, dumped, restored and SHOW +# statements work properly. +# +########################################################################### + +--echo +--echo ------------------------------------------------------------------- +--echo Events +--echo ------------------------------------------------------------------- +--echo + +# +# Preparation: +# + +# - Create database with fixed, pre-defined character set. + +--disable_warnings +DROP DATABASE IF EXISTS mysqltest1| +DROP DATABASE IF EXISTS mysqltest2| +--enable_warnings + +CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| +CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| + +use mysqltest1| + +# - Create two stored routines -- with and without explicit +# CHARSET-clause for SP-variable; +# + +--echo + +# - Event ev1 + +CREATE EVENT ev1 ON SCHEDULE AT '2030-01-01 00:00:00' DO +BEGIN + DECLARE перем1 CHAR(10); + + SELECT + COLLATION(перем1) AS c1, + COLLATION('текÑÑ‚') AS c2, + COLLATION(_utf8 'текÑÑ‚') AS c3, + COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, + @@collation_connection AS c5, + @@character_set_client AS c6; +END| + +--echo + +# - Event ev2 + +CREATE EVENT ev2 ON SCHEDULE AT '2030-01-01 00:00:00' DO +BEGIN + DECLARE перем1 CHAR(10) CHARACTER SET utf8; + + SELECT + COLLATION(перем1) AS c1, + COLLATION('текÑÑ‚') AS c2, + COLLATION(_utf8 'текÑÑ‚') AS c3, + COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, + @@collation_connection AS c5, + @@character_set_client AS c6; +END| + +--echo + +# - Event ev3 + +CREATE EVENT mysqltest2.ev3 ON SCHEDULE AT '2030-01-01 00:00:00' DO +BEGIN + DECLARE перем1 CHAR(10) CHARACTER SET utf8; + + SELECT + COLLATION(перем1) AS c1, + COLLATION('текÑÑ‚') AS c2, + COLLATION(_utf8 'текÑÑ‚') AS c3, + COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, + @@collation_connection AS c5, + @@character_set_client AS c6; +END| + +--echo + +# - Event ev4 + +CREATE EVENT mysqltest2.ev4 ON SCHEDULE AT '2030-01-01 00:00:00' DO +BEGIN + DECLARE перем1 CHAR(10) CHARACTER SET utf8; + + SELECT + COLLATION(перем1) AS c1, + COLLATION('текÑÑ‚') AS c2, + COLLATION(_utf8 'текÑÑ‚') AS c3, + COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, + @@collation_connection AS c5, + @@character_set_client AS c6; +END| + +--echo + + +# +# First-round checks. +# + +--source include/ddl_i18n.check_events.inc + +# +# Change running environment (alter database character set, change session +# variables). +# + +--echo +--echo + +ALTER DATABASE mysqltest1 COLLATE cp866_general_ci| +ALTER DATABASE mysqltest2 COLLATE cp866_general_ci| + +# +# Second-round checks: +# + +# - Change connection to flush cache; + +--connect (con2,localhost,root,,mysqltest1) +--echo +--echo ---> connection: con2 + +# - Switch environment variables and trigger loading stored procedures; + +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| + +--disable_result_log +SHOW CREATE EVENT ev1| +SHOW CREATE EVENT ev2| +SHOW CREATE EVENT mysqltest2.ev3| +SHOW CREATE EVENT mysqltest2.ev4| +--enable_result_log + +# - Restore environment; + +set names utf8| + +# - Check! + +--source include/ddl_i18n.check_events.inc + +# +# Check mysqldump. +# + +# - Dump mysqltest1, mysqltest2; + +--echo +--echo ---> Dump of mysqltest1 + +--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest1 + +--echo +--echo ---> Dumping mysqltest1 to ddl_i18n_utf8events.mysqltest1.sql + +--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest1 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8events.mysqltest1.sql + +--echo +--echo ---> Dump of mysqltest2 + +--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest2 + +--echo +--echo ---> Dumping mysqltest2 to ddl_i18n_utf8events.mysqltest2.sql + +--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --compact --events --databases mysqltest2 > $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8events.mysqltest2.sql + +# - Clean mysqltest1, mysqltest2; + +--echo +--echo + +DROP DATABASE mysqltest1| +DROP DATABASE mysqltest2| + +# - Restore mysqltest1; + +--echo +--echo + +--echo ---> Restoring mysqltest1... +--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8events.mysqltest1.sql + +--echo ---> Restoring mysqltest2... +--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/ddl_i18n_utf8events.mysqltest2.sql + +# +# Third-round checks. +# + +# - Change connection to flush cache; + +--connect (con3,localhost,root,,mysqltest1) +--echo +--echo ---> connection: con3 + +# - Switch environment variables and trigger loading stored procedures; + +SET @@character_set_client= cp1251| +SET @@character_set_results= cp1251| +SET @@collation_connection= cp1251_general_ci| + +--disable_result_log +SHOW CREATE EVENT ev1| +SHOW CREATE EVENT ev2| +SHOW CREATE EVENT mysqltest2.ev3| +SHOW CREATE EVENT mysqltest2.ev4| +--enable_result_log + +# - Restore environment; + +set names utf8| + +# - Check! + +--source include/ddl_i18n.check_events.inc + +########################################################################### +# +# * DDL statements inside stored routine. +# +# Here we check that DDL statements use actual database collation even if they +# are called from stored routine. +# +########################################################################### + +--echo +--echo ------------------------------------------------------------------- +--echo DDL statements within stored routine. +--echo ------------------------------------------------------------------- +--echo + +# +# Preparation: +# + +# - Create database with fixed, pre-defined character set. + +--disable_warnings +DROP DATABASE IF EXISTS mysqltest1| +DROP DATABASE IF EXISTS mysqltest2| +--enable_warnings + +CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| +CREATE DATABASE mysqltest2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci| + +use mysqltest1| + +# - Create procedures; + +--echo + +CREATE PROCEDURE p1() +BEGIN + CREATE TABLE t1(col1 VARCHAR(10)); + SHOW CREATE TABLE t1; +END| + +--echo + +CREATE PROCEDURE mysqltest2.p2() +BEGIN + CREATE TABLE t2(col1 VARCHAR(10)); + SHOW CREATE TABLE t2; +END| + +--echo + +# +# First-round checks. +# + +CALL p1()| + +--echo + +SHOW CREATE TABLE t1| + +--echo +--echo + +CALL mysqltest2.p2()| + +--echo + +SHOW CREATE TABLE mysqltest2.t2| + +# +# Alter database. +# + +--echo + +ALTER DATABASE mysqltest1 COLLATE cp1251_general_cs| +ALTER DATABASE mysqltest2 COLLATE cp1251_general_cs| + +DROP TABLE t1| +DROP TABLE mysqltest2.t2| + +--echo + +# +# Second-round checks. +# + +CALL p1()| + +--echo + +SHOW CREATE TABLE t1| + +--echo +--echo + +CALL mysqltest2.p2()| + +--echo + +SHOW CREATE TABLE mysqltest2.t2| + +########################################################################### +# +# That's it. +# +########################################################################### + +# +# Cleanup. +# + +--connection default +--echo +--echo ---> connection: default + +--disconnect con2 +--disconnect con3 + +use test| + +DROP DATABASE mysqltest1| +DROP DATABASE mysqltest2| diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 746af7a6c38..1ddecb5a887 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -19,7 +19,6 @@ im_instance_conf : Bug#20294 2007-05-30 alik Instance manager tests im_life_cycle : BUG#27851 Instance manager dies on ASSERT in ~Thread_registry() or from not being able to close a mysqld instance. im_instance_conf : BUG#28743 Instance manager generates warnings in test suite im_utils : BUG#28743 Instance manager generates warnings in test suite -innodb : Disabling test case awaiting reply from Innobase concurrent_innodb : BUG#21579 2006-08-11 mleich innodb_concurrent random failures with varying differences ndb_autodiscover : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog ndb_autodiscover2 : BUG#18952 2006-02-16 jmiller Needs to be fixed w.r.t binlog @@ -35,6 +34,8 @@ rpl_ndb_innodb2ndb : Bug #19710 Cluster replication to partition table fa rpl_ndb_myisam2ndb : Bug #19710 Cluster replication to partition table fails on DELETE FROM statement #rpl_row_blob_innodb : BUG#18980 2006-04-10 kent Test fails randomly rpl_ndb_ddl : BUG#28798 2007-05-31 lars Valgrind failure in NDB +rpl_ndb_mix_innodb : BUG#28123 rpl_ndb_mix_innodb.test casue slave to core on sol10-sparc-a +rpl_ndb_ctype_ucs2_def : BUG#27404 util thd mysql_parse sig11 when mysqld default multibyte charset rpl_invoked_features : BUG#29020 2007-06-21 Lars Non-deterministic test case ctype_big5 : BUG#26711 2007-06-21 Lars Test has never worked on Double Whopper @@ -51,5 +52,4 @@ im_options_set : Bug#20294: Instance manager tests fail randomly im_options_unset : Bug#20294: Instance manager tests fail randomly mysql_upgrade : Bug#28560 test links to /usr/local/mysql/lib libraries, causes non-determinism and failures on ABI breakage rpl_udf : Bug#28993 rpl_udf test causes server crash and valgrind warning in pushbuild -rpl_ndb_circular : Bug#29233 rpl_ndb_circular fails randomly ndb_dd_sql_features : Bug#29102 ndb_dd_sql_features fails in pushbuild diff --git a/mysql-test/t/errors.test b/mysql-test/t/errors.test index 4fbdcba635f..89579ec1739 100644 --- a/mysql-test/t/errors.test +++ b/mysql-test/t/errors.test @@ -53,4 +53,17 @@ INSERT INTO t1 VALUES(2),(3); SELECT a FROM t1 WHERE a IN(1, (SELECT IF(1=0,1,2/0))); DROP TABLE t1; +# +# Bug #28677: SELECT on missing column gives extra error +# +CREATE TABLE t1( a INT ); +--error ER_BAD_FIELD_ERROR +SELECT b FROM t1; +SHOW ERRORS; +--error ER_BAD_FIELD_ERROR +CREATE TABLE t2 SELECT b FROM t1; +SHOW ERRORS; +--error ER_BAD_FIELD_ERROR +INSERT INTO t1 SELECT b FROM t1; +DROP TABLE t1; # End of 5.0 tests diff --git a/mysql-test/t/events.test b/mysql-test/t/events.test index dcb591352a8..d7232705b81 100644 --- a/mysql-test/t/events.test +++ b/mysql-test/t/events.test @@ -185,7 +185,30 @@ set names cp1251; create event ðóóò21 on schedule every '50:23:59:95' day_second COMMENT 'òîâà å 1251 êîìåíòàð' do select 1; --replace_regex /STARTS '[^']+'/STARTS '#'/ SHOW CREATE EVENT ðóóò21; -insert into mysql.event (db, name, body, definer, interval_value, interval_field, originator) values (database(), "root22", "select 1", user(), 100, "SECOND_MICROSECOND", 1); +insert into mysql.event ( + db, + name, + body, + definer, + interval_value, + interval_field, + originator, + character_set_client, + collation_connection, + db_collation, + body_utf8) +values ( + database(), + "root22", + "select 1", + user(), + 100, + "SECOND_MICROSECOND", + 1, + 'utf8', + 'utf8_general_ci', + 'utf8_general_ci', + 'select 1'); --error ER_NOT_SUPPORTED_YET show create event root22; --error ER_NOT_SUPPORTED_YET diff --git a/mysql-test/t/events_bugs.test b/mysql-test/t/events_bugs.test index f369fbecd66..4186b4701fa 100644 --- a/mysql-test/t/events_bugs.test +++ b/mysql-test/t/events_bugs.test @@ -648,7 +648,69 @@ CREATE EVENT new_event ON SCHEDULE AT NOW() ENDS NOW() DO SELECT 1; --error ER_PARSE_ERROR CREATE EVENT new_event ON SCHEDULE AT NOW() STARTS NOW() ENDS NOW() DO SELECT 1; - +# +# START - BUG#28924 If I drop the user who is the definer of an active event then server cores +# +let $engine=MyISAM; +USE test; +SHOW GRANTS FOR CURRENT_USER; +SET GLOBAL event_scheduler = ON; +eval CREATE TABLE event_log (id int KEY AUTO_INCREMENT, + ev_nm char(40), ev_cnt int, + ev_tm timestamp) ENGINE=$engine; +SET @ev_base_date = 20281224180000; +--disable_warnings +SET autocommit=0; +#DROP DATABASE IF EXISTS ev_db_1; +#CREATE DATABASE ev_db_1; +--enable_warnings +CREATE USER evtest1@localhost; +SET PASSWORD FOR evtest1@localhost = password('ev1'); +REVOKE ALL PRIVILEGES, GRANT OPTION FROM evtest1@localhost; +GRANT create, insert, select, event ON events_test.* TO evtest1@localhost; +GRANT select,insert ON test.* TO evtest1@localhost; +SHOW GRANTS FOR evtest1@localhost; + +--echo connection e1; +--replace_result $MASTER_MYPORT MASTER_MYPORT $MASTER_MYSOCK MASTER_MYSOCK +connect (e1,localhost,evtest1,ev1,events_test,$MASTER_MYPORT,$MASTER_MYSOCK); +USE events_test; + +DELIMITER |; +CREATE EVENT ev_sched_1823 ON SCHEDULE EVERY 2 SECOND +DO BEGIN + SET AUTOCOMMIT = 0; + SET @evname = 'ev_sched_1823'; + SET @cnt = 0; + SELECT COUNT(*) INTO @cnt FROM test.event_log WHERE ev_nm = @evname; + IF @cnt < 6 THEN + INSERT INTO test.event_log VALUES (NULL,@evname,@cnt+1,current_timestamp()); + COMMIT; + END IF; + SELECT COUNT(*) INTO @cnt FROM test.event_log WHERE ev_nm = @evname; + IF @cnt < 6 THEN + INSERT INTO test.event_log VALUES (NULL,@evname,@cnt+1,current_timestamp()); + ROLLBACK; + END IF; +END;| +DELIMITER ;| + +--sleep 6 +--echo connection default; +DROP EVENT ev_sched_1823; +connection default; +DROP USER evtest1@localhost; + +--sleep 6 +USE test; +--echo ===================================================================================== +--sleep 5 +#--disable_result_log +select id,ev_nm,ev_cnt from event_log order by id; +#--enable_result_log +DROP TABLE event_log; +#DROP DATABASE ev_db_1; +SET GLOBAL event_scheduler = OFF; # # End of tests diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index 755419cbf52..9babeddbae2 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -825,7 +825,7 @@ drop table t1; use mysql; INSERT INTO `proc` VALUES ('test','','PROCEDURE','','SQL','CONTAINS_SQL', 'NO','DEFINER','','','BEGIN\r\n \r\nEND','root@%','2006-03-02 18:40:03', -'2006-03-02 18:40:03','',''); +'2006-03-02 18:40:03','','','utf8','utf8_general_ci','utf8_general_ci','n/a'); select routine_name from information_schema.routines; delete from proc where name=''; use test; diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index 1ca6b8b4d98..321a1f4763a 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -13,6 +13,11 @@ -- source include/not_embedded.inc -- source include/have_innodb.inc +-- source include/have_log_bin.inc + +# Disabling it temporarily for statement-based logging since some +# tests are not safe while binlog is on. +-- source include/have_binlog_format_mixed_or_row.inc # # Small basic test with ignore @@ -774,7 +779,7 @@ CREATE TABLE `t2` ( insert into t1 values (1,1),(2,2); insert into t2 values (1,1),(4,4); reset master; ---error ER_DUP_ENTRY_WITH_KEY_NAME +--error ER_DUP_ENTRY UPDATE t2,t1 SET t2.a=t1.a+2; # check select * from t2 /* must be (3,1), (4,4) */; @@ -786,7 +791,7 @@ delete from t2; insert into t1 values (1,2),(3,4),(4,4); insert into t2 values (1,2),(3,4),(4,4); reset master; ---error ER_DUP_ENTRY_WITH_KEY_NAME +--error ER_DUP_ENTRY UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a; show master status /* there must be no UPDATE query event */; diff --git a/mysql-test/t/loaddata_autocom_ndb.test b/mysql-test/t/loaddata_autocom_ndb.test index a6a3aec2c4e..f4a6743aabe 100644 --- a/mysql-test/t/loaddata_autocom_ndb.test +++ b/mysql-test/t/loaddata_autocom_ndb.test @@ -1,5 +1,4 @@ --source include/have_ndb.inc ---source include/have_binlog_format_mixed_or_row.inc let $engine_type=ndbcluster; --source include/loaddata_autocom.inc diff --git a/mysql-test/t/ndb_alter_table.test b/mysql-test/t/ndb_alter_table.test index d85e4900337..082fe726927 100644 --- a/mysql-test/t/ndb_alter_table.test +++ b/mysql-test/t/ndb_alter_table.test @@ -1,5 +1,3 @@ --- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/have_multi_ndb.inc -- source include/not_embedded.inc diff --git a/mysql-test/t/ndb_alter_table2.test b/mysql-test/t/ndb_alter_table2.test index 654453cc4cf..f078ed6b479 100644 --- a/mysql-test/t/ndb_alter_table2.test +++ b/mysql-test/t/ndb_alter_table2.test @@ -1,5 +1,3 @@ --- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/have_multi_ndb.inc -- source include/not_embedded.inc diff --git a/mysql-test/t/ndb_alter_table3.test b/mysql-test/t/ndb_alter_table3.test index 2f8f9ebcf89..86e664b23b0 100644 --- a/mysql-test/t/ndb_alter_table3.test +++ b/mysql-test/t/ndb_alter_table3.test @@ -1,5 +1,3 @@ --- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/have_multi_ndb.inc -- source include/not_embedded.inc diff --git a/mysql-test/t/ndb_autodiscover.test b/mysql-test/t/ndb_autodiscover.test index 6e70b8f5979..06d47693c10 100644 --- a/mysql-test/t/ndb_autodiscover.test +++ b/mysql-test/t/ndb_autodiscover.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/not_embedded.inc --disable_warnings diff --git a/mysql-test/t/ndb_autodiscover2.test b/mysql-test/t/ndb_autodiscover2.test index 360ce7195a8..ebe14696cd2 100644 --- a/mysql-test/t/ndb_autodiscover2.test +++ b/mysql-test/t/ndb_autodiscover2.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/not_embedded.inc # diff --git a/mysql-test/t/ndb_autodiscover3.test b/mysql-test/t/ndb_autodiscover3.test index 36ee191c065..452ccc50b4d 100644 --- a/mysql-test/t/ndb_autodiscover3.test +++ b/mysql-test/t/ndb_autodiscover3.test @@ -1,5 +1,3 @@ --- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/have_multi_ndb.inc -- source include/ndb_default_cluster.inc -- source include/not_embedded.inc @@ -11,6 +9,9 @@ drop table if exists t1, t2; --enable_warnings +connect (con1,127.0.0.1,root,,test,$MASTER_MYPORT,); +connect (con2,127.0.0.1,root,,test,$MASTER_MYPORT1,); + # Workaround for Bug#27644 # ndb: connecting api node/mysqld may "steal" node_id from running mysqld # - let ndb_waiter use a fixed node id so "steal" cannot happen @@ -28,8 +29,14 @@ insert into t1 values (1); --exec $NDB_MGM --no-defaults -e "all restart" >> $NDB_TOOLS_OUTPUT --exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults -c $connect_str >> $NDB_TOOLS_OUTPUT # Wait for mysqld to reconnect and exit from readonly mode -# Should preferrably be a "while (!"select ndb_readonly")" loop -sleep 2; +--disable_query_log +--connection con1 +--source include/ndb_not_readonly.inc +--connection con2 +--source include/ndb_not_readonly.inc +--enable_query_log + +--connection server1 --error 1297 insert into t1 values (2); --error 1296 @@ -48,8 +55,13 @@ select * from t2 order by a limit 3; --exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT --exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults -c $connect_str >> $NDB_TOOLS_OUTPUT # to ensure mysqld has connected again, and recreated system tables ---exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -r 30 -d cluster ndb_apply_status >> $NDB_TOOLS_OUTPUT -sleep 2; +--disable_query_log +--connection con1 +--source include/ndb_not_readonly.inc +--connection con2 +--source include/ndb_not_readonly.inc +--enable_query_log + --connection server2 --error ER_NO_SUCH_TABLE select * from t2; @@ -67,8 +79,13 @@ reset master; --exec $NDB_MGM --no-defaults -e "all restart -i" >> $NDB_TOOLS_OUTPUT --exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults -c $connect_str >> $NDB_TOOLS_OUTPUT # to ensure mysqld has connected again, and recreated system tables ---exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -r 30 -d cluster ndb_apply_status >> $NDB_TOOLS_OUTPUT -sleep 2; +--disable_query_log +--connection con1 +--source include/ndb_not_readonly.inc +--connection con2 +--source include/ndb_not_readonly.inc +--enable_query_log + --connection server1 --error ER_NO_SUCH_TABLE select * from t2; diff --git a/mysql-test/t/ndb_basic.test b/mysql-test/t/ndb_basic.test index 8ef231599fa..b9ccdf9fd0d 100644 --- a/mysql-test/t/ndb_basic.test +++ b/mysql-test/t/ndb_basic.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/not_embedded.inc --disable_warnings diff --git a/mysql-test/t/ndb_binlog_ddl_multi.test b/mysql-test/t/ndb_binlog_ddl_multi.test index 487dfbf16e5..e159fd6a24e 100644 --- a/mysql-test/t/ndb_binlog_ddl_multi.test +++ b/mysql-test/t/ndb_binlog_ddl_multi.test @@ -1,4 +1,3 @@ --- source include/have_ndb.inc -- source include/have_multi_ndb.inc -- source include/have_binlog_format_row.inc diff --git a/mysql-test/t/ndb_binlog_format.test b/mysql-test/t/ndb_binlog_format.test new file mode 100644 index 00000000000..acb34bb388c --- /dev/null +++ b/mysql-test/t/ndb_binlog_format.test @@ -0,0 +1,33 @@ +# +# test different behavior of ndb using different binlog formats +# + +-- source include/have_blackhole.inc +-- source include/have_ndb.inc +-- source include/have_log_bin.inc + +--disable_warnings +drop table if exists t1, t2, t3; +--enable_warnings + +# +# Bug #29222 Statement mode replicates both statement and +# rows when writing to an NDB table +# +CREATE TABLE t1 (m INT, n INT) ENGINE=MYISAM; +CREATE TABLE t2 (b INT, c INT) ENGINE=BLACKHOLE; +CREATE TABLE t3 (e INT, f INT) ENGINE=NDB; +RESET MASTER; +SET SESSION BINLOG_FORMAT=STATEMENT; +INSERT INTO t1 VALUES (1,1), (1,2), (2,1), (2,2); +INSERT INTO t2 VALUES (1,1), (1,2), (2,1), (2,2); +UPDATE t1, t2 SET m = 2, b = 3 WHERE n = c; +# A transaction here is not necessary, but I wanted to group the bad statements +START TRANSACTION; +INSERT INTO t3 VALUES (1,1), (1,2), (2,1), (2,2); +UPDATE t1, t3 SET m = 2, e = 3 WHERE n = f; +UPDATE t3, t2 SET e = 2, b = 3 WHERE f = c; +COMMIT; +--source include/show_binlog_events.inc +DROP TABLE t1, t2, t3; + diff --git a/mysql-test/t/ndb_binlog_log_bin.test b/mysql-test/t/ndb_binlog_log_bin.test index 63b84134824..921b8608795 100644 --- a/mysql-test/t/ndb_binlog_log_bin.test +++ b/mysql-test/t/ndb_binlog_log_bin.test @@ -1,5 +1,3 @@ --- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/have_multi_ndb.inc -- source include/have_binlog_format_row.inc diff --git a/mysql-test/t/ndb_binlog_multi.test b/mysql-test/t/ndb_binlog_multi.test index 4256b0bf993..14bd7ef174b 100644 --- a/mysql-test/t/ndb_binlog_multi.test +++ b/mysql-test/t/ndb_binlog_multi.test @@ -1,5 +1,3 @@ --- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/have_multi_ndb.inc -- source include/have_binlog_format_row.inc diff --git a/mysql-test/t/ndb_bitfield.test b/mysql-test/t/ndb_bitfield.test index c8454f38cca..de0ae23bfe6 100644 --- a/mysql-test/t/ndb_bitfield.test +++ b/mysql-test/t/ndb_bitfield.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/not_embedded.inc --disable_warnings diff --git a/mysql-test/t/ndb_blob.test b/mysql-test/t/ndb_blob.test index b565de74c26..b9a8c7e20ee 100644 --- a/mysql-test/t/ndb_blob.test +++ b/mysql-test/t/ndb_blob.test @@ -1,5 +1,4 @@ --source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/not_embedded.inc --disable_warnings diff --git a/mysql-test/t/ndb_blob_partition.test b/mysql-test/t/ndb_blob_partition.test index 13ad2ecc7c3..35df57b96ba 100644 --- a/mysql-test/t/ndb_blob_partition.test +++ b/mysql-test/t/ndb_blob_partition.test @@ -1,5 +1,4 @@ --source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/not_embedded.inc --disable_query_log diff --git a/mysql-test/t/ndb_cache.test b/mysql-test/t/ndb_cache.test index d8cb8b01e86..9c299b61c24 100644 --- a/mysql-test/t/ndb_cache.test +++ b/mysql-test/t/ndb_cache.test @@ -1,5 +1,4 @@ -- source include/have_query_cache.inc --- source include/have_binlog_format_row.inc -- source include/have_ndb.inc -- source include/not_embedded.inc diff --git a/mysql-test/t/ndb_cache2.test b/mysql-test/t/ndb_cache2.test index 27d39b09cf6..352b01ef73f 100644 --- a/mysql-test/t/ndb_cache2.test +++ b/mysql-test/t/ndb_cache2.test @@ -1,5 +1,4 @@ -- source include/have_query_cache.inc --- source include/have_binlog_format_row.inc -- source include/have_ndb.inc -- source include/not_embedded.inc diff --git a/mysql-test/t/ndb_cache_multi.test b/mysql-test/t/ndb_cache_multi.test index a7095139285..8c7f186b866 100644 --- a/mysql-test/t/ndb_cache_multi.test +++ b/mysql-test/t/ndb_cache_multi.test @@ -1,6 +1,4 @@ -- source include/have_query_cache.inc --- source include/have_binlog_format_row.inc --- source include/have_ndb.inc -- source include/have_multi_ndb.inc -- source include/not_embedded.inc diff --git a/mysql-test/t/ndb_cache_multi2.test b/mysql-test/t/ndb_cache_multi2.test index 40cc41f1c97..853e4090193 100644 --- a/mysql-test/t/ndb_cache_multi2.test +++ b/mysql-test/t/ndb_cache_multi2.test @@ -1,6 +1,4 @@ -- source include/have_query_cache.inc --- source include/have_binlog_format_row.inc --- source include/have_ndb.inc -- source include/have_multi_ndb.inc -- source include/not_embedded.inc diff --git a/mysql-test/t/ndb_charset.test b/mysql-test/t/ndb_charset.test index b36b70be94c..2d9f66564bc 100644 --- a/mysql-test/t/ndb_charset.test +++ b/mysql-test/t/ndb_charset.test @@ -1,5 +1,4 @@ --source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/not_embedded.inc --disable_warnings diff --git a/mysql-test/t/ndb_condition_pushdown.test b/mysql-test/t/ndb_condition_pushdown.test index 9df494aa3ab..ab56430ac1d 100644 --- a/mysql-test/t/ndb_condition_pushdown.test +++ b/mysql-test/t/ndb_condition_pushdown.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/not_embedded.inc --disable_warnings diff --git a/mysql-test/t/ndb_config.test b/mysql-test/t/ndb_config.test index eb52bd249d6..f63c0087c1e 100644 --- a/mysql-test/t/ndb_config.test +++ b/mysql-test/t/ndb_config.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/ndb_default_cluster.inc -- source include/not_embedded.inc diff --git a/mysql-test/t/ndb_config2.test b/mysql-test/t/ndb_config2.test index 20946b53552..170f1b2e5e7 100644 --- a/mysql-test/t/ndb_config2.test +++ b/mysql-test/t/ndb_config2.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/ndb_default_cluster.inc -- source include/not_embedded.inc diff --git a/mysql-test/t/ndb_cursor.test b/mysql-test/t/ndb_cursor.test index 1ef745a13f7..406f8629cfe 100644 --- a/mysql-test/t/ndb_cursor.test +++ b/mysql-test/t/ndb_cursor.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/not_embedded.inc --disable_warnings diff --git a/mysql-test/t/ndb_database.test b/mysql-test/t/ndb_database.test index 409ac33502a..8bfdf40de88 100644 --- a/mysql-test/t/ndb_database.test +++ b/mysql-test/t/ndb_database.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/not_embedded.inc --disable_warnings diff --git a/mysql-test/t/ndb_dd_alter.test b/mysql-test/t/ndb_dd_alter.test index ee58968247f..7635a8944da 100644 --- a/mysql-test/t/ndb_dd_alter.test +++ b/mysql-test/t/ndb_dd_alter.test @@ -40,7 +40,6 @@ ############################################################## -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/have_innodb.inc -- source include/not_embedded.inc diff --git a/mysql-test/t/ndb_dd_backuprestore.test b/mysql-test/t/ndb_dd_backuprestore.test index 156ff88718e..48db8ec3e0b 100644 --- a/mysql-test/t/ndb_dd_backuprestore.test +++ b/mysql-test/t/ndb_dd_backuprestore.test @@ -5,7 +5,6 @@ ######################################## -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/ndb_default_cluster.inc -- source include/not_embedded.inc diff --git a/mysql-test/t/ndb_dd_basic.test b/mysql-test/t/ndb_dd_basic.test index d20ffc6e4bd..3acf4669868 100644 --- a/mysql-test/t/ndb_dd_basic.test +++ b/mysql-test/t/ndb_dd_basic.test @@ -13,7 +13,6 @@ ################################# -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc --disable_warnings DROP TABLE IF EXISTS t1; diff --git a/mysql-test/t/ndb_dd_ddl.test b/mysql-test/t/ndb_dd_ddl.test index 10229e4c0c2..aa692385b07 100644 --- a/mysql-test/t/ndb_dd_ddl.test +++ b/mysql-test/t/ndb_dd_ddl.test @@ -27,7 +27,6 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc --disable_warnings DROP TABLE IF EXISTS t1; diff --git a/mysql-test/t/ndb_dd_disk2memory.test b/mysql-test/t/ndb_dd_disk2memory.test index 760a1377bdf..5975f44e087 100644 --- a/mysql-test/t/ndb_dd_disk2memory.test +++ b/mysql-test/t/ndb_dd_disk2memory.test @@ -6,7 +6,6 @@ ######################################## -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc --disable_warnings DROP TABLE IF EXISTS test.t1; diff --git a/mysql-test/t/ndb_dd_dump.test b/mysql-test/t/ndb_dd_dump.test index 54128d075ca..38ceafb7d80 100644 --- a/mysql-test/t/ndb_dd_dump.test +++ b/mysql-test/t/ndb_dd_dump.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc --disable_warnings DROP TABLE IF EXISTS t1, t2, t3; diff --git a/mysql-test/t/ndb_dd_sql_features.test b/mysql-test/t/ndb_dd_sql_features.test index ae8f6a7b9e7..f46cb217ab4 100644 --- a/mysql-test/t/ndb_dd_sql_features.test +++ b/mysql-test/t/ndb_dd_sql_features.test @@ -26,7 +26,6 @@ # gives a better idea of what the test is about ########################################################### -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc --disable_warnings DROP TABLE IF EXISTS test.t1; diff --git a/mysql-test/t/ndb_gis.test b/mysql-test/t/ndb_gis.test index 104fdf41734..e14f462c32d 100644 --- a/mysql-test/t/ndb_gis.test +++ b/mysql-test/t/ndb_gis.test @@ -1,5 +1,4 @@ --source include/have_ndb.inc --- source include/have_binlog_format_row.inc SET storage_engine=ndbcluster; --source include/gis_generic.inc set engine_condition_pushdown = on; diff --git a/mysql-test/t/ndb_index.test b/mysql-test/t/ndb_index.test index fc284407973..272f30e3e6f 100644 --- a/mysql-test/t/ndb_index.test +++ b/mysql-test/t/ndb_index.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/not_embedded.inc --disable_warnings diff --git a/mysql-test/t/ndb_index_ordered.test b/mysql-test/t/ndb_index_ordered.test index 95b64eeef21..782f17ca5b2 100644 --- a/mysql-test/t/ndb_index_ordered.test +++ b/mysql-test/t/ndb_index_ordered.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/not_embedded.inc --disable_warnings diff --git a/mysql-test/t/ndb_index_unique.test b/mysql-test/t/ndb_index_unique.test index ecd4077bb56..78757c3bcf7 100644 --- a/mysql-test/t/ndb_index_unique.test +++ b/mysql-test/t/ndb_index_unique.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/not_embedded.inc --disable_warnings diff --git a/mysql-test/t/ndb_insert.test b/mysql-test/t/ndb_insert.test index 4b347e1a1ad..5b74cc9202c 100644 --- a/mysql-test/t/ndb_insert.test +++ b/mysql-test/t/ndb_insert.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/not_embedded.inc --disable_warnings diff --git a/mysql-test/t/ndb_limit.test b/mysql-test/t/ndb_limit.test index b0d189ff5d9..01613606d66 100644 --- a/mysql-test/t/ndb_limit.test +++ b/mysql-test/t/ndb_limit.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/not_embedded.inc --disable_warnings diff --git a/mysql-test/t/ndb_loaddatalocal.test b/mysql-test/t/ndb_loaddatalocal.test index 7453ae1bd64..3eae3891f43 100644 --- a/mysql-test/t/ndb_loaddatalocal.test +++ b/mysql-test/t/ndb_loaddatalocal.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/not_embedded.inc --disable_warnings diff --git a/mysql-test/t/ndb_lock.test b/mysql-test/t/ndb_lock.test index e677cba8e59..b6cd1ca7eb4 100644 --- a/mysql-test/t/ndb_lock.test +++ b/mysql-test/t/ndb_lock.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/not_embedded.inc connect (con1,localhost,root,,); diff --git a/mysql-test/t/ndb_minmax.test b/mysql-test/t/ndb_minmax.test index 4d9f132194a..a3ac677cd2a 100644 --- a/mysql-test/t/ndb_minmax.test +++ b/mysql-test/t/ndb_minmax.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/not_embedded.inc --disable_warnings diff --git a/mysql-test/t/ndb_multi.test b/mysql-test/t/ndb_multi.test index 3e25227ae80..3482db1d1b2 100644 --- a/mysql-test/t/ndb_multi.test +++ b/mysql-test/t/ndb_multi.test @@ -1,6 +1,5 @@ -- source include/have_ndb.inc -- source include/have_multi_ndb.inc --- source include/have_binlog_format_row.inc -- source include/not_embedded.inc --disable_warnings diff --git a/mysql-test/t/ndb_partition_error.test b/mysql-test/t/ndb_partition_error.test index ce25dfc0fd5..9db2a6a6f6d 100644 --- a/mysql-test/t/ndb_partition_error.test +++ b/mysql-test/t/ndb_partition_error.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc #--disable_abort_on_error # # Simple test for the partition storage engine diff --git a/mysql-test/t/ndb_partition_key.test b/mysql-test/t/ndb_partition_key.test index 4760022d20f..78e2c9d15c2 100644 --- a/mysql-test/t/ndb_partition_key.test +++ b/mysql-test/t/ndb_partition_key.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc --disable_warnings DROP TABLE IF EXISTS t1; diff --git a/mysql-test/t/ndb_partition_list.test b/mysql-test/t/ndb_partition_list.test index 35c7104ff92..ccfcdbc84f4 100644 --- a/mysql-test/t/ndb_partition_list.test +++ b/mysql-test/t/ndb_partition_list.test @@ -1,5 +1,4 @@ --source include/have_ndb.inc --- source include/have_binlog_format_row.inc # # Simple test for the partition storage engine # Focuses on range partitioning tests diff --git a/mysql-test/t/ndb_partition_range.test b/mysql-test/t/ndb_partition_range.test index e34cb92771c..7952ba502d2 100644 --- a/mysql-test/t/ndb_partition_range.test +++ b/mysql-test/t/ndb_partition_range.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc #--disable_abort_on_error # # Simple test for the partition storage engine diff --git a/mysql-test/t/ndb_read_multi_range.test b/mysql-test/t/ndb_read_multi_range.test index b4e5943269c..ecca1f9862c 100644 --- a/mysql-test/t/ndb_read_multi_range.test +++ b/mysql-test/t/ndb_read_multi_range.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/not_embedded.inc --disable_warnings @@ -286,7 +285,7 @@ CREATE TABLE t2 ( var1 int(2) NOT NULL, var2 int(2) NOT NULL, PRIMARY KEY (var1) - ) ENGINE=MyISAM DEFAULT CHARSET=ascii CHECKSUM=1; + ) ENGINE=ndbcluster DEFAULT CHARSET=ascii CHECKSUM=1; DELIMITER |; diff --git a/mysql-test/t/ndb_rename.test b/mysql-test/t/ndb_rename.test index 1b2f6d72119..7f9fd0e6984 100644 --- a/mysql-test/t/ndb_rename.test +++ b/mysql-test/t/ndb_rename.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/not_embedded.inc --disable_warnings diff --git a/mysql-test/t/ndb_replace.test b/mysql-test/t/ndb_replace.test index cb5f1cc46cb..aa2072b98dd 100644 --- a/mysql-test/t/ndb_replace.test +++ b/mysql-test/t/ndb_replace.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/not_embedded.inc # diff --git a/mysql-test/t/ndb_restore.test b/mysql-test/t/ndb_restore.test index 2414e6b7268..7f0cafdfd77 100644 --- a/mysql-test/t/ndb_restore.test +++ b/mysql-test/t/ndb_restore.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/ndb_default_cluster.inc -- source include/not_embedded.inc diff --git a/mysql-test/t/ndb_restore_partition.test b/mysql-test/t/ndb_restore_partition.test index 0cddc38a876..f11324492c2 100644 --- a/mysql-test/t/ndb_restore_partition.test +++ b/mysql-test/t/ndb_restore_partition.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/ndb_default_cluster.inc -- source include/not_embedded.inc diff --git a/mysql-test/t/ndb_restore_print.test b/mysql-test/t/ndb_restore_print.test index d198623886b..6dbbfdf5933 100644 --- a/mysql-test/t/ndb_restore_print.test +++ b/mysql-test/t/ndb_restore_print.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/ndb_default_cluster.inc -- source include/not_embedded.inc diff --git a/mysql-test/t/ndb_row_format.test b/mysql-test/t/ndb_row_format.test index 49d771e4017..b1582cbe339 100644 --- a/mysql-test/t/ndb_row_format.test +++ b/mysql-test/t/ndb_row_format.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/not_embedded.inc --disable_warnings diff --git a/mysql-test/t/ndb_single_user.test b/mysql-test/t/ndb_single_user.test index 5d2ee0a3a8d..f059ea9ba23 100644 --- a/mysql-test/t/ndb_single_user.test +++ b/mysql-test/t/ndb_single_user.test @@ -1,5 +1,3 @@ --- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/have_multi_ndb.inc -- source include/ndb_default_cluster.inc -- source include/not_embedded.inc diff --git a/mysql-test/t/ndb_sp.test b/mysql-test/t/ndb_sp.test index 703cb116c52..b833869cad0 100644 --- a/mysql-test/t/ndb_sp.test +++ b/mysql-test/t/ndb_sp.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/not_embedded.inc --disable_warnings diff --git a/mysql-test/t/ndb_subquery.test b/mysql-test/t/ndb_subquery.test index c8aec569de9..6282c31c922 100644 --- a/mysql-test/t/ndb_subquery.test +++ b/mysql-test/t/ndb_subquery.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/not_embedded.inc --disable_warnings diff --git a/mysql-test/t/ndb_temporary.test b/mysql-test/t/ndb_temporary.test index 3a9e7c94398..7f6902bf745 100644 --- a/mysql-test/t/ndb_temporary.test +++ b/mysql-test/t/ndb_temporary.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/not_embedded.inc --disable_warnings diff --git a/mysql-test/t/ndb_transaction.test b/mysql-test/t/ndb_transaction.test index dca1fde8fc7..d3ebadb1a78 100644 --- a/mysql-test/t/ndb_transaction.test +++ b/mysql-test/t/ndb_transaction.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/not_embedded.inc --disable_warnings diff --git a/mysql-test/t/ndb_trigger.test b/mysql-test/t/ndb_trigger.test index 00927f93d10..2e944174fd0 100644 --- a/mysql-test/t/ndb_trigger.test +++ b/mysql-test/t/ndb_trigger.test @@ -1,6 +1,5 @@ # Tests which involve triggers and NDB storage engine --source include/have_ndb.inc ---source include/have_binlog_format_row.inc --source include/not_embedded.inc # @@ -19,8 +18,8 @@ drop table if exists t1, t2, t3, t4, t5; --enable_warnings create table t1 (id int primary key, a int not null, b decimal (63,30) default 0) engine=ndb; -create table t2 (op char(1), a int not null, b decimal (63,30)); -create table t3 select 1 as i; +create table t2 (op char(1), a int not null, b decimal (63,30)) engine=ndb; +create table t3 engine=ndb select 1 as i; create table t4 (a int not null primary key, b int) engine=ndb; create table t5 (a int not null primary key, b int) engine=ndb; diff --git a/mysql-test/t/ndb_truncate.test b/mysql-test/t/ndb_truncate.test index a62fd43408d..a1ef4be0d48 100644 --- a/mysql-test/t/ndb_truncate.test +++ b/mysql-test/t/ndb_truncate.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/not_embedded.inc --disable_warnings diff --git a/mysql-test/t/ndb_types.test b/mysql-test/t/ndb_types.test index 9b395c12bf8..ab18817132e 100644 --- a/mysql-test/t/ndb_types.test +++ b/mysql-test/t/ndb_types.test @@ -1,5 +1,4 @@ --source include/have_ndb.inc --- source include/have_binlog_format_row.inc --source include/not_embedded.inc --disable_warnings diff --git a/mysql-test/t/ndb_update.test b/mysql-test/t/ndb_update.test index a864aa28dc3..73a0ebc69cb 100644 --- a/mysql-test/t/ndb_update.test +++ b/mysql-test/t/ndb_update.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/not_embedded.inc --disable_warnings diff --git a/mysql-test/t/ndb_view.test b/mysql-test/t/ndb_view.test index 4f2580ef15e..3b8fc330b40 100644 --- a/mysql-test/t/ndb_view.test +++ b/mysql-test/t/ndb_view.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/not_embedded.inc --disable_warnings diff --git a/mysql-test/t/ndbapi.test b/mysql-test/t/ndbapi.test index d58ed1c5ccd..3424513f8af 100644 --- a/mysql-test/t/ndbapi.test +++ b/mysql-test/t/ndbapi.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/have_ndbapi_examples.inc --disable_warnings diff --git a/mysql-test/t/ps_1general.test b/mysql-test/t/ps_1general.test index 9905d73fc32..13773504fb0 100644 --- a/mysql-test/t/ps_1general.test +++ b/mysql-test/t/ps_1general.test @@ -414,6 +414,10 @@ prepare stmt1 from ' execute stmt2 ' ; --error ER_UNSUPPORTED_PS prepare stmt1 from ' deallocate prepare never_prepared ' ; +## We don't support alter view as prepared statements +--error ER_UNSUPPORTED_PS +prepare stmt1 from 'alter view v1 as select 2'; + ## switch the database connection --error ER_UNSUPPORTED_PS prepare stmt4 from ' use test ' ; diff --git a/mysql-test/t/ps_7ndb.test b/mysql-test/t/ps_7ndb.test index eb98a815d74..e3f65ec2c4e 100644 --- a/mysql-test/t/ps_7ndb.test +++ b/mysql-test/t/ps_7ndb.test @@ -11,7 +11,6 @@ use test; -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc let $type= 'NDB' ; -- source include/ps_create.inc -- source include/ps_renew.inc diff --git a/mysql-test/t/rpl_ndb_commit_afterflush.test b/mysql-test/t/rpl_ndb_commit_afterflush.test index 5bbd7f0414e..7adb62d5668 100644 --- a/mysql-test/t/rpl_ndb_commit_afterflush.test +++ b/mysql-test/t/rpl_ndb_commit_afterflush.test @@ -5,7 +5,7 @@ # By JBM 2004-02-15 # ##################################### -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc -- source include/ndb_master-slave.inc +-- source include/have_log_bin.inc let $engine_type=NDB; -- source extra/rpl_tests/rpl_commit_after_flush.test diff --git a/mysql-test/t/rpl_ndb_ctype_ucs2_def-master.opt b/mysql-test/t/rpl_ndb_ctype_ucs2_def-master.opt new file mode 100644 index 00000000000..84d2a52b639 --- /dev/null +++ b/mysql-test/t/rpl_ndb_ctype_ucs2_def-master.opt @@ -0,0 +1 @@ +--default-collation=ucs2_unicode_ci --default-character-set=ucs2,latin1 diff --git a/mysql-test/t/rpl_ndb_ctype_ucs2_def.test b/mysql-test/t/rpl_ndb_ctype_ucs2_def.test new file mode 100644 index 00000000000..be7fd1acd2e --- /dev/null +++ b/mysql-test/t/rpl_ndb_ctype_ucs2_def.test @@ -0,0 +1,42 @@ +--source include/have_ucs2.inc +--source include/have_ndb.inc +--source include/ndb_master-slave.inc + +# +# MySQL Bug#15276: MySQL ignores collation-server +# +show variables like 'collation_server'; + +# +# Check that NDB replication doesn't explode with default charset +# being multibyte. +# +# Theorised that this could be a problem when dealing with: +# Bug #27404 util thd mysql_parse sig11 when mysqld default multibyte charset +# +# Sort of related to: +# Bug#18004 Connecting crashes server when default charset is UCS2 +# +# +show variables like "%character_set_ser%"; +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings +create table t1 (a int) ENGINE=NDB; +drop table t1; + +--connection master +CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0', + `nom` char(4) default NULL, + `prenom` char(4) default NULL, + PRIMARY KEY (`nid`)) + ENGINE=ndbcluster; + +INSERT INTO t1 VALUES(1,"XYZ1","ABC1"); +select * from t1 order by nid; + +--sync_slave_with_master +# connect to slave and ensure data it there. +--connection slave +select * from t1 order by nid; + diff --git a/mysql-test/t/rpl_ndb_dd_advance.test b/mysql-test/t/rpl_ndb_dd_advance.test index 5e346d5fe3b..723672931ab 100644 --- a/mysql-test/t/rpl_ndb_dd_advance.test +++ b/mysql-test/t/rpl_ndb_dd_advance.test @@ -9,7 +9,7 @@ --source include/have_binlog_format_row.inc --source include/ndb_default_cluster.inc --source include/not_embedded.inc ---source include/big_test.inc +#--source include/big_test.inc #--source include/have_ndb_extra.inc --source include/ndb_master-slave.inc @@ -98,7 +98,7 @@ SELECT DISTINCT FILE_NAME, FILE_TYPE, TABLESPACE_NAME, LOGFILE_GROUP_NAME connection master; CREATE INDEX t1_i ON t1(c2, c3); #Bug 18039 -#CREATE UNIQUE INDEX t1_i2 ON t1(c2); +CREATE UNIQUE INDEX t1_i2 ON t1(c2); ALTER TABLE t1 ADD c4 TIMESTAMP; ALTER TABLE t1 ADD c5 DOUBLE; ALTER TABLE t1 ADD INDEX (c5); @@ -170,7 +170,7 @@ SELECT * FROM t1 ORDER BY c1 LIMIT 5; connection slave; SHOW CREATE TABLE t1; # Bug 18094 -#SELECT * FROM t1 ORDER BY c1 LIMIT 5; +SELECT * FROM t1 ORDER BY c1 LIMIT 5; SELECT * FROM t1 where c1 = 1; connection master; @@ -198,163 +198,19 @@ connection master; CREATE TABLESPACE ts2 ADD DATAFILE 'datafile03.dat' USE LOGFILE GROUP lg1 -INITIAL_SIZE 12M +INITIAL_SIZE 10M ENGINE=NDB; ALTER TABLESPACE ts2 ADD DATAFILE 'datafile04.dat' -INITIAL_SIZE 12M +INITIAL_SIZE 5M ENGINE=NDB; -###### CLEAN UP SECTION ############## -DROP DATABASE IF EXISTS tpcb; -CREATE DATABASE tpcb; -######## Creat Table Section ######### ---echo *********** Create TPCB Tables ***************** -CREATE TABLE tpcb.account - (id INT, bid INT, balance DECIMAL(10,2), - filler CHAR(255), PRIMARY KEY(id)) - TABLESPACE ts1 STORAGE DISK - ENGINE=NDB; - -CREATE TABLE tpcb.branch - (bid INT, balance DECIMAL(10,2), filler VARCHAR(255), - PRIMARY KEY(bid)) - ENGINE=NDB; - -CREATE TABLE tpcb.teller - (tid INT, balance DECIMAL(10,2), filler VARCHAR(255), - PRIMARY KEY(tid)) - TABLESPACE ts2 STORAGE DISK - ENGINE=NDB; - -CREATE TABLE tpcb.history - (id MEDIUMINT NOT NULL AUTO_INCREMENT,aid INT, - tid INT, bid INT, amount DECIMAL(10,2), - tdate DATETIME, teller CHAR(20), uuidf LONGBLOB, - filler CHAR(80),PRIMARY KEY (id)) - TABLESPACE ts2 STORAGE DISK - ENGINE=NDB; - ---echo ********* Create Procedures and Functions ************ -delimiter |; -CREATE PROCEDURE tpcb.load() -BEGIN - DECLARE acct INT DEFAULT 1000; - DECLARE brch INT DEFAULT 100; - DECLARE tell INT DEFAULT 1000; - DECLARE tmp INT DEFAULT 100; - WHILE brch > 0 DO - SET tmp = 100; - WHILE tmp > 0 DO - INSERT INTO tpcb.account VALUES (acct, brch, 0.0, "FRESH ACCOUNT"); - SET acct = acct - 1; - SET tmp = tmp -1; - END WHILE; - INSERT INTO tpcb.branch VALUES (brch, 0.0, "FRESH BRANCH"); - SET brch = brch - 1; - END WHILE; - WHILE tell > 0 DO - INSERT INTO tpcb.teller VALUES (tell, 0.0, "FRESH TELLER"); - SET tell = tell - 1; - END WHILE; -END| - -CREATE FUNCTION tpcb.account_id () RETURNS INT -BEGIN - DECLARE num INT; - DECLARE ran INT; - SELECT RAND() * 10 INTO ran; - IF (ran < 2) - THEN - SELECT RAND() * 10 INTO num; - ELSEIF (ran < 4) - THEN - SELECT RAND() * 100 INTO num; - ELSE - SELECT RAND() * 1000 INTO num; - END IF; - IF (num < 1) - THEN - RETURN 1; - END IF; - RETURN num; -END| - -CREATE FUNCTION tpcb.teller_id () RETURNS INT -BEGIN - DECLARE num INT; - DECLARE ran INT; - SELECT RAND() * 10 INTO ran; - IF (ran < 2) - THEN - SELECT RAND() * 10 INTO num; - ELSEIF (ran < 5) - THEN - SELECT RAND() * 100 INTO num; - ELSE - SELECT RAND() * 1000 INTO num; - END IF; - IF (num < 1) - THEN - RETURN 1; - END IF; - RETURN num; -END| - -CREATE PROCEDURE tpcb.trans() -BEGIN - DECLARE acct INT DEFAULT 0; - DECLARE brch INT DEFAULT 0; - DECLARE tell INT DEFAULT 0; - DECLARE bal DECIMAL(10,2) DEFAULT 0.0; - DECLARE amount DECIMAL(10,2) DEFAULT 1.00; - DECLARE test INT DEFAULT 0; - DECLARE bbal DECIMAL(10,2) DEFAULT 0.0; - DECLARE tbal DECIMAL(10,2) DEFAULT 0.0; - DECLARE local_uuid VARCHAR(255); - DECLARE local_user VARCHAR(255); - DECLARE local_time TIMESTAMP; - - SELECT RAND() * 10 INTO test; - SELECT tpcb.account_id() INTO acct; - SELECT tpcb.teller_id() INTO tell; - - SELECT account.balance INTO bal FROM tpcb.account WHERE id = acct; - SELECT account.bid INTO brch FROM tpcb.account WHERE id = acct; - SELECT teller.balance INTO tbal FROM tpcb.teller WHERE tid = tell; - SELECT branch.balance INTO bbal FROM tpcb.branch WHERE bid = brch; - - IF (test < 5) - THEN - SET bal = bal + amount; - SET bbal = bbal + amount; - SET tbal = tbal + amount; - UPDATE tpcb.account SET balance = bal, filler = 'account updated' - WHERE id = acct; - UPDATE tpcb.branch SET balance = bbal, filler = 'branch updated' - WHERE bid = brch; - UPDATE tpcb.teller SET balance = tbal, filler = 'teller updated' - WHERE tid = tell; - ELSE - SET bal = bal - amount; - SET bbal = bbal - amount; - SET tbal = tbal - amount; - UPDATE tpcb.account SET balance = bal, filler = 'account updated' - WHERE id = acct; - UPDATE tpcb.branch SET balance = bbal, filler = 'branch updated' - WHERE bid = brch; - UPDATE tpcb.teller SET balance = tbal, filler = 'teller updated' - WHERE tid = tell; - END IF; - - SET local_uuid=UUID(); - SET local_user=USER(); - SET local_time= NOW(); - INSERT INTO tpcb.history VALUES(NULL,acct,tell,brch,amount, local_time,local_user, - local_uuid,'completed trans'); -END| -delimiter ;| +let engine_type=NDBCLUSTER; +let table_space=ts2; +let format='RBR'; + +--source include/tpcb_disk_data.inc --echo ****** TEST 2 test time ********************************* USE tpcb; @@ -372,15 +228,16 @@ SELECT COUNT(*) FROM account; --echo ******** Run in some transactions *************** connection master; -let $j= 1000; +let $j= 100; --disable_query_log while ($j) { - CALL tpcb.trans(); + eval CALL tpcb.trans($format); dec $j; } --enable_query_log + --echo ***** Time to try slave sync *********** --echo **** Must make sure slave is clean ***** --connection slave @@ -421,11 +278,11 @@ connection master; SELECT COUNT(*) FROM history; -let $j= 1000; +let $j= 100; --disable_query_log while ($j) { - CALL tpcb.trans(); + eval CALL tpcb.trans($format); dec $j; } --enable_query_log @@ -464,11 +321,11 @@ SELECT COUNT(*) FROM account; --echo ***** Add some more records to master ********* connection master; -let $j= 1000; +let $j= 100; --disable_query_log while ($j) { - CALL tpcb.trans(); + eval CALL tpcb.trans($format); dec $j; } --enable_query_log @@ -484,17 +341,18 @@ while ($j) --echo ***** Finsh the slave sync process ******* --disable_query_log # 1. 2. 3. +--sync_slave_with_master --source include/ndb_setup_slave.inc --enable_query_log # 4. --echo * 4. * connection master; -let $j= 1000; +let $j= 100; --disable_query_log while ($j) { - CALL tpcb.trans(); + eval CALL tpcb.trans($format); dec $j; } --enable_query_log @@ -507,15 +365,6 @@ START SLAVE; --echo **** We should be ready to continue on ************* connection master; -let $j= 50; ---disable_query_log -while ($j) -{ - CALL tpcb.trans(); - dec $j; -} ---enable_query_log - --echo ****** Let's make sure we match ******* --echo ***** MASTER ******* USE tpcb; diff --git a/mysql-test/t/rpl_ndb_innodb_trans.test b/mysql-test/t/rpl_ndb_innodb_trans.test index efba6050554..63c5c5e93e3 100644 --- a/mysql-test/t/rpl_ndb_innodb_trans.test +++ b/mysql-test/t/rpl_ndb_innodb_trans.test @@ -2,8 +2,8 @@ -- source include/have_ndb.inc -- source include/have_innodb.inc --- source include/have_binlog_format_row.inc -- source include/ndb_master-slave.inc +-- source include/have_log_bin.inc create table t1 (a int, unique(a)) engine=ndbcluster; create table t2 (a int, unique(a)) engine=innodb; diff --git a/mysql-test/t/rpl_ndb_mix_innodb-master.opt b/mysql-test/t/rpl_ndb_mix_innodb-master.opt new file mode 100644 index 00000000000..3596fc4d3bd --- /dev/null +++ b/mysql-test/t/rpl_ndb_mix_innodb-master.opt @@ -0,0 +1 @@ +--innodb --default-storage-engine=innodb diff --git a/mysql-test/t/rpl_ndb_mix_innodb.test b/mysql-test/t/rpl_ndb_mix_innodb.test new file mode 100644 index 00000000000..b730bcc08e0 --- /dev/null +++ b/mysql-test/t/rpl_ndb_mix_innodb.test @@ -0,0 +1,36 @@ +############################################# +#Authors: TU and Jeb +#Date: 2007/04 +#Purpose: Generic replication to cluster +# and ensuring that the ndb_apply_status +# table is updated. +############################################# +# Notes: +# include/select_ndb_apply_status.inc +# Selects out the log name, start & end pos +# from the ndb_apply_status table +# +# include/show_binlog_using_logname.inc +# To select out 1 row from offset 1 +# from the start position in the binlog whose +# name is = log_name +# +# include/tpcb.inc +# Creates DATABASE tpcb, the tables and +# stored procedures for loading the DB +# and for running transactions against DB. +############################################## + + +## Includes ## + +--disable_query_log +--source include/have_ndb.inc +--source include/have_innodb.inc +--source include/have_binlog_format_mixed.inc +--source include/ndb_master-slave.inc +--enable_query_log +let $off_set = 9; +let $rpl_format = 'MIX'; +--source extra/rpl_tests/rpl_ndb_apply_status.test + diff --git a/mysql-test/t/rpl_ndb_stm_innodb-master.opt b/mysql-test/t/rpl_ndb_stm_innodb-master.opt index 627becdbfb5..3596fc4d3bd 100644 --- a/mysql-test/t/rpl_ndb_stm_innodb-master.opt +++ b/mysql-test/t/rpl_ndb_stm_innodb-master.opt @@ -1 +1 @@ ---innodb +--innodb --default-storage-engine=innodb diff --git a/mysql-test/t/rpl_ndb_stm_innodb.test b/mysql-test/t/rpl_ndb_stm_innodb.test index d43fafa8406..bf7f1eed7b2 100644 --- a/mysql-test/t/rpl_ndb_stm_innodb.test +++ b/mysql-test/t/rpl_ndb_stm_innodb.test @@ -1,70 +1,35 @@ +############################################# +#Authors: TU and Jeb +#Date: 2007/04 +#Purpose: Generic replication to cluster +# and ensuring that the ndb_apply_status +# table is updated. +############################################# +# Notes: +# include/select_ndb_apply_status.inc +# Selects out the log name, start & end pos +# from the ndb_apply_status table +# +# include/show_binlog_using_logname.inc +# To select out 1 row from offset 1 +# from the start position in the binlog whose +# name is = log_name +# +# include/tpcb.inc +# Creates DATABASE tpcb, the tables and +# stored procedures for loading the DB +# and for running transactions against DB. +############################################## + + +## Includes ## + +--disable_query_log --source include/have_ndb.inc --source include/have_innodb.inc ---source include/have_binlog_format_mixed_or_statement.inc +--source include/have_binlog_format_statement.inc --source include/ndb_master-slave.inc - ---connection master -create table t1 (a int key, b int) engine innodb; -create table t2 (a int key, b int) engine innodb; - ---sync_slave_with_master ---connection slave -alter table t1 engine ndb; -alter table t2 engine ndb; - -# We need MIXED mode on the slave in the event that there are -# statements coming in from the master. In this case, NDB can only -# handle row-based format, so it has to be possible to switch to -# this. -STOP SLAVE; -SET GLOBAL BINLOG_FORMAT=MIXED; -START SLAVE; - -# check binlog position without begin ---connection master -insert into t1 values (1,2); - ---sync_slave_with_master ---connection slave ---replace_column 1 <start_pos> 2 <end_pos> -select @start_pos:=start_pos, @end_pos:=end_pos from mysql.ndb_apply_status; ---let $start_pos = `select @start_pos` ---let $end_pos = `select @end_pos` - ---connection master -# here is actually a bug, since there is no begin statement, the -# query is autocommitted, and end_pos shows end of the insert and not -# end of the commit ---replace_result $start_pos <start_pos> ---replace_column 5 # ---eval show binlog events from $start_pos limit 1 ---replace_result $start_pos <start_pos> $end_pos <end_pos> ---replace_column 2 # ---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ ---eval show binlog events from $start_pos limit 1,1 - -# check binlog position with begin ---connection master -begin; -insert into t1 values (2,3); -insert into t2 values (3,4); -commit; - ---sync_slave_with_master ---connection slave ---replace_column 1 <start_pos> 2 <end_pos> -select @start_pos:=start_pos, @end_pos:=end_pos from mysql.ndb_apply_status; ---let $start_pos = `select @start_pos` ---let $end_pos = `select @end_pos` - ---connection master ---replace_result $start_pos <start_pos> ---replace_column 5 # ---eval show binlog events from $start_pos limit 1 ---replace_result $start_pos <start_pos> ---replace_column 2 # 4 # 5 # ---eval show binlog events from $start_pos limit 1,2 ---replace_result $start_pos <start_pos> $end_pos <end_pos> ---replace_column 2 # ---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ ---eval show binlog events from $start_pos limit 3,1 +--enable_query_log +let $off_set = 6; +let $rpl_format = 'SBR'; +--source extra/rpl_tests/rpl_ndb_apply_status.test diff --git a/mysql-test/t/rpl_partition.test b/mysql-test/t/rpl_partition.test new file mode 100644 index 00000000000..7f6e05db20e --- /dev/null +++ b/mysql-test/t/rpl_partition.test @@ -0,0 +1,160 @@ +--source include/have_innodb.inc +--source include/master-slave.inc + +--vertical_results + +let $engine_type= 'innodb'; + +SET GLOBAL binlog_format = 'ROW'; +SET SESSION binlog_format = 'ROW'; +select @@global.binlog_format, @@session.binlog_format; + +--disable-warnings +DROP TABLE IF EXISTS t1, t2, t3; +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS p2; +DROP PROCEDURE IF EXISTS p3; +--enable-warnings + +eval CREATE TABLE t1(id MEDIUMINT NOT NULL AUTO_INCREMENT, + dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB, + fkid MEDIUMINT, filler VARCHAR(255), + PRIMARY KEY(id)) ENGINE=$engine_type; + +eval CREATE TABLE t2(id MEDIUMINT NOT NULL AUTO_INCREMENT, + dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB, + fkid MEDIUMINT, filler VARCHAR(255), + PRIMARY KEY(id)) ENGINE=$engine_type + PARTITION BY KEY(id) partitions 5; + +eval CREATE TABLE t3(id MEDIUMINT NOT NULL AUTO_INCREMENT, + dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB, + fkid MEDIUMINT, filler VARCHAR(255), + PRIMARY KEY(id)) ENGINE=$engine_type + PARTITION BY RANGE(id) + SUBPARTITION BY hash(id) subpartitions 2 + (PARTITION pa1 values less than (10), + PARTITION pa2 values less than (20), + PARTITION pa3 values less than (30), + PARTITION pa4 values less than (40), + PARTITION pa5 values less than (50), + PARTITION pa6 values less than (60), + PARTITION pa7 values less than (70), + PARTITION pa8 values less than (80), + PARTITION pa9 values less than (90), + PARTITION pa10 values less than (100), + PARTITION pa11 values less than MAXVALUE); + +######## Create SPs, Functions, Views and Triggers Section ############## + +delimiter |; +CREATE PROCEDURE p1() +BEGIN + DECLARE ins_count INT DEFAULT 1000; + DECLARE del_count INT; + DECLARE cur_user VARCHAR(255); + DECLARE local_uuid VARCHAR(255); + DECLARE local_time TIMESTAMP; + + SET local_time= NOW(); + SET cur_user= CURRENT_USER(); + SET local_uuid= UUID(); + + WHILE ins_count > 0 DO + INSERT INTO t1 VALUES (NULL, NOW(), USER() , UUID(), + ins_count,'Going to test MBR for MySQL'); + SET ins_count = ins_count - 1; + END WHILE; + + SELECT MAX(id) FROM t1 INTO del_count; + WHILE del_count > 0 DO + DELETE FROM t1 WHERE id = del_count; + SET del_count = del_count - 2; + END WHILE; +END| + +CREATE PROCEDURE p2() +BEGIN + DECLARE ins_count INT DEFAULT 1000; + DECLARE del_count INT; + DECLARE cur_user VARCHAR(255); + DECLARE local_uuid VARCHAR(255); + DECLARE local_time TIMESTAMP; + + SET local_time= NOW(); + SET cur_user= CURRENT_USER(); + SET local_uuid= UUID(); + + WHILE ins_count > 0 DO + INSERT INTO t2 VALUES (NULL, NOW(), USER() , UUID(), + ins_count,'Going to test MBR for MySQL'); + SET ins_count = ins_count - 1; + END WHILE; + + SELECT MAX(id) FROM t2 INTO del_count; + WHILE del_count > 0 DO + DELETE FROM t2 WHERE id = del_count; + SET del_count = del_count - 2; + END WHILE; +END| + +CREATE PROCEDURE p3() +BEGIN + DECLARE ins_count INT DEFAULT 1000; + DECLARE del_count INT; + DECLARE cur_user VARCHAR(255); + DECLARE local_uuid VARCHAR(255); + DECLARE local_time TIMESTAMP; + + SET local_time= NOW(); + SET cur_user = CURRENT_USER(); + SET local_uuid=UUID(); + + WHILE ins_count > 0 DO + INSERT INTO t3 VALUES (NULL, NOW(), USER(), UUID(), + ins_count,'Going to test MBR for MySQL'); + SET ins_count = ins_count - 1; + END WHILE; + + SELECT MAX(id) FROM t3 INTO del_count; + WHILE del_count > 0 DO + DELETE FROM t3 WHERE id = del_count; + SET del_count = del_count - 2; + END WHILE; +END| + +delimiter ;| + +############ Finish Setup Section ################### + + +############ Test Section ################### + +CALL p1(); +SELECT count(*) as "Master regular" FROM t1; +CALL p2(); +SELECT count(*) as "Master bykey" FROM t2; +CALL p3(); +SELECT count(*) as "Master byrange" FROM t3; + +#--source include/master-slave-end.inc +--sync_slave_with_master +connection slave; +show create table t3; +--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT +--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # 35 # 36 # +show slave status; +SELECT count(*) "Slave norm" FROM t1; +SELECT count(*) "Slave bykey" FROM t2; +SELECT count(*) "Slave byrange" FROM t3; + +connection master; +DROP TABLE t1, t2, t3; +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS p2; +DROP PROCEDURE IF EXISTS p3; +save_master_pos; +connection slave; +sync_with_master; + +# End of 5.1 tests diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test index af2c044ee10..341c9039390 100644 --- a/mysql-test/t/show_check.test +++ b/mysql-test/t/show_check.test @@ -22,6 +22,12 @@ flush privileges; create table t1 (a int not null primary key, b int not null,c int not null, key(b,c)); insert into t1 values (1,2,2),(2,2,3),(3,2,4),(4,2,4); + +--echo -- Here we enable metadata just to check that the collation of the +--echo -- resultset is non-binary for string type. This should be changed +--echo -- after Bug#29394 is implemented. + +--enable_metadata check table t1 fast; check table t1 fast; check table t1 changed; @@ -30,28 +36,58 @@ check table t1 changed; check table t1 medium; check table t1 extended; show index from t1; +--disable_metadata --error ER_DUP_ENTRY insert into t1 values (5,5,5); + +--echo -- Here we enable metadata just to check that the collation of the +--echo -- resultset is non-binary for string type. This should be changed +--echo -- after Bug#29394 is implemented. + +--enable_metadata optimize table t1; +--disable_metadata optimize table t1; drop table t1; #show variables; + +--echo -- Here we enable metadata just to check that the collation of the +--echo -- resultset is non-binary for string type. This should be changed +--echo -- after Bug#29394 is implemented. + +--enable_metadata show variables like "wait_timeout%"; show variables like "WAIT_timeout%"; show variables like "this_doesn't_exists%"; show table status from test like "this_doesn't_exists%"; show databases; show databases like "test%"; +--disable_metadata # # Check of show index # create table t1 (f1 int not null, f2 int not null, f3 int not null, f4 int not null, primary key(f1,f2,f3,f4)); insert into t1 values (1,1,1,0),(1,1,2,0),(1,1,3,0),(1,2,1,0),(1,2,2,0),(1,2,3,0),(1,3,1,0),(1,3,2,0),(1,3,3,0),(1,1,1,1),(1,1,2,1),(1,1,3,1),(1,2,1,1),(1,2,2,1),(1,2,3,1),(1,3,1,1),(1,3,2,1),(1,3,3,1); + +--echo -- Here we enable metadata just to check that the collation of the +--echo -- resultset is non-binary for string type. This should be changed +--echo -- after Bug#29394 is implemented. + +--enable_metadata analyze table t1; +--disable_metadata show index from t1; + +--echo -- Here we enable metadata just to check that the collation of the +--echo -- resultset is non-binary for string type. This should be changed +--echo -- after Bug#29394 is implemented. + +--enable_metadata + repair table t1; +--disable_metadata show index from t1; drop table t1; @@ -513,6 +549,217 @@ show status like 'slow_queries'; # (mysqld is started with --log-queries-not-using-indexes) select 1 from information_schema.tables limit 1; show status like 'slow_queries'; +# +# BUG#10491: Server returns data as charset binary SHOW CREATE TABLE or SELECT +# FROM I_S. +# + +# Ensure that all needed objects are dropped. + +--disable_warnings +DROP DATABASE IF EXISTS mysqltest1; +DROP TABLE IF EXISTS t1; +DROP VIEW IF EXISTS v1; +DROP PROCEDURE IF EXISTS p1; +DROP FUNCTION IF EXISTS f1; +--enable_warnings + +# Create objects. + +CREATE DATABASE mysqltest1; + +CREATE TABLE t1(c INT NOT NULL PRIMARY KEY); + +CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1; + +CREATE VIEW v1 AS SELECT 1; + +CREATE PROCEDURE p1() SELECT 1; + +CREATE FUNCTION f1() RETURNS INT RETURN 1; + + +# Test. + +set names utf8; + +--echo -- Here we enable metadata just to check that the collation of the +--echo -- resultset is non-binary for string type. This should be changed +--echo -- after Bug#29394 is implemented. + +--enable_metadata + +--echo ---------------------------------------------------------------- + +SHOW CHARACTER SET LIKE 'utf8'; + +--echo ---------------------------------------------------------------- + +SHOW COLLATION LIKE 'latin1_bin'; + +--echo ---------------------------------------------------------------- + +SHOW CREATE DATABASE mysqltest1; + +--echo ---------------------------------------------------------------- + +SHOW DATABASES LIKE 'mysqltest1'; + +--echo ---------------------------------------------------------------- + +SHOW CREATE TABLE t1; + +--echo ---------------------------------------------------------------- + +SHOW INDEX FROM t1; + +--echo ---------------------------------------------------------------- + +SELECT + TABLE_CATALOG, + TABLE_SCHEMA, + TABLE_NAME, + TABLE_TYPE, + ENGINE, + ROW_FORMAT, + TABLE_COLLATION, + CREATE_OPTIONS, + TABLE_COMMENT +FROM INFORMATION_SCHEMA.TABLES +WHERE table_name = 't1'; + +--echo ---------------------------------------------------------------- + +SELECT + TABLE_CATALOG, + TABLE_SCHEMA, + TABLE_NAME, + COLUMN_NAME, + COLUMN_DEFAULT, + IS_NULLABLE, + DATA_TYPE, + CHARACTER_SET_NAME, + COLLATION_NAME, + COLUMN_TYPE, + COLUMN_KEY, + EXTRA, + PRIVILEGES, + COLUMN_COMMENT +FROM INFORMATION_SCHEMA.COLUMNS +WHERE table_name = 't1'; + +--echo ---------------------------------------------------------------- + +SHOW TABLES LIKE 't1'; + +--echo ---------------------------------------------------------------- + +SHOW COLUMNS FROM t1; + +--echo ---------------------------------------------------------------- + +SHOW TRIGGERS LIKE 't1'; + +--echo ---------------------------------------------------------------- + +SELECT + TRIGGER_CATALOG, + TRIGGER_SCHEMA, + TRIGGER_NAME, + EVENT_MANIPULATION, + EVENT_OBJECT_CATALOG, + EVENT_OBJECT_SCHEMA, + EVENT_OBJECT_TABLE, + ACTION_CONDITION, + ACTION_STATEMENT, + ACTION_ORIENTATION, + ACTION_TIMING, + ACTION_REFERENCE_OLD_TABLE, + ACTION_REFERENCE_NEW_TABLE, + ACTION_REFERENCE_OLD_ROW, + ACTION_REFERENCE_NEW_ROW, + SQL_MODE, + DEFINER +FROM INFORMATION_SCHEMA.TRIGGERS +WHERE trigger_name = 't1_bi'; + +--echo ---------------------------------------------------------------- + +SHOW CREATE VIEW v1; + +--echo ---------------------------------------------------------------- + +SELECT * +FROM INFORMATION_SCHEMA.VIEWS +WHERE table_name = 'v1'; + +--echo ---------------------------------------------------------------- + +SHOW CREATE PROCEDURE p1; + +--echo ---------------------------------------------------------------- + +SELECT + 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 +FROM INFORMATION_SCHEMA.ROUTINES +WHERE routine_name = 'p1'; + +--echo ---------------------------------------------------------------- + +SHOW CREATE FUNCTION f1; + +--echo ---------------------------------------------------------------- + +SELECT + 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 +FROM INFORMATION_SCHEMA.ROUTINES +WHERE routine_name = 'f1'; + +--echo ---------------------------------------------------------------- + +--disable_metadata + +# Cleanup. + +DROP DATABASE mysqltest1; +DROP TABLE t1; +DROP VIEW v1; +DROP PROCEDURE p1; +DROP FUNCTION f1; --echo End of 5.0 tests. @@ -599,4 +846,55 @@ set names latin1; --error ER_NO_SUCH_TABLE,ER_FILE_NOT_FOUND show columns from `#mysql50#????????`; +# +# SHOW CREATE TRIGGER test. +# + +# Prepare. + +--disable_warnings +DROP TABLE IF EXISTS t1; +DROP PROCEDURE IF EXISTS p1; +--enable_warnings + +CREATE TABLE t1(c1 INT); + +CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a = 1; + +# Test. + +SHOW CREATE TRIGGER t1_bi; + +CREATE PROCEDURE p1() SHOW CREATE TRIGGER t1_bi; + +CALL p1(); +CALL p1(); +CALL p1(); +CALL p1(); +CALL p1(); +CALL p1(); +CALL p1(); +CALL p1(); +CALL p1(); +CALL p1(); + +PREPARE stmt1 FROM 'SHOW CREATE TRIGGER t1_bi'; + +EXECUTE stmt1; +EXECUTE stmt1; +EXECUTE stmt1; +EXECUTE stmt1; +EXECUTE stmt1; +EXECUTE stmt1; +EXECUTE stmt1; +EXECUTE stmt1; +EXECUTE stmt1; +EXECUTE stmt1; + +# Cleanup. + +DROP TABLE t1; +DROP PROCEDURE p1; +DEALLOCATE PREPARE stmt1; + --echo End of 5.1 tests diff --git a/mysql-test/t/sp-destruct.test b/mysql-test/t/sp-destruct.test index df07091d2de..04a581ab45f 100644 --- a/mysql-test/t/sp-destruct.test +++ b/mysql-test/t/sp-destruct.test @@ -94,26 +94,33 @@ insert into mysql.proc ( db, name, type, specific_name, language, sql_data_access, is_deterministic, security_type, param_list, returns, body, definer, created, modified, - sql_mode, comment + sql_mode, comment, character_set_client, collation_connection, db_collation, + body_utf8 ) values ( 'test', 'bug14233_1', 'FUNCTION', 'bug14233_1', 'SQL', 'READS_SQL_DATA', 'NO', 'DEFINER', '', 'int(10)', 'select count(*) from mysql.user', - 'root@localhost', NOW() , '0000-00-00 00:00:00', '', '' + 'root@localhost', NOW() , '0000-00-00 00:00:00', '', '', + '', '', '', + 'select count(*) from mysql.user' ), ( 'test', 'bug14233_2', 'FUNCTION', 'bug14233_2', 'SQL', 'READS_SQL_DATA', 'NO', 'DEFINER', '', 'int(10)', 'begin declare x int; select count(*) into x from mysql.user; end', - 'root@localhost', NOW() , '0000-00-00 00:00:00', '', '' + 'root@localhost', NOW() , '0000-00-00 00:00:00', '', '', + '', '', '', + 'begin declare x int; select count(*) into x from mysql.user; end' ), ( 'test', 'bug14233_3', 'PROCEDURE', 'bug14233_3', 'SQL', 'READS_SQL_DATA','NO', 'DEFINER', '', '', 'alksj wpsj sa ^#!@ ', - 'root@localhost', NOW() , '0000-00-00 00:00:00', '', '' + 'root@localhost', NOW() , '0000-00-00 00:00:00', '', '', + '', '', '', + 'alksj wpsj sa ^#!@ ' ); --error ER_SP_PROC_TABLE_CORRUPT diff --git a/mysql-test/t/sp-dynamic.test b/mysql-test/t/sp-dynamic.test index 6546a5ab548..e6f4aae96ac 100644 --- a/mysql-test/t/sp-dynamic.test +++ b/mysql-test/t/sp-dynamic.test @@ -85,7 +85,7 @@ call p1()| call p1()| drop procedure p1| # -# D. Create/Drop a table (a DDL that issues a commit) in Dynamic SQL. +# D. Create/Drop/Alter a table (a DDL that issues a commit) in Dynamic SQL. # (should work ok). # create procedure p1() @@ -96,6 +96,10 @@ begin execute stmt; insert into t1 (a) values (1); select * from t1; + prepare stmt_alter from "alter table t1 add (b int)"; + execute stmt_alter; + insert into t1 (a,b) values (2,1); + deallocate prepare stmt_alter; deallocate prepare stmt; deallocate prepare stmt_drop; end| @@ -239,6 +243,7 @@ drop procedure p1| # K. Use of continue handlers with Dynamic SQL. # drop table if exists t1| +drop table if exists t2| create table t1 (id integer primary key auto_increment, stmt_text char(35), status varchar(20))| insert into t1 (stmt_text) values @@ -249,7 +254,10 @@ insert into t1 (stmt_text) values ("help help"), ("show databases"), ("show tables"), ("show table status"), ("show open tables"), ("show storage engines"), ("insert into t1 (id) values (1)"), ("update t1 set status=''"), - ("delete from t1"), ("truncate t1"), ("call p1()"), ("foo bar")| + ("delete from t1"), ("truncate t1"), ("call p1()"), ("foo bar"), + ("create view v1 as select 1"), ("alter view v1 as select 2"), + ("drop view v1"),("create table t2 (a int)"),("alter table t2 add (b int)"), + ("drop table t2")| create procedure p1() begin declare v_stmt_text varchar(255); diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test index 69b1f77aa35..ef9bed8b789 100644 --- a/mysql-test/t/sp-error.test +++ b/mysql-test/t/sp-error.test @@ -1087,12 +1087,12 @@ delimiter ;| # # BUG 12490 (Packets out of order if calling HELP CONTENTS from Stored Procedure) # ---error 1314 +--error ER_SP_BADSTATEMENT CREATE PROCEDURE BUG_12490() HELP CONTENTS; ---error 1314 +--error ER_SP_BADSTATEMENT CREATE FUNCTION BUG_12490() RETURNS INT HELP CONTENTS; CREATE TABLE t_bug_12490(a int); ---error 1314 +--error ER_SP_BADSTATEMENT CREATE TRIGGER BUG_12490 BEFORE UPDATE ON t_bug_12490 FOR EACH ROW HELP CONTENTS; DROP TABLE t_bug_12490; @@ -1401,9 +1401,9 @@ CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN create view v1 as sele -- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG CREATE FUNCTION bug_13627_f() returns int BEGIN create view v1 as select 1; return 1; END | --- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +-- error ER_SP_BADSTATEMENT CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN alter view v1 as select 1; END | --- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG +-- error ER_SP_BADSTATEMENT CREATE FUNCTION bug_13627_f() returns int BEGIN alter view v1 as select 1; return 1; END | -- error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 29e759d7881..f5bad05a40a 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -6331,7 +6331,7 @@ set names utf8| drop database if exists това_е_дълго_име_за_база_данни_нали| --enable_warnings create database това_е_дълго_име_за_база_данни_нали| -INSERT INTO mysql.proc VALUES ('това_е_дълго_име_за_база_данни_нали','това_е_процедура_Ñ_доÑта_дълго_име_нали_и_още_по_дълго','PROCEDURE','това_е_процедура_Ñ_доÑта_дълго_име_нали_и_още_по_дълго','SQL','CONTAINS_SQL','NO','DEFINER','','','bad_body','root@localhost',now(), now(),'','')| +INSERT INTO mysql.proc VALUES ('това_е_дълго_име_за_база_данни_нали','това_е_процедура_Ñ_доÑта_дълго_име_нали_и_още_по_дълго','PROCEDURE','това_е_процедура_Ñ_доÑта_дълго_име_нали_и_още_по_дълго','SQL','CONTAINS_SQL','NO','DEFINER','','','bad_body','root@localhost',now(), now(),'','', 'utf8', 'utf8_general_ci', 'utf8_general_ci', 'n/a')| --error ER_SP_PROC_TABLE_CORRUPT call това_е_дълго_име_за_база_данни_нали.това_е_процедура_Ñ_доÑта_дълго_име_нали_и_още_по_дълго()| drop database това_е_дълго_име_за_база_данни_нали| diff --git a/mysql-test/t/strict_autoinc_5ndb.test b/mysql-test/t/strict_autoinc_5ndb.test index 819d0068148..9e2090fddef 100644 --- a/mysql-test/t/strict_autoinc_5ndb.test +++ b/mysql-test/t/strict_autoinc_5ndb.test @@ -1,5 +1,4 @@ -- source include/have_ndb.inc --- source include/have_binlog_format_row.inc # # Bug#20573 Strict mode auto-increment diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index e88ded56914..4c046dfd3c6 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -2945,6 +2945,48 @@ SELECT (SELECT 1 FROM t1 WHERE t1.a=t2.a ORDER BY t1.b LIMIT 1) AS d1 FROM t2; DROP TABLE t1,t2; + +# +# Bug #27333: subquery grouped for aggregate of outer query / no aggregate +# of subquery +# +CREATE TABLE t1 (a INTEGER, b INTEGER); +CREATE TABLE t2 (x INTEGER); +INSERT INTO t1 VALUES (1,11), (2,22), (2,22); +INSERT INTO t2 VALUES (1), (2); + +# wasn't failing, but should +--error ER_SUBQUERY_NO_1_ROW +SELECT a, COUNT(b), (SELECT COUNT(b) FROM t2) FROM t1 GROUP BY a; + +# fails as it should +--error ER_SUBQUERY_NO_1_ROW +SELECT a, COUNT(b), (SELECT COUNT(b)+0 FROM t2) FROM t1 GROUP BY a; + +SELECT (SELECT SUM(t1.a)/AVG(t2.x) FROM t2) FROM t1; +DROP TABLE t1,t2; + +# second test case from 27333 +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1, 2), (1,3), (1,4), (2,1), (2,2); + +-- returns no rows, when it should +SELECT a1.a, COUNT(*) FROM t1 a1 WHERE a1.a = 1 +AND EXISTS( SELECT a2.a FROM t1 a2 WHERE a2.a = a1.a) +GROUP BY a1.a; +DROP TABLE t1; + +#test cases from 29297 +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a INT); +INSERT INTO t1 VALUES (1),(2); +INSERT INTO t2 VALUES (1),(2); +SELECT (SELECT SUM(t1.a) FROM t2 WHERE a=0) FROM t1; +--error ER_SUBQUERY_NO_1_ROW +SELECT (SELECT SUM(t1.a) FROM t2 WHERE a!=0) FROM t1; +SELECT (SELECT SUM(t1.a) FROM t2 WHERE a=1) FROM t1; +DROP TABLE t1,t2; + --echo End of 5.0 tests. # diff --git a/mysql-test/t/type_enum.test b/mysql-test/t/type_enum.test index 200fd063b99..1e5b53a2c6e 100644 --- a/mysql-test/t/type_enum.test +++ b/mysql-test/t/type_enum.test @@ -136,16 +136,6 @@ alter table t1 add f2 enum(0xFFFF); show create table t1; drop table t1; ---echo End of 4.1 tests - -# -# Bug#28729: Field_enum wrongly reported an error while storing an empty string. -# -create table t1(f1 set('a','b'), index(f1)); -insert into t1 values(''),(''),('a'),('b'); -select * from t1 where f1=''; -drop table t1; - # # Bug#24660 "enum" field type definition problem # @@ -166,4 +156,31 @@ drop table t1; create table t1(exhausting_charset enum('ABCDEFGHIJKLMNOPQRSTUVWXYZ','
!"','#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~','xx\','yy\€','zz‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ')); +# +# Bug #29251: MySQL coerces special 0 enum values to normal '' value +# when ALTERing the column +# + +CREATE TABLE t1 ( + id INT AUTO_INCREMENT PRIMARY KEY, + c1 ENUM('a', '', 'b') +); +INSERT INTO t1 (c1) VALUES (0), ('a'), (''), ('b'); +SELECT id, c1 + 0, c1 FROM t1; + +ALTER TABLE t1 CHANGE c1 c1 ENUM('a', '') NOT NULL; +SELECT id, c1 + 0, c1 FROM t1; + +DROP TABLE t1; + +--echo End of 4.1 tests + +# +# Bug#28729: Field_enum wrongly reported an error while storing an empty string. +# +create table t1(f1 set('a','b'), index(f1)); +insert into t1 values(''),(''),('a'),('b'); +select * from t1 where f1=''; +drop table t1; + --echo End of 5.1 tests diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index c441c7b5efc..ee807a1ae25 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -752,6 +752,11 @@ drop view v1; # # VIEWs with national characters # + +SET @old_cs_client = @@character_set_client; +SET @old_cs_results = @@character_set_results; +SET @old_cs_connection = @@character_set_connection; + set names utf8; create table tü (cü char); create view vü as select cü from tü; @@ -759,7 +764,10 @@ insert into vü values ('ü'); select * from vü; drop view vü; drop table tü; -set names latin1; + +SET character_set_client = @old_cs_client; +SET character_set_results = @old_cs_results; +SET character_set_connection = @old_cs_connection; # # problem with used_tables() of outer reference resolved in VIEW diff --git a/mysys/charset.c b/mysys/charset.c index f6bcf3f5a4f..1c81e480404 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -595,17 +595,17 @@ CHARSET_INFO *get_charset_by_csname(const char *cs_name, parameter and FALSE is returned. If there is no such character set, "default_cs" is assigned to the "cs" and TRUE is returned. - @param[out] cs Variable to store character set. @param[in] cs_name Character set name. @param[in] default_cs Default character set. + @param[out] cs Variable to store character set. @return FALSE if character set was resolved successfully; TRUE if there is no character set with given name. */ -bool resolve_charset(CHARSET_INFO **cs, - const char *cs_name, - CHARSET_INFO *default_cs) +bool resolve_charset(const char *cs_name, + CHARSET_INFO *default_cs, + CHARSET_INFO **cs) { *cs= get_charset_by_csname(cs_name, MY_CS_PRIMARY, MYF(0)); @@ -635,9 +635,9 @@ bool resolve_charset(CHARSET_INFO **cs, collation with given name. */ -bool resolve_collation(CHARSET_INFO **cl, - const char *cl_name, - CHARSET_INFO *default_cl) +bool resolve_collation(const char *cl_name, + CHARSET_INFO *default_cl, + CHARSET_INFO **cl) { *cl= get_charset_by_name(cl_name, MYF(0)); diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql index c779d174d12..f46c7c7027a 100644 --- a/scripts/mysql_system_tables.sql +++ b/scripts/mysql_system_tables.sql @@ -59,8 +59,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 char(64) 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' ) DEFAULT '' NOT NULL, comment char(64) collate utf8_bin DEFAULT '' NOT NULL, 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 char(64) 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') 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 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'; @@ -75,7 +74,7 @@ CALL create_slow_log_table();; DROP PROCEDURE create_slow_log_table;; delimiter ; -CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL, modified TIMESTAMP NOT NULL, last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', 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') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', originator int(10) NOT NULL, time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events'; +CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL, modified TIMESTAMP NOT NULL, last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', 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') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', originator int(10) NOT NULL, time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', 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) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events'; CREATE TABLE IF NOT EXISTS ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM; diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql index 8ee28cbf1cb..78e6a0ceb57 100644 --- a/scripts/mysql_system_tables_fix.sql +++ b/scripts/mysql_system_tables_fix.sql @@ -388,6 +388,29 @@ ALTER TABLE proc MODIFY db MODIFY comment char(64) collate utf8_bin DEFAULT '' NOT NULL; +ALTER TABLE proc ADD character_set_client + char(32) collate utf8_bin DEFAULT NULL + AFTER comment; +ALTER TABLE proc MODIFY character_set_client + char(32) collate utf8_bin DEFAULT NULL; + +ALTER TABLE proc ADD collation_connection + char(32) collate utf8_bin DEFAULT NULL + AFTER character_set_client; +ALTER TABLE proc MODIFY collation_connection + char(32) collate utf8_bin DEFAULT NULL; + +ALTER TABLE proc ADD db_collation + char(32) collate utf8_bin DEFAULT NULL + AFTER collation_connection; +ALTER TABLE proc MODIFY db_collation + char(32) collate utf8_bin DEFAULT NULL; + +ALTER TABLE proc ADD body_utf8 longblob DEFAULT NULL + AFTER db_collation; +ALTER TABLE proc MODIFY body_utf8 longblob DEFAULT NULL; + + # # EVENT privilege # @@ -446,6 +469,29 @@ ALTER TABLE event MODIFY COLUMN status ENUM('ENABLED','DISABLED','SLAVESIDE_DISA ALTER TABLE event ADD COLUMN time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM' AFTER originator; +ALTER TABLE event ADD character_set_client + char(32) collate utf8_bin DEFAULT NULL + AFTER time_zone; +ALTER TABLE event MODIFY character_set_client + char(32) collate utf8_bin DEFAULT NULL; + +ALTER TABLE event ADD collation_connection + char(32) collate utf8_bin DEFAULT NULL + AFTER character_set_client; +ALTER TABLE event MODIFY collation_connection + char(32) collate utf8_bin DEFAULT NULL; + +ALTER TABLE event ADD db_collation + char(32) collate utf8_bin DEFAULT NULL + AFTER collation_connection; +ALTER TABLE event MODIFY db_collation + char(32) collate utf8_bin DEFAULT NULL; + +ALTER TABLE event ADD body_utf8 longblob DEFAULT NULL + AFTER db_collation; +ALTER TABLE event MODIFY body_utf8 longblob DEFAULT NULL; + + # # TRIGGER privilege # diff --git a/sql-common/client.c b/sql-common/client.c index f6325d923ab..6d63c457390 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -2459,6 +2459,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, diff --git a/sql/Makefile.am b/sql/Makefile.am index a379a950c41..36d066758bc 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -27,14 +27,19 @@ SUBDIRS = share libexec_PROGRAMS = mysqld EXTRA_PROGRAMS = gen_lex_hash bin_PROGRAMS = mysql_tzinfo_to_sql + +noinst_LTLIBRARIES= libndb.la \ + udf_example.la + SUPPORTING_LIBS = $(top_builddir)/vio/libvio.a \ $(top_builddir)/mysys/libmysys.a \ $(top_builddir)/dbug/libdbug.a \ $(top_builddir)/regex/libregex.a \ $(top_builddir)/strings/libmystrings.a -mysqld_DEPENDENCIES= @mysql_plugin_libs@ $(SUPPORTING_LIBS) +mysqld_DEPENDENCIES= @mysql_plugin_libs@ $(SUPPORTING_LIBS) libndb.la LDADD = $(SUPPORTING_LIBS) @ZLIB_LIBS@ @NDB_SCI_LIBS@ -mysqld_LDADD = @MYSQLD_EXTRA_LDFLAGS@ \ +mysqld_LDADD = libndb.la \ + @MYSQLD_EXTRA_LDFLAGS@ \ @pstack_libs@ \ @mysql_plugin_libs@ \ $(LDADD) $(CXXLDFLAGS) $(WRAPLIBS) @LIBDL@ \ @@ -94,8 +99,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \ log_event_old.cc rpl_record_old.cc \ discover.cc time.cc opt_range.cc opt_sum.cc \ records.cc filesort.cc handler.cc \ - ha_ndbcluster.cc ha_ndbcluster_cond.cc \ - ha_ndbcluster_binlog.cc ha_partition.cc \ + ha_partition.cc \ sql_db.cc sql_table.cc sql_rename.cc sql_crypt.cc \ sql_load.cc mf_iocache.cc field_conv.cc sql_show.cc \ sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc \ @@ -116,6 +120,11 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \ sql_builtin.cc sql_tablespace.cc partition_info.cc \ sql_servers.cc +libndb_la_CPPFLAGS= @ndbcluster_includes@ +libndb_la_SOURCES= ha_ndbcluster.cc \ + ha_ndbcluster_binlog.cc \ + ha_ndbcluster_cond.cc + gen_lex_hash_SOURCES = gen_lex_hash.cc gen_lex_hash_LDFLAGS = @NOINST_LDFLAGS@ @@ -159,22 +168,7 @@ lex_hash.h: gen_lex_hash.cc lex.h ./gen_lex_hash$(EXEEXT) > $@-t $(MV) $@-t $@ -# the following four should eventually be moved out of this directory -ha_ndbcluster.o:ha_ndbcluster.cc ha_ndbcluster.h - $(CXXCOMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $< - -ha_ndbcluster_cond.o:ha_ndbcluster_cond.cc ha_ndbcluster_cond.h - $(CXXCOMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $< - -ha_ndbcluster_binlog.o:ha_ndbcluster_binlog.cc ha_ndbcluster_binlog.h - $(CXXCOMPILE) @ndbcluster_includes@ $(LM_CFLAGS) -c $< - -#Until we can get rid of dependencies on ha_ndbcluster.h -handler.o: handler.cc ha_ndbcluster.h - $(CXXCOMPILE) @ndbcluster_includes@ $(CXXFLAGS) -c $< - # For testing of udf_example.so -noinst_LTLIBRARIES= udf_example.la udf_example_la_SOURCES= udf_example.c udf_example_la_LDFLAGS= -module -rpath $(pkglibdir) diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc index 77dc33e6265..7b58c10079a 100644 --- a/sql/event_data_objects.cc +++ b/sql/event_data_objects.cc @@ -23,6 +23,126 @@ #define EVEX_MAX_INTERVAL_VALUE 1000000000L +/*************************************************************************/ + +/** + Event_creation_ctx -- creation context of events. +*/ + +class Event_creation_ctx :public Stored_program_creation_ctx, + public Sql_alloc +{ +public: + static bool load_from_db(THD *thd, + MEM_ROOT *event_mem_root, + const char *db_name, + const char *event_name, + TABLE *event_tbl, + Stored_program_creation_ctx **ctx); + +public: + virtual Stored_program_creation_ctx *clone(MEM_ROOT *mem_root) + { + return new (mem_root) + Event_creation_ctx(m_client_cs, m_connection_cl, m_db_cl); + } + +protected: + virtual Object_creation_ctx *create_backup_ctx(THD *thd) const + { + /* + We can avoid usual backup/restore employed in stored programs since we + know that this is a top level statement and the worker thread is + allocated exclusively to execute this event. + */ + + return NULL; + } + +private: + Event_creation_ctx(CHARSET_INFO *client_cs, + CHARSET_INFO *connection_cl, + CHARSET_INFO *db_cl) + : Stored_program_creation_ctx(client_cs, connection_cl, db_cl) + { } +}; + +/************************************************************************** + Event_creation_ctx implementation. +**************************************************************************/ + +bool +Event_creation_ctx::load_from_db(THD *thd, + MEM_ROOT *event_mem_root, + const char *db_name, + const char *event_name, + TABLE *event_tbl, + Stored_program_creation_ctx **ctx) +{ + /* Load character set/collation attributes. */ + + CHARSET_INFO *client_cs; + CHARSET_INFO *connection_cl; + CHARSET_INFO *db_cl; + + bool invalid_creation_ctx= FALSE; + + if (load_charset(event_mem_root, + event_tbl->field[ET_FIELD_CHARACTER_SET_CLIENT], + thd->variables.character_set_client, + &client_cs)) + { + sql_print_warning("Event '%s'.'%s': invalid value " + "in column mysql.event.character_set_client.", + (const char *) db_name, + (const char *) event_name); + + invalid_creation_ctx= TRUE; + } + + if (load_collation(event_mem_root, + event_tbl->field[ET_FIELD_COLLATION_CONNECTION], + thd->variables.collation_connection, + &connection_cl)) + { + sql_print_warning("Event '%s'.'%s': invalid value " + "in column mysql.event.collation_connection.", + (const char *) db_name, + (const char *) event_name); + + invalid_creation_ctx= TRUE; + } + + if (load_collation(event_mem_root, + event_tbl->field[ET_FIELD_DB_COLLATION], + NULL, + &db_cl)) + { + sql_print_warning("Event '%s'.'%s': invalid value " + "in column mysql.event.db_collation.", + (const char *) db_name, + (const char *) event_name); + + invalid_creation_ctx= TRUE; + } + + /* + If we failed to resolve the database collation, load the default one + from the disk. + */ + + if (!db_cl) + db_cl= get_default_db_collation(thd, db_name); + + /* Create the context. */ + + *ctx= new Event_creation_ctx(client_cs, connection_cl, db_cl); + + return invalid_creation_ctx; +} + +/*************************************************************************/ + /* Initiliazes dbname and name of an Event_queue_element_for_exec object @@ -761,6 +881,7 @@ Event_timed::init() /** Load an event's body from a row from mysql.event. + @details This method is silent on errors and should behave like that. Callers should handle throwing of error messages. The reason is that the class should not know about how to deal with communication. @@ -797,6 +918,9 @@ Event_job_data::load_from_row(THD *thd, TABLE *table) if (load_time_zone(thd, tz_name)) DBUG_RETURN(TRUE); + Event_creation_ctx::load_from_db(thd, &mem_root, dbname.str, name.str, table, + &creation_ctx); + ptr= strchr(definer.str, '@'); if (! ptr) @@ -979,9 +1103,20 @@ Event_timed::load_from_row(THD *thd, TABLE *table) if (load_string_fields(table->field, ET_FIELD_BODY, &body, + ET_FIELD_BODY_UTF8, &body_utf8, ET_FIELD_COUNT)) DBUG_RETURN(TRUE); + if (Event_creation_ctx::load_from_db(thd, &mem_root, dbname.str, name.str, + table, &creation_ctx)) + { + push_warning_printf(thd, + MYSQL_ERROR::WARN_LEVEL_WARN, + ER_EVENT_INVALID_CREATION_CTX, + ER(ER_EVENT_INVALID_CREATION_CTX), + (const char *) dbname.str, + (const char *) name.str); + } ptr= strchr(definer.str, '@'); @@ -1743,7 +1878,6 @@ Event_job_data::execute(THD *thd, bool drop) #ifndef NO_EMBEDDED_ACCESS_CHECKS Security_context event_sctx, *save_sctx= NULL; #endif - CHARSET_INFO *charset_connection; List<Item> empty_item_list; bool ret= TRUE; @@ -1778,7 +1912,7 @@ Event_job_data::execute(THD *thd, bool drop) "[%s].[%s.%s] execution failed, " "failed to authenticate the user.", definer.str, dbname.str, name.str); - goto end; + goto end_no_lex_start; } #endif @@ -1795,11 +1929,11 @@ Event_job_data::execute(THD *thd, bool drop) "[%s].[%s.%s] execution failed, " "user no longer has EVENT privilege.", definer.str, dbname.str, name.str); - goto end; + goto end_no_lex_start; } if (construct_sp_sql(thd, &sp_sql)) - goto end; + goto end_no_lex_start; /* Set up global thread attributes to reflect the properties of @@ -1808,12 +1942,6 @@ Event_job_data::execute(THD *thd, bool drop) this is a top level statement and the worker thread is allocated exclusively to execute this event. */ - charset_connection= get_charset_by_csname("utf8", - MY_CS_PRIMARY, MYF(MY_WME)); - thd->variables.character_set_client= charset_connection; - thd->variables.character_set_results= charset_connection; - thd->variables.collation_connection= charset_connection; - thd->update_charset(); thd->variables.sql_mode= sql_mode; thd->variables.time_zone= time_zone; @@ -1830,7 +1958,7 @@ Event_job_data::execute(THD *thd, bool drop) Lex_input_stream lip(thd, thd->query, thd->query_length); lex_start(thd); - if (parse_sql(thd, &lip)) + if (parse_sql(thd, &lip, creation_ctx)) { sql_print_error("Event Scheduler: " "%serror during compilation of %s.%s", @@ -1850,6 +1978,7 @@ Event_job_data::execute(THD *thd, bool drop) sphead->m_flags|= sp_head::LOG_GENERAL_LOG; sphead->set_info(0, 0, &thd->lex->sp_chistics, sql_mode); + sphead->set_creation_ctx(creation_ctx); sphead->optimize(); ret= sphead->execute_procedure(thd, &empty_item_list); @@ -1860,6 +1989,13 @@ Event_job_data::execute(THD *thd, bool drop) } end: + if (thd->lex->sphead) /* NULL only if a parse error */ + { + delete thd->lex->sphead; + thd->lex->sphead= NULL; + } + +end_no_lex_start: if (drop && !thd->is_fatal_error) { /* @@ -1887,11 +2023,6 @@ end: ret= 1; } } - if (thd->lex->sphead) /* NULL only if a parse error */ - { - delete thd->lex->sphead; - thd->lex->sphead= NULL; - } #ifndef NO_EMBEDDED_ACCESS_CHECKS if (save_sctx) event_sctx.restore_security_context(thd, save_sctx); diff --git a/sql/event_data_objects.h b/sql/event_data_objects.h index d79732780ff..a8e7d1720ca 100644 --- a/sql/event_data_objects.h +++ b/sql/event_data_objects.h @@ -20,8 +20,6 @@ #define EVEX_BAD_PARAMS -5 #define EVEX_MICROSECOND_UNSUP -6 -class sp_head; -class Sql_alloc; class Event_queue_element_for_exec { @@ -151,6 +149,9 @@ public: ulong sql_mode; + class Stored_program_creation_ctx *creation_ctx; + LEX_STRING body_utf8; + Event_timed(); virtual ~Event_timed(); @@ -174,6 +175,8 @@ public: ulong sql_mode; + class Stored_program_creation_ctx *creation_ctx; + Event_job_data(); virtual bool diff --git a/sql/event_db_repository.cc b/sql/event_db_repository.cc index 703c4160216..a16a04739e2 100644 --- a/sql/event_db_repository.cc +++ b/sql/event_db_repository.cc @@ -123,6 +123,26 @@ const TABLE_FIELD_W_TYPE event_table_fields[ET_FIELD_COUNT] = { C_STRING_WITH_LEN("time_zone") }, { C_STRING_WITH_LEN("char(64)") }, { C_STRING_WITH_LEN("latin1") } + }, + { + { C_STRING_WITH_LEN("character_set_client") }, + { C_STRING_WITH_LEN("char(32)") }, + { C_STRING_WITH_LEN("utf8") } + }, + { + { C_STRING_WITH_LEN("collation_connection") }, + { C_STRING_WITH_LEN("char(32)") }, + { C_STRING_WITH_LEN("utf8") } + }, + { + { C_STRING_WITH_LEN("db_collation") }, + { C_STRING_WITH_LEN("char(32)") }, + { C_STRING_WITH_LEN("utf8") } + }, + { + { C_STRING_WITH_LEN("body_utf8") }, + { C_STRING_WITH_LEN("longblob") }, + { NULL, 0 } } }; @@ -135,6 +155,7 @@ const TABLE_FIELD_W_TYPE event_table_fields[ET_FIELD_COUNT] = @param thd THD @param table The row to fill out @param et Event's data + @param sp Event stored routine @param is_update CREATE EVENT or ALTER EVENT @retval FALSE success @@ -281,6 +302,33 @@ mysql_event_fill_row(THD *thd, goto err_truncate; } + fields[ET_FIELD_CHARACTER_SET_CLIENT]->set_notnull(); + fields[ET_FIELD_CHARACTER_SET_CLIENT]->store( + thd->variables.character_set_client->csname, + strlen(thd->variables.character_set_client->csname), + system_charset_info); + + fields[ET_FIELD_COLLATION_CONNECTION]->set_notnull(); + fields[ET_FIELD_COLLATION_CONNECTION]->store( + thd->variables.collation_connection->name, + strlen(thd->variables.collation_connection->name), + system_charset_info); + + { + CHARSET_INFO *db_cl= get_default_db_collation(thd, et->dbname.str); + + fields[ET_FIELD_DB_COLLATION]->set_notnull(); + fields[ET_FIELD_DB_COLLATION]->store( + db_cl->name, strlen(db_cl->name), system_charset_info); + } + + if (et->body_changed) + { + fields[ET_FIELD_BODY_UTF8]->set_notnull(); + fields[ET_FIELD_BODY_UTF8]->store( + sp->m_body_utf8.str, sp->m_body_utf8.length, system_charset_info); + } + DBUG_RETURN(FALSE); err_truncate: diff --git a/sql/event_db_repository.h b/sql/event_db_repository.h index 64e19854933..b60d2ea7afc 100644 --- a/sql/event_db_repository.h +++ b/sql/event_db_repository.h @@ -42,6 +42,10 @@ enum enum_events_table_field ET_FIELD_COMMENT, ET_FIELD_ORIGINATOR, ET_FIELD_TIME_ZONE, + ET_FIELD_CHARACTER_SET_CLIENT, + ET_FIELD_COLLATION_CONNECTION, + ET_FIELD_DB_COLLATION, + ET_FIELD_BODY_UTF8, ET_FIELD_COUNT /* a cool trick to count the number of fields :) */ }; @@ -53,6 +57,7 @@ events_table_index_read_for_db(THD *thd, TABLE *schema_table, int events_table_scan_all(THD *thd, TABLE *schema_table, TABLE *event_table); + class Event_basic; class Event_parse_data; diff --git a/sql/events.cc b/sql/events.cc index 2d1b3c59a4c..e48daeca63d 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -19,6 +19,7 @@ #include "event_db_repository.h" #include "event_queue.h" #include "event_scheduler.h" +#include "sp_head.h" // for Stored_program_creation_ctx /* TODO list : @@ -698,6 +699,15 @@ send_show_create_event(THD *thd, Event_timed *et, Protocol *protocol) field_list.push_back(new Item_empty_string("Create Event", show_str.length())); + field_list.push_back( + new Item_empty_string("character_set_client", MY_CS_NAME_SIZE)); + + field_list.push_back( + new Item_empty_string("collation_connection", MY_CS_NAME_SIZE)); + + field_list.push_back( + new Item_empty_string("Database Collation", MY_CS_NAME_SIZE)); + if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) DBUG_RETURN(TRUE); @@ -707,7 +717,16 @@ send_show_create_event(THD *thd, Event_timed *et, Protocol *protocol) protocol->store(et->name.str, et->name.length, system_charset_info); protocol->store(sql_mode.str, sql_mode.length, system_charset_info); protocol->store(tz_name->ptr(), tz_name->length(), system_charset_info); - protocol->store(show_str.c_ptr(), show_str.length(), system_charset_info); + protocol->store(show_str.c_ptr(), show_str.length(), &my_charset_bin); + protocol->store(et->creation_ctx->get_client_cs()->csname, + strlen(et->creation_ctx->get_client_cs()->csname), + system_charset_info); + protocol->store(et->creation_ctx->get_connection_cl()->name, + strlen(et->creation_ctx->get_connection_cl()->name), + system_charset_info); + protocol->store(et->creation_ctx->get_db_cl()->name, + strlen(et->creation_ctx->get_db_cl()->name), + system_charset_info); if (protocol->write()) DBUG_RETURN(TRUE); diff --git a/sql/field_conv.cc b/sql/field_conv.cc index 63810c8b113..44aea9acee0 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -307,6 +307,15 @@ static void do_field_string(Copy_field *copy) } +static void do_field_enum(Copy_field *copy) +{ + if (copy->from_field->val_int() == 0) + ((Field_enum *) copy->to_field)->store_type((ulonglong) 0); + else + do_field_string(copy); +} + + static void do_field_varbinary_pre50(Copy_field *copy) { char buff[MAX_FIELD_WIDTH]; @@ -667,7 +676,13 @@ void (*Copy_field::get_copy_func(Field *to,Field *from))(Copy_field*) to->real_type() == MYSQL_TYPE_SET) { if (!to->eq_def(from)) - return do_field_string; + { + if (from->real_type() == MYSQL_TYPE_ENUM && + to->real_type() == MYSQL_TYPE_ENUM) + return do_field_enum; + else + return do_field_string; + } } else if (to->charset() != from->charset()) return do_field_string; diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 102c21d19a0..c78cb4e65b4 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -2812,7 +2812,8 @@ int ha_ndbcluster::write_row(uchar *record) if (unlikely(m_slow_path)) { - if (!(thd->options & OPTION_BIN_LOG)) + Thd_ndb *thd_ndb= get_thd_ndb(thd); + if (thd_ndb->trans_options & TNTO_NO_LOGGING) op->setAnyValue(NDB_ANYVALUE_FOR_NOLOGGING); else if (thd->slave_thread) op->setAnyValue(thd->server_id); @@ -3101,7 +3102,8 @@ int ha_ndbcluster::update_row(const uchar *old_data, uchar *new_data) if (unlikely(m_slow_path)) { - if (!(thd->options & OPTION_BIN_LOG)) + Thd_ndb *thd_ndb= get_thd_ndb(thd); + if (thd_ndb->trans_options & TNTO_NO_LOGGING) op->setAnyValue(NDB_ANYVALUE_FOR_NOLOGGING); else if (thd->slave_thread) op->setAnyValue(thd->server_id); @@ -3168,7 +3170,8 @@ int ha_ndbcluster::delete_row(const uchar *record) if (unlikely(m_slow_path)) { - if (!(thd->options & OPTION_BIN_LOG)) + Thd_ndb *thd_ndb= get_thd_ndb(thd); + if (thd_ndb->trans_options & TNTO_NO_LOGGING) ((NdbOperation *)trans->getLastDefinedOperation())-> setAnyValue(NDB_ANYVALUE_FOR_NOLOGGING); else if (thd->slave_thread) @@ -3207,7 +3210,8 @@ int ha_ndbcluster::delete_row(const uchar *record) if (unlikely(m_slow_path)) { - if (!(thd->options & OPTION_BIN_LOG)) + Thd_ndb *thd_ndb= get_thd_ndb(thd); + if (thd_ndb->trans_options & TNTO_NO_LOGGING) op->setAnyValue(NDB_ANYVALUE_FOR_NOLOGGING); else if (thd->slave_thread) op->setAnyValue(thd->server_id); @@ -4385,8 +4389,13 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type) thd_ndb->query_state&= NDB_QUERY_NORMAL; thd_ndb->trans_options= 0; thd_ndb->m_slow_path= FALSE; - if (thd->slave_thread || - !(thd->options & OPTION_BIN_LOG)) + if (!(thd->options & OPTION_BIN_LOG) || + thd->variables.binlog_format == BINLOG_FORMAT_STMT) + { + thd_ndb->trans_options|= TNTO_NO_LOGGING; + thd_ndb->m_slow_path= TRUE; + } + else if (thd->slave_thread) thd_ndb->m_slow_path= TRUE; trans_register_ha(thd, FALSE, ndbcluster_hton); } @@ -4406,8 +4415,13 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type) thd_ndb->query_state&= NDB_QUERY_NORMAL; thd_ndb->trans_options= 0; thd_ndb->m_slow_path= FALSE; - if (thd->slave_thread || - !(thd->options & OPTION_BIN_LOG)) + if (!(thd->options & OPTION_BIN_LOG) || + thd->variables.binlog_format == BINLOG_FORMAT_STMT) + { + thd_ndb->trans_options|= TNTO_NO_LOGGING; + thd_ndb->m_slow_path= TRUE; + } + else if (thd->slave_thread) thd_ndb->m_slow_path= TRUE; trans_register_ha(thd, TRUE, ndbcluster_hton); @@ -8962,6 +8976,14 @@ pthread_handler_t ndb_util_thread_func(void *arg __attribute__((unused))) thd->main_security_ctx.master_access= ~0; thd->main_security_ctx.priv_user = 0; + CHARSET_INFO *charset_connection; + charset_connection= get_charset_by_csname("utf8", + MY_CS_PRIMARY, MYF(MY_WME)); + thd->variables.character_set_client= charset_connection; + thd->variables.character_set_results= charset_connection; + thd->variables.collation_connection= charset_connection; + thd->update_charset(); + /* Signal successful initialization */ ndb_util_thread_running= 1; pthread_cond_signal(&COND_ndb_util_ready); diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h index 5c6646f68af..4f5a1359d2d 100644 --- a/sql/ha_ndbcluster.h +++ b/sql/ha_ndbcluster.h @@ -178,6 +178,7 @@ enum THD_NDB_OPTIONS enum THD_NDB_TRANS_OPTIONS { TNTO_INJECTED_APPLY_STATUS= 1 << 0 + ,TNTO_NO_LOGGING= 1 << 1 }; struct Ndb_local_table_statistics { diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc index a724d1150dc..f388b60f3d5 100644 --- a/sql/ha_ndbcluster_binlog.cc +++ b/sql/ha_ndbcluster_binlog.cc @@ -3674,15 +3674,7 @@ pthread_handler_t ndb_binlog_thread_func(void *arg) if (opt_bin_log) { - if (global_system_variables.binlog_format == BINLOG_FORMAT_ROW || - global_system_variables.binlog_format == BINLOG_FORMAT_MIXED) - { - ndb_binlog_running= TRUE; - } - else - { - sql_print_error("NDB: only row based binary logging is supported"); - } + ndb_binlog_running= TRUE; } /* Thread start up completed */ diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 0c4f3cf708f..d874525c4ad 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -383,7 +383,8 @@ bool ha_partition::initialise_partition(MEM_ROOT *mem_root) m_table_flags&= file->table_flags(); } while (*(++file_array)); m_table_flags&= ~(HA_CAN_GEOMETRY | HA_CAN_FULLTEXT | HA_DUPLICATE_POS | - HA_CAN_SQL_HANDLER | HA_CAN_INSERT_DELAYED); + HA_CAN_SQL_HANDLER | HA_CAN_INSERT_DELAYED | + HA_PRIMARY_KEY_REQUIRED_FOR_POSITION); m_table_flags|= HA_FILE_BASED | HA_REC_NOT_IN_SEQ; DBUG_RETURN(0); } diff --git a/sql/handler.cc b/sql/handler.cc index 19af3397c13..cbe32dd4529 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1455,7 +1455,7 @@ int ha_delete_table(THD *thd, handlerton *table_type, const char *path, strmake(buff, thd->net.last_error, sizeof(buff)-1); thd->query_error= 0; - thd->spcont= 0; + thd->spcont= NULL; thd->lex->current_select= 0; thd->net.last_error[0]= 0; diff --git a/sql/handler.h b/sql/handler.h index 3ea1bfb55d4..6805876ff49 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1138,10 +1138,12 @@ public: int ha_index_init(uint idx, bool sorted) { + int result; DBUG_ENTER("ha_index_init"); DBUG_ASSERT(inited==NONE); - inited=INDEX; - DBUG_RETURN(index_init(idx, sorted)); + if (!(result= index_init(idx, sorted))) + inited=INDEX; + DBUG_RETURN(result); } int ha_index_end() { @@ -1152,10 +1154,11 @@ public: } int ha_rnd_init(bool scan) { + int result; DBUG_ENTER("ha_rnd_init"); DBUG_ASSERT(inited==NONE || (inited==RND && scan)); - inited=RND; - DBUG_RETURN(rnd_init(scan)); + inited= (result= rnd_init(scan)) ? NONE: RND; + DBUG_RETURN(result); } int ha_rnd_end() { diff --git a/sql/item.cc b/sql/item.cc index 4fa6a2a8517..d7743c491eb 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -6687,9 +6687,15 @@ bool Item_type_holder::join_types(THD *thd, Item *item) expansion of the size of the values because of character set conversions. */ - max_length= max(old_max_chars * collation.collation->mbmaxlen, - display_length(item) / item->collation.collation->mbmaxlen * - collation.collation->mbmaxlen); + if (collation.collation != &my_charset_bin) + { + max_length= max(old_max_chars * collation.collation->mbmaxlen, + display_length(item) / + item->collation.collation->mbmaxlen * + collation.collation->mbmaxlen); + } + else + set_if_bigger(max_length, display_length(item)); break; } case REAL_RESULT: diff --git a/sql/item.h b/sql/item.h index 82fafe6cd20..6df85476f03 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1888,11 +1888,17 @@ public: }; +/** + Item_empty_string -- is a utility class to put an item into List<Item> + which is then used in protocol.send_fields() when sending SHOW output to + the client. +*/ + class Item_empty_string :public Item_partition_func_safe_string { public: Item_empty_string(const char *header,uint length, CHARSET_INFO *cs= NULL) : - Item_partition_func_safe_string("",0, cs ? cs : &my_charset_bin) + Item_partition_func_safe_string("",0, cs ? cs : &my_charset_utf8_general_ci) { name=(char*) header; max_length= cs ? length * cs->mbmaxlen : length; } void make_field(Send_field *field); }; diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 000abb313a0..1d042860d73 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -985,7 +985,8 @@ Item_in_subselect::single_value_transformer(JOIN *join, DBUG_RETURN(RES_ERROR); thd->lex->allow_sum_func= save_allow_sum_func; /* we added aggregate function => we have to change statistic */ - count_field_types(&join->tmp_table_param, join->all_fields, 0); + count_field_types(select_lex, &join->tmp_table_param, join->all_fields, + 0); subs= new Item_singlerow_subselect(select_lex); } diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 10bd24dbb66..0fa46d231a9 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -2480,7 +2480,7 @@ bool Item_sum_count_distinct::setup(THD *thd) } if (always_null) return FALSE; - count_field_types(tmp_table_param,list,0); + count_field_types(select_lex, tmp_table_param, list, 0); tmp_table_param->force_copy_fields= force_copy_fields; DBUG_ASSERT(table == 0); if (!(table= create_tmp_table(thd, tmp_table_param, list, (ORDER*) 0, 1, @@ -3230,6 +3230,27 @@ Item_func_group_concat::fix_fields(THD *thd, Item **ref) null_value= 1; max_length= thd->variables.group_concat_max_len; + uint32 offset; + if (separator->needs_conversion(separator->length(), separator->charset(), + collation.collation, &offset)) + { + uint32 buflen= collation.collation->mbmaxlen * separator->length(); + uint errors, conv_length; + char *buf; + String *new_separator; + + if (!(buf= (char*) thd->stmt_arena->alloc(buflen)) || + !(new_separator= new(thd->stmt_arena->mem_root) + String(buf, buflen, collation.collation))) + return TRUE; + + conv_length= copy_and_convert(buf, buflen, collation.collation, + separator->ptr(), separator->length(), + separator->charset(), &errors); + new_separator->length(conv_length); + separator= new_separator; + } + if (check_sum_func(thd, ref)) return TRUE; @@ -3286,7 +3307,7 @@ bool Item_func_group_concat::setup(THD *thd) setup_order(thd, args, context->table_list, list, all_fields, *order)) DBUG_RETURN(TRUE); - count_field_types(tmp_table_param,all_fields,0); + count_field_types(select_lex, tmp_table_param, all_fields, 0); tmp_table_param->force_copy_fields= force_copy_fields; DBUG_ASSERT(table == 0); /* diff --git a/sql/item_sum.h b/sql/item_sum.h index 84b425755d1..b3a382012f1 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -966,8 +966,15 @@ public: bool fix_fields(THD *thd, Item **ref) { DBUG_ASSERT(fixed == 0); + + if (init_sum_func_check(thd)) + return TRUE; + fixed= 1; - return udf.fix_fields(thd, this, this->arg_count, this->args); + if (udf.fix_fields(thd, this, this->arg_count, this->args)) + return TRUE; + + return check_sum_func(thd, ref); } enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; } virtual bool have_field_update(void) const { return 0; } diff --git a/sql/log_event.cc b/sql/log_event.cc index 1f5013a8ef6..02d3a949cb3 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -7171,8 +7171,10 @@ replace_record(THD *thd, TABLE *table, { error=table->file->ha_update_row(table->record[1], table->record[0]); - if (error) + if (error && error != HA_ERR_RECORD_IS_THE_SAME) table->file->print_error(error, MYF(0)); + else + error= 0; DBUG_RETURN(error); } else @@ -7856,6 +7858,8 @@ int Update_rows_log_event::do_exec_row(TABLE *table) database into the after image delivered from the master. */ error= table->file->ha_update_row(table->record[1], table->record[0]); + if (error == HA_ERR_RECORD_IS_THE_SAME) + error= 0; return error; } diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index a14c139e926..dfcd86a4758 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -150,6 +150,86 @@ extern MY_LOCALE *my_default_lc_time_names; MY_LOCALE *my_locale_by_name(const char *name); MY_LOCALE *my_locale_by_number(uint number); +/*************************************************************************/ + +/** + Object_creation_ctx -- interface for creation context of database objects + (views, stored routines, events, triggers). Creation context -- is a set + of attributes, that should be fixed at the creation time and then be used + each time the object is parsed or executed. +*/ + +class Object_creation_ctx +{ +public: + Object_creation_ctx *set_n_backup(THD *thd); + + void restore_env(THD *thd, Object_creation_ctx *backup_ctx); + +protected: + virtual Object_creation_ctx *create_backup_ctx(THD *thd) = 0; + + virtual void change_env(THD *thd) const = 0; + +public: + virtual ~Object_creation_ctx() + { } +}; + +/*************************************************************************/ + +/** + Default_object_creation_ctx -- default implementation of + Object_creation_ctx. +*/ + +class Default_object_creation_ctx : public Object_creation_ctx +{ +public: + CHARSET_INFO *get_client_cs() + { + return m_client_cs; + } + + CHARSET_INFO *get_connection_cl() + { + return m_connection_cl; + } + +protected: + Default_object_creation_ctx(THD *thd); + + Default_object_creation_ctx(CHARSET_INFO *client_cs, + CHARSET_INFO *connection_cl); + +protected: + virtual Object_creation_ctx *create_backup_ctx(THD *thd); + + virtual void change_env(THD *thd) const; + +protected: + /** + client_cs stores the value of character_set_client session variable. + The only character set attribute is used. + + Client character set is included into query context, because we save + query in the original character set, which is client character set. So, + in order to parse the query properly we have to switch client character + set on parsing. + */ + CHARSET_INFO *m_client_cs; + + /** + connection_cl stores the value of collation_connection session + variable. Both character set and collation attributes are used. + + Connection collation is included into query context, becase it defines + the character set and collation of text literals in internal + representation of query (item-objects). + */ + CHARSET_INFO *m_connection_cl; +}; + /*************************************************************************** Configuration parameters ****************************************************************************/ @@ -618,7 +698,9 @@ bool check_string_char_length(LEX_STRING *str, const char *err_msg, uint max_char_length, CHARSET_INFO *cs, bool no_error); -bool parse_sql(THD *thd, class Lex_input_stream *lip); +bool parse_sql(THD *thd, + class Lex_input_stream *lip, + class Object_creation_ctx *creation_ctx); enum enum_mysql_completiontype { ROLLBACK_RELEASE=-2, ROLLBACK=1, ROLLBACK_AND_CHAIN=7, @@ -2159,12 +2241,24 @@ bool schema_table_store_record(THD *thd, TABLE *table); int item_create_init(); void item_create_cleanup(); +bool show_create_trigger(THD *thd, const sp_name *trg_name); + inline void lex_string_set(LEX_STRING *lex_str, const char *c_str) { lex_str->str= (char *) c_str; lex_str->length= strlen(c_str); } +bool load_charset(MEM_ROOT *mem_root, + Field *field, + CHARSET_INFO *dflt_cs, + CHARSET_INFO **cs); + +bool load_collation(MEM_ROOT *mem_root, + Field *field, + CHARSET_INFO *dflt_cl, + CHARSET_INFO **cl); + #endif /* MYSQL_SERVER */ #endif /* MYSQL_CLIENT */ diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index 1dde977800b..0e3544415d1 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -6076,3 +6076,24 @@ ER_SLAVE_MASTER_COM_FAILURE eng "Master command %s failed: %s" ER_BINLOG_LOGGING_IMPOSSIBLE eng "Binary logging not possible. Message: %s" + +ER_VIEW_NO_CREATION_CTX + eng "View `%-.64s`.`%-.64s` has no creation context" +ER_VIEW_INVALID_CREATION_CTX + eng "Creation context of view `%-.64s`.`%-.64s' is invalid" + +ER_SR_INVALID_CREATION_CTX + eng "Creation context of stored routine `%-.64s`.`%-.64s` is invalid" + +ER_TRG_CORRUPTED_FILE + eng "Corrupted TRG file for table `%-.64s`.`%-.64s`" +ER_TRG_NO_CREATION_CTX + eng "Triggers for table `%-.64s`.`%-.64s` have no creation context" +ER_TRG_INVALID_CREATION_CTX + eng "Trigger creation context of table `%-.64s`.`%-.64s` is invalid" + +ER_EVENT_INVALID_CREATION_CTX + eng "Creation context of event `%-.64s`.`%-.64s` is invalid" + +ER_TRG_CANT_OPEN_TABLE + eng "Cannot open table for trigger `%-.64s`.`%-.64s`" diff --git a/sql/sp.cc b/sql/sp.cc index 6e890f638d0..66c6c05c930 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -35,7 +35,8 @@ static int db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp, ulong sql_mode, const char *params, const char *returns, const char *body, st_sp_chistics &chistics, - const char *definer, longlong created, longlong modified); + const char *definer, longlong created, longlong modified, + Stored_program_creation_ctx *creation_ctx); /* * @@ -61,12 +62,191 @@ enum MYSQL_PROC_FIELD_MODIFIED, MYSQL_PROC_FIELD_SQL_MODE, MYSQL_PROC_FIELD_COMMENT, + MYSQL_PROC_FIELD_CHARACTER_SET_CLIENT, + MYSQL_PROC_FIELD_COLLATION_CONNECTION, + MYSQL_PROC_FIELD_DB_COLLATION, + MYSQL_PROC_FIELD_BODY_UTF8, MYSQL_PROC_FIELD_COUNT }; /* Tells what SP_DEFAULT_ACCESS should be mapped to */ #define SP_DEFAULT_ACCESS_MAPPING SP_CONTAINS_SQL +/*************************************************************************/ + +/** + Stored_routine_creation_ctx -- creation context of stored routines + (stored procedures and functions). +*/ + +class Stored_routine_creation_ctx : public Stored_program_creation_ctx, + public Sql_alloc +{ +public: + static Stored_routine_creation_ctx * + load_from_db(THD *thd, const class sp_name *name, TABLE *proc_tbl); + +public: + virtual Stored_program_creation_ctx *clone(MEM_ROOT *mem_root) + { + return new (mem_root) Stored_routine_creation_ctx(m_client_cs, + m_connection_cl, + m_db_cl); + } + +protected: + virtual Object_creation_ctx *create_backup_ctx(THD *thd) const + { + return new Stored_routine_creation_ctx(thd); + } + +private: + Stored_routine_creation_ctx(THD *thd) + : Stored_program_creation_ctx(thd) + { } + + Stored_routine_creation_ctx(CHARSET_INFO *client_cs, + CHARSET_INFO *connection_cl, + CHARSET_INFO *db_cl) + : Stored_program_creation_ctx(client_cs, connection_cl, db_cl) + { } +}; + +/************************************************************************** + Stored_routine_creation_ctx implementation. +**************************************************************************/ + +bool load_charset(MEM_ROOT *mem_root, + Field *field, + CHARSET_INFO *dflt_cs, + CHARSET_INFO **cs) +{ + String cs_name; + + if (get_field(mem_root, field, &cs_name)) + { + *cs= dflt_cs; + return TRUE; + } + + *cs= get_charset_by_csname(cs_name.c_ptr(), MY_CS_PRIMARY, MYF(0)); + + if (*cs == NULL) + { + *cs= dflt_cs; + return TRUE; + } + + return FALSE; +} + +/*************************************************************************/ + +bool load_collation(MEM_ROOT *mem_root, + Field *field, + CHARSET_INFO *dflt_cl, + CHARSET_INFO **cl) +{ + String cl_name; + + if (get_field(mem_root, field, &cl_name)) + { + *cl= dflt_cl; + return TRUE; + } + + *cl= get_charset_by_name(cl_name.c_ptr(), MYF(0)); + + if (*cl == NULL) + { + *cl= dflt_cl; + return TRUE; + } + + return FALSE; +} + +/*************************************************************************/ + +Stored_routine_creation_ctx * +Stored_routine_creation_ctx::load_from_db(THD *thd, + const sp_name *name, + TABLE *proc_tbl) +{ + /* Load character set/collation attributes. */ + + CHARSET_INFO *client_cs; + CHARSET_INFO *connection_cl; + CHARSET_INFO *db_cl; + + const char *db_name= thd->strmake(name->m_db.str, name->m_db.length); + const char *sr_name= thd->strmake(name->m_name.str, name->m_name.length); + + bool invalid_creation_ctx= FALSE; + + if (load_charset(thd->mem_root, + proc_tbl->field[MYSQL_PROC_FIELD_CHARACTER_SET_CLIENT], + thd->variables.character_set_client, + &client_cs)) + { + sql_print_warning("Stored routine '%s'.'%s': invalid value " + "in column mysql.proc.character_set_client.", + (const char *) db_name, + (const char *) sr_name); + + invalid_creation_ctx= TRUE; + } + + if (load_collation(thd->mem_root, + proc_tbl->field[MYSQL_PROC_FIELD_COLLATION_CONNECTION], + thd->variables.collation_connection, + &connection_cl)) + { + sql_print_warning("Stored routine '%s'.'%s': invalid value " + "in column mysql.proc.collation_connection.", + (const char *) db_name, + (const char *) sr_name); + + invalid_creation_ctx= TRUE; + } + + if (load_collation(thd->mem_root, + proc_tbl->field[MYSQL_PROC_FIELD_DB_COLLATION], + NULL, + &db_cl)) + { + sql_print_warning("Stored routine '%s'.'%s': invalid value " + "in column mysql.proc.db_collation.", + (const char *) db_name, + (const char *) sr_name); + + invalid_creation_ctx= TRUE; + } + + if (invalid_creation_ctx) + { + push_warning_printf(thd, + MYSQL_ERROR::WARN_LEVEL_WARN, + ER_SR_INVALID_CREATION_CTX, + ER(ER_SR_INVALID_CREATION_CTX), + (const char *) db_name, + (const char *) sr_name); + } + + /* + If we failed to retrieve the database collation, load the default one + from the disk. + */ + + if (!db_cl) + db_cl= get_default_db_collation(thd, name->m_db.str); + + /* Create the context. */ + + return new Stored_routine_creation_ctx(client_cs, connection_cl, db_cl); +} + +/*************************************************************************/ /* Open the mysql.proc table for read. @@ -213,6 +393,8 @@ db_find_routine(THD *thd, int type, sp_name *name, sp_head **sphp) String str(buff, sizeof(buff), &my_charset_bin); ulong sql_mode; Open_tables_state open_tables_state_backup; + Stored_program_creation_ctx *creation_ctx; + DBUG_ENTER("db_find_routine"); DBUG_PRINT("enter", ("type: %d name: %.*s", type, (int) name->m_name.length, name->m_name.str)); @@ -313,13 +495,14 @@ db_find_routine(THD *thd, int type, sp_name *name, sp_head **sphp) chistics.comment.str= ptr; chistics.comment.length= length; + creation_ctx= Stored_routine_creation_ctx::load_from_db(thd, name, table); + close_system_tables(thd, &open_tables_state_backup); table= 0; ret= db_load_routine(thd, type, name, sphp, sql_mode, params, returns, body, chistics, - definer, created, modified); - + definer, created, modified, creation_ctx); done: if (table) close_system_tables(thd, &open_tables_state_backup); @@ -331,7 +514,8 @@ static int db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp, ulong sql_mode, const char *params, const char *returns, const char *body, st_sp_chistics &chistics, - const char *definer, longlong created, longlong modified) + const char *definer, longlong created, longlong modified, + Stored_program_creation_ctx *creation_ctx) { LEX *old_lex= thd->lex, newlex; String defstr; @@ -361,7 +545,7 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp, definer_user_name.str, &definer_user_name.length, definer_host_name.str, &definer_host_name.length); - defstr.set_charset(system_charset_info); + defstr.set_charset(creation_ctx->get_client_cs()); /* We have to add DEFINER clause and provide proper routine characterstics in @@ -381,6 +565,15 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp, goto end; } + /* + Change current database if needed. + + collation_database will be updated here. However, it can be wrong, + because it will contain the current value of the database collation. + We need collation_database to be fixed at the creation time -- so + we'll update it later in switch_query_ctx(). + */ + if ((ret= sp_use_new_db(thd, name->m_db, &old_db, 1, &dbchanged))) goto end; @@ -388,9 +581,10 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp, { Lex_input_stream lip(thd, defstr.c_ptr(), defstr.length()); + lex_start(thd); - if (parse_sql(thd, &lip) || newlex.sphead == NULL) + if (parse_sql(thd, &lip, creation_ctx) || newlex.sphead == NULL) { sp_head *sp= newlex.sphead; @@ -406,6 +600,7 @@ db_load_routine(THD *thd, int type, sp_name *name, sp_head **sphp, *sphp= newlex.sphead; (*sphp)->set_definer(&definer_user_name, &definer_host_name); (*sphp)->set_info(created, modified, &chistics, sql_mode); + (*sphp)->set_creation_ctx(creation_ctx); (*sphp)->optimize(); } } @@ -465,6 +660,8 @@ sp_create_routine(THD *thd, int type, sp_head *sp) TABLE *table; char definer[USER_HOST_BUFF_SIZE]; + CHARSET_INFO *db_cs= get_default_db_collation(thd, sp->m_db.str); + DBUG_ENTER("sp_create_routine"); DBUG_PRINT("enter", ("type: %d name: %.*s",type, (int) sp->m_name.length, sp->m_name.str)); @@ -576,6 +773,26 @@ sp_create_routine(THD *thd, int type, sp_head *sp) } } + table->field[MYSQL_PROC_FIELD_CHARACTER_SET_CLIENT]->set_notnull(); + table->field[MYSQL_PROC_FIELD_CHARACTER_SET_CLIENT]->store( + thd->charset()->csname, + strlen(thd->charset()->csname), + system_charset_info); + + table->field[MYSQL_PROC_FIELD_COLLATION_CONNECTION]->set_notnull(); + table->field[MYSQL_PROC_FIELD_COLLATION_CONNECTION]->store( + thd->variables.collation_connection->name, + strlen(thd->variables.collation_connection->name), + system_charset_info); + + table->field[MYSQL_PROC_FIELD_DB_COLLATION]->set_notnull(); + table->field[MYSQL_PROC_FIELD_DB_COLLATION]->store( + db_cs->name, strlen(db_cs->name), system_charset_info); + + table->field[MYSQL_PROC_FIELD_BODY_UTF8]->set_notnull(); + table->field[MYSQL_PROC_FIELD_BODY_UTF8]->store( + sp->m_body_utf8.str, sp->m_body_utf8.length, system_charset_info); + ret= SP_OK; if (table->file->ha_write_row(table->record[0])) ret= SP_WRITE_ROW_FAILED; @@ -715,8 +932,11 @@ sp_update_routine(THD *thd, int type, sp_name *name, st_sp_chistics *chistics) table->field[MYSQL_PROC_FIELD_COMMENT]->store(chistics->comment.str, chistics->comment.length, system_charset_info); - if ((table->file->ha_update_row(table->record[1],table->record[0]))) + if ((ret= table->file->ha_update_row(table->record[1],table->record[0])) && + ret != HA_ERR_RECORD_IS_THE_SAME) ret= SP_WRITE_ROW_FAILED; + else + ret= 0; } if (ret == SP_OK) @@ -740,15 +960,18 @@ struct st_used_field static struct st_used_field init_fields[]= { - { "Db", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0}, - { "Name", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0}, - { "Type", 9, MYSQL_TYPE_STRING, 0}, - { "Definer", 77, MYSQL_TYPE_STRING, 0}, - { "Modified", 0, MYSQL_TYPE_TIMESTAMP, 0}, - { "Created", 0, MYSQL_TYPE_TIMESTAMP, 0}, - { "Security_type", 1, MYSQL_TYPE_STRING, 0}, - { "Comment", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0}, - { 0, 0, MYSQL_TYPE_STRING, 0} + { "Db", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0}, + { "Name", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0}, + { "Type", 9, MYSQL_TYPE_STRING, 0}, + { "Definer", USER_HOST_BUFF_SIZE, MYSQL_TYPE_STRING, 0}, + { "Modified", 0, MYSQL_TYPE_TIMESTAMP, 0}, + { "Created", 0, MYSQL_TYPE_TIMESTAMP, 0}, + { "Security_type", 1, MYSQL_TYPE_STRING, 0}, + { "Comment", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0}, + { "character_set_client", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0}, + { "collation_connection", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0}, + { "Database Collation", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0}, + { 0, 0, MYSQL_TYPE_STRING, 0} }; @@ -1124,7 +1347,8 @@ sp_find_routine(THD *thd, int type, sp_name *name, sp_cache **cp, if (db_load_routine(thd, type, name, &new_sp, sp->m_sql_mode, sp->m_params.str, returns, sp->m_body.str, *sp->m_chistics, definer, - sp->m_created, sp->m_modified) == SP_OK) + sp->m_created, sp->m_modified, + sp->get_creation_ctx()) == SP_OK) { sp->m_last_cached_sp->m_next_cached_sp= new_sp; new_sp->m_recursion_level= level; @@ -1853,4 +2077,3 @@ sp_use_new_db(THD *thd, LEX_STRING new_db, LEX_STRING *old_db, *dbchangedp= ret == 0; DBUG_RETURN(ret); } - diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 821d19dca79..f0cc5204749 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -180,6 +180,7 @@ sp_get_flags_for_command(LEX *lex) case SQLCOM_SHOW_CREATE_FUNC: case SQLCOM_SHOW_CREATE_PROC: case SQLCOM_SHOW_CREATE_EVENT: + case SQLCOM_SHOW_CREATE_TRIGGER: case SQLCOM_SHOW_DATABASES: case SQLCOM_SHOW_ERRORS: case SQLCOM_SHOW_FIELDS: @@ -280,7 +281,6 @@ sp_get_flags_for_command(LEX *lex) return flags; } - /* Prepare an Item for evaluation (call of fix_fields). @@ -426,8 +426,6 @@ check_routine_name(LEX_STRING *ident) return FALSE; } -/* ------------------------------------------------------------------ */ - /* * @@ -493,6 +491,10 @@ sp_head::sp_head() 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); + + m_body_utf8.str= NULL; + m_body_utf8.length= 0; + DBUG_VOID_RETURN; } @@ -550,32 +552,53 @@ sp_head::init_sp_name(THD *thd, sp_name *spname) void -sp_head::init_strings(THD *thd, LEX *lex) +sp_head::set_body_start(THD *thd, const char *begin_ptr) +{ + m_body_begin= begin_ptr; + thd->m_lip->body_utf8_start(thd, begin_ptr); +} + + +void +sp_head::set_stmt_end(THD *thd) { - DBUG_ENTER("sp_head::init_strings"); - const char *endp; /* Used to trim the end */ - /* During parsing, we must use thd->mem_root */ - MEM_ROOT *root= thd->mem_root; - Lex_input_stream *lip=thd->m_lip; + Lex_input_stream *lip= thd->m_lip; /* shortcut */ + const char *end_ptr= lip->get_cpp_ptr(); /* shortcut */ + + /* Make the string of parameters. */ if (m_param_begin && m_param_end) { m_params.length= m_param_end - m_param_begin; - m_params.str= strmake_root(root, m_param_begin, m_params.length); + m_params.str= thd->strmake(m_param_begin, m_params.length); } - endp= lip->get_cpp_ptr(); - lex->stmt_definition_end= endp; + /* Remember end pointer for further dumping of whole statement. */ + + thd->lex->stmt_definition_end= end_ptr; + + /* Make the string of body (in the original character set). */ - m_body.length= endp - m_body_begin; - m_body.str= strmake_root(root, m_body_begin, m_body.length); + m_body.length= end_ptr - m_body_begin; + m_body.str= thd->strmake(m_body_begin, m_body.length); trim_whitespace(thd->charset(), & m_body); - m_defstr.length= endp - lip->get_cpp_buf(); - m_defstr.str= strmake_root(root, lip->get_cpp_buf(), m_defstr.length); - trim_whitespace(thd->charset(), & m_defstr); + /* Make the string of UTF-body. */ - DBUG_VOID_RETURN; + lip->body_utf8_append(end_ptr); + + m_body_utf8.length= lip->get_body_utf8_length(); + m_body_utf8.str= thd->strmake(lip->get_body_utf8_str(), m_body_utf8.length); + trim_whitespace(thd->charset(), & m_body_utf8); + + /* + Make the string of whole stored-program-definition query (in the + original character set). + */ + + m_defstr.length= end_ptr - lip->get_cpp_buf(); + m_defstr.str= thd->strmake(lip->get_cpp_buf(), m_defstr.length); + trim_whitespace(thd->charset(), & m_defstr); } @@ -968,6 +991,8 @@ sp_head::execute(THD *thd) Item_change_list old_change_list; String old_packet; + Object_creation_ctx *saved_creation_ctx; + /* Use some extra margin for possible SP recursion and functions */ if (check_stack_overrun(thd, 8 * STACK_MIN_SIZE, (uchar*)&old_packet)) DBUG_RETURN(TRUE); @@ -1057,6 +1082,10 @@ sp_head::execute(THD *thd) */ thd->spcont->callers_arena= &backup_arena; + /* Switch query context. */ + + saved_creation_ctx= m_creation_ctx->set_n_backup(thd); + do { sp_instr *i; @@ -1143,6 +1172,12 @@ sp_head::execute(THD *thd) } } while (!err_status && !thd->killed); + /* Restore query context. */ + + m_creation_ctx->restore_env(thd, saved_creation_ctx); + + /* Restore arena. */ + thd->restore_active_arena(&execute_arena, &backup_arena); thd->spcont->pop_all_cursors(); // To avoid memory leaks after an error @@ -1971,18 +2006,15 @@ sp_head::fill_field_definition(THD *thd, LEX *lex, enum enum_field_types field_type, Create_field *field_def) { - HA_CREATE_INFO sp_db_info; LEX_STRING cmt = { 0, 0 }; uint unused1= 0; int unused2= 0; - load_db_opt_by_name(thd, m_db.str, &sp_db_info); - if (field_def->init(thd, (char*) "", field_type, lex->length, lex->dec, lex->type, (Item*) 0, (Item*) 0, &cmt, 0, &lex->interval_list, - (lex->charset ? lex->charset : - sp_db_info.default_table_charset), + lex->charset ? lex->charset : + thd->variables.collation_database, lex->uint_geom_type)) return TRUE; @@ -2054,13 +2086,6 @@ sp_head::set_info(longlong created, longlong modified, void -sp_head::set_body_begin_ptr(Lex_input_stream *lip, const char *begin_ptr) -{ - m_body_begin= begin_ptr; -} - - -void sp_head::set_definer(const char *definer, uint definerlen) { char user_name_holder[USERNAME_LENGTH + 1]; @@ -2212,6 +2237,15 @@ sp_head::show_create_routine(THD *thd, int type) fields.push_back(stmt_fld); } + fields.push_back(new Item_empty_string("character_set_client", + MY_CS_NAME_SIZE)); + + fields.push_back(new Item_empty_string("collation_connection", + MY_CS_NAME_SIZE)); + + fields.push_back(new Item_empty_string("Database Collation", + MY_CS_NAME_SIZE)); + if (protocol->send_fields(&fields, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) { @@ -2230,6 +2264,11 @@ sp_head::show_create_routine(THD *thd, int type) else protocol->store_null(); + + protocol->store(m_creation_ctx->get_client_cs()->csname, system_charset_info); + protocol->store(m_creation_ctx->get_connection_cl()->name, system_charset_info); + protocol->store(m_creation_ctx->get_db_cl()->name, system_charset_info); + err_status= protocol->write(); if (!err_status) @@ -2424,7 +2463,9 @@ sp_head::show_routine_code(THD *thd) if ((res= protocol->write())) break; } - send_eof(thd); + + if (!res) + send_eof(thd); DBUG_RETURN(res); } @@ -2693,7 +2734,7 @@ sp_instr_set::exec_core(THD *thd, uint *nextp) sp_rcontext *spcont= thd->spcont; - thd->spcont= 0; /* Avoid handlers */ + thd->spcont= NULL; /* Avoid handlers */ my_error(ER_OUT_OF_RESOURCES, MYF(0)); spcont->clear_handler(); thd->spcont= spcont; @@ -3428,7 +3469,7 @@ sp_instr_set_case_expr::exec_core(THD *thd, uint *nextp) sp_rcontext *spcont= thd->spcont; - thd->spcont= 0; /* Avoid handlers */ + thd->spcont= NULL; /* Avoid handlers */ my_error(ER_OUT_OF_RESOURCES, MYF(0)); spcont->clear_handler(); thd->spcont= spcont; diff --git a/sql/sp_head.h b/sql/sp_head.h index 50f6017ca0d..490fda67bfe 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -45,6 +45,58 @@ class sp_instr_jump_if_not; struct sp_cond_type; struct sp_variable; +/*************************************************************************/ + +/** + Stored_program_creation_ctx -- base class for creation context of stored + programs (stored routines, triggers, events). +*/ + +class Stored_program_creation_ctx :public Default_object_creation_ctx +{ +public: + CHARSET_INFO *get_db_cl() + { + return m_db_cl; + } + +public: + virtual Stored_program_creation_ctx *clone(MEM_ROOT *mem_root) = 0; + +protected: + Stored_program_creation_ctx(THD *thd) + : Default_object_creation_ctx(thd), + m_db_cl(thd->variables.collation_database) + { } + + Stored_program_creation_ctx(CHARSET_INFO *client_cs, + CHARSET_INFO *connection_cl, + CHARSET_INFO *db_cl) + : Default_object_creation_ctx(client_cs, connection_cl), + m_db_cl(db_cl) + { } + +protected: + virtual void change_env(THD *thd) const + { + thd->variables.collation_database= m_db_cl; + + Default_object_creation_ctx::change_env(thd); + } + +protected: + /** + db_cl stores the value of the database collation. Both character set + and collation attributes are used. + + Database collation is included into the context because it defines the + default collation for stored-program variables. + */ + CHARSET_INFO *m_db_cl; +}; + +/*************************************************************************/ + class sp_name : public Sql_alloc { public: @@ -136,9 +188,25 @@ public: LEX_STRING m_name; LEX_STRING m_params; LEX_STRING m_body; + LEX_STRING m_body_utf8; LEX_STRING m_defstr; LEX_STRING m_definer_user; LEX_STRING m_definer_host; + +private: + Stored_program_creation_ctx *m_creation_ctx; + +public: + inline Stored_program_creation_ctx *get_creation_ctx() + { + return m_creation_ctx; + } + + inline void set_creation_ctx(Stored_program_creation_ctx *creation_ctx) + { + m_creation_ctx= creation_ctx->clone(mem_root); + } + longlong m_created; longlong m_modified; /* Recursion level of the current SP instance. The levels are numbered from 0 */ @@ -205,9 +273,13 @@ public: void init_sp_name(THD *thd, sp_name *spname); - // Initialize strings after parsing header + /** Set the body-definition start position. */ + void + set_body_start(THD *thd, const char *begin_ptr); + + /** Set the statement-definition (body-definition) end position. */ void - init_strings(THD *thd, LEX *lex); + set_stmt_end(THD *thd); int create(THD *thd); @@ -300,8 +372,6 @@ public: void set_info(longlong created, longlong modified, st_sp_chistics *chistics, ulong sql_mode); - void set_body_begin_ptr(Lex_input_stream *lip, const char *begin_ptr); - void set_definer(const char *definer, uint definerlen); void set_definer(const LEX_STRING *user_name, const LEX_STRING *host_name); diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 8f0af8af3ed..67fa380d313 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1825,7 +1825,8 @@ static bool update_user_table(THD *thd, TABLE *table, } store_record(table,record[1]); table->field[2]->store(new_password, new_password_len, system_charset_info); - if ((error=table->file->ha_update_row(table->record[1],table->record[0]))) + if ((error=table->file->ha_update_row(table->record[1],table->record[0])) && + error != HA_ERR_RECORD_IS_THE_SAME) { table->file->print_error(error,MYF(0)); /* purecov: deadcode */ DBUG_RETURN(1); @@ -2041,12 +2042,18 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo, We should NEVER delete from the user table, as a uses can still use mysqld even if he doesn't have any privileges in the user table! */ - if (cmp_record(table,record[1]) && - (error=table->file->ha_update_row(table->record[1],table->record[0]))) - { // This should never happen - table->file->print_error(error,MYF(0)); /* purecov: deadcode */ - error= -1; /* purecov: deadcode */ - goto end; /* purecov: deadcode */ + if (cmp_record(table,record[1])) + { + if ((error= + table->file->ha_update_row(table->record[1],table->record[0])) && + error != HA_ERR_RECORD_IS_THE_SAME) + { // This should never happen + table->file->print_error(error,MYF(0)); /* purecov: deadcode */ + error= -1; /* purecov: deadcode */ + goto end; /* purecov: deadcode */ + } + else + error= 0; } } else if ((error=table->file->ha_write_row(table->record[0]))) // insert @@ -2161,7 +2168,8 @@ static int replace_db_table(TABLE *table, const char *db, if (rights) { if ((error= table->file->ha_update_row(table->record[1], - table->record[0]))) + table->record[0])) && + error != HA_ERR_RECORD_IS_THE_SAME) goto table_error; /* purecov: deadcode */ } else /* must have been a revoke of all privileges */ @@ -2543,12 +2551,14 @@ static int replace_column_table(GRANT_TABLE *g_t, error=table->file->ha_update_row(table->record[1],table->record[0]); else error=table->file->ha_delete_row(table->record[1]); - if (error) + if (error && error != HA_ERR_RECORD_IS_THE_SAME) { table->file->print_error(error,MYF(0)); /* purecov: inspected */ result= -1; /* purecov: inspected */ goto end; /* purecov: inspected */ } + else + error= 0; grant_column= column_hash_search(g_t, column->column.ptr(), column->column.length()); if (grant_column) // Should always be true @@ -2608,7 +2618,8 @@ static int replace_column_table(GRANT_TABLE *g_t, { int tmp_error; if ((tmp_error=table->file->ha_update_row(table->record[1], - table->record[0]))) + table->record[0])) && + tmp_error != HA_ERR_RECORD_IS_THE_SAME) { /* purecov: deadcode */ table->file->print_error(tmp_error,MYF(0)); /* purecov: deadcode */ result= -1; /* purecov: deadcode */ @@ -2730,7 +2741,9 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table, { if (store_table_rights || store_col_rights) { - if ((error=table->file->ha_update_row(table->record[1],table->record[0]))) + if ((error=table->file->ha_update_row(table->record[1], + table->record[0])) && + error != HA_ERR_RECORD_IS_THE_SAME) goto table_error; /* purecov: deadcode */ } else if ((error = table->file->ha_delete_row(table->record[1]))) @@ -2848,7 +2861,9 @@ static int replace_routine_table(THD *thd, GRANT_NAME *grant_name, { if (store_proc_rights) { - if ((error=table->file->ha_update_row(table->record[1],table->record[0]))) + if ((error=table->file->ha_update_row(table->record[1], + table->record[0])) && + error != HA_ERR_RECORD_IS_THE_SAME) goto table_error; } else if ((error= table->file->ha_delete_row(table->record[1]))) @@ -4914,8 +4929,12 @@ static int modify_grant_table(TABLE *table, Field *host_field, system_charset_info); user_field->store(user_to->user.str, user_to->user.length, system_charset_info); - if ((error= table->file->ha_update_row(table->record[1], table->record[0]))) + if ((error= table->file->ha_update_row(table->record[1], + table->record[0])) && + error != HA_ERR_RECORD_IS_THE_SAME) table->file->print_error(error, MYF(0)); + else + error= 0; } else { diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 026e1c3b218..fb5fd2ec627 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -28,6 +28,8 @@ #include <io.h> #endif +#define FLAGSTR(S,F) ((S) & (F) ? #F " " : "") + /** This internal handler is used to trap internally errors that can occur when executing open table @@ -3996,36 +3998,47 @@ int decide_logging_format(THD *thd, TABLE_LIST *tables) { if (mysql_bin_log.is_open() && (thd->options & OPTION_BIN_LOG)) { - handler::Table_flags binlog_flags= ~handler::Table_flags(); + handler::Table_flags flags_some_set= handler::Table_flags(); + handler::Table_flags flags_all_set= ~handler::Table_flags(); + my_bool multi_engine= FALSE; + void* prev_ht= NULL; for (TABLE_LIST *table= tables; table; table= table->next_global) + { if (!table->placeholder() && table->lock_type >= TL_WRITE_ALLOW_WRITE) { -#define FLAGSTR(S,F) ((S) & (F) ? #F " " : "") -#ifndef DBUG_OFF - ulonglong flags= table->table->file->ha_table_flags(); + ulonglong const flags= table->table->file->ha_table_flags(); DBUG_PRINT("info", ("table: %s; ha_table_flags: %s%s", table->table_name, FLAGSTR(flags, HA_BINLOG_STMT_CAPABLE), FLAGSTR(flags, HA_BINLOG_ROW_CAPABLE))); -#endif - binlog_flags &= table->table->file->ha_table_flags(); + if (prev_ht && prev_ht != table->table->file->ht) + multi_engine= TRUE; + prev_ht= table->table->file->ht; + flags_all_set &= flags; + flags_some_set |= flags; } - binlog_flags&= HA_BINLOG_FLAGS; - DBUG_PRINT("info", ("binlog_flags: %s%s", - FLAGSTR(binlog_flags, HA_BINLOG_STMT_CAPABLE), - FLAGSTR(binlog_flags, HA_BINLOG_ROW_CAPABLE))); + } + + DBUG_PRINT("info", ("flags_all_set: %s%s", + FLAGSTR(flags_all_set, HA_BINLOG_STMT_CAPABLE), + FLAGSTR(flags_all_set, HA_BINLOG_ROW_CAPABLE))); + DBUG_PRINT("info", ("flags_some_set: %s%s", + FLAGSTR(flags_some_set, HA_BINLOG_STMT_CAPABLE), + FLAGSTR(flags_some_set, HA_BINLOG_ROW_CAPABLE))); DBUG_PRINT("info", ("thd->variables.binlog_format: %ld", thd->variables.binlog_format)); + DBUG_PRINT("info", ("multi_engine: %s", + multi_engine ? "TRUE" : "FALSE")); int error= 0; - if (binlog_flags == 0) + if (flags_all_set == 0) { my_error((error= ER_BINLOG_LOGGING_IMPOSSIBLE), MYF(0), "Statement cannot be logged to the binary log in" " row-based nor statement-based format"); } else if (thd->variables.binlog_format == BINLOG_FORMAT_STMT && - (binlog_flags & HA_BINLOG_STMT_CAPABLE) == 0) + (flags_all_set & HA_BINLOG_STMT_CAPABLE) == 0) { my_error((error= ER_BINLOG_LOGGING_IMPOSSIBLE), MYF(0), "Statement-based format required for this statement," @@ -4033,13 +4046,29 @@ int decide_logging_format(THD *thd, TABLE_LIST *tables) } else if ((thd->variables.binlog_format == BINLOG_FORMAT_ROW || thd->lex->is_stmt_unsafe()) && - (binlog_flags & HA_BINLOG_ROW_CAPABLE) == 0) + (flags_all_set & HA_BINLOG_ROW_CAPABLE) == 0) { my_error((error= ER_BINLOG_LOGGING_IMPOSSIBLE), MYF(0), "Row-based format required for this statement," " but not allowed by this combination of engines"); } + /* + If more than one engine is involved in the statement and at + least one is doing it's own logging (is *self-logging*), the + statement cannot be logged atomically, so we generate an error + rather than allowing the binlog to become corrupt. + */ + if (multi_engine && + (flags_some_set & HA_HAS_OWN_BINLOGGING)) + { + error= ER_BINLOG_LOGGING_IMPOSSIBLE; + my_error(error, MYF(0), + "Statement cannot be written atomically since more" + " than one engine involved and at least one engine" + " is self-logging"); + } + DBUG_PRINT("info", ("error: %d", error)); if (error) @@ -4061,7 +4090,7 @@ int decide_logging_format(THD *thd, TABLE_LIST *tables) here. */ if (thd->lex->is_stmt_unsafe() || - (binlog_flags & HA_BINLOG_STMT_CAPABLE) == 0) + (flags_all_set & HA_BINLOG_STMT_CAPABLE) == 0) { thd->set_current_stmt_binlog_row_based_if_mixed(); } diff --git a/sql/sql_class.h b/sql/sql_class.h index 1c0d6e4c258..0a518e860e5 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -440,6 +440,13 @@ public: #ifndef DBUG_OFF bool is_backup_arena; /* True if this arena is used for backup. */ #endif + /* + The states relfects three diffrent life cycles for three + different types of statements: + Prepared statement: INITIALIZED -> PREPARED -> EXECUTED. + Stored procedure: INITIALIZED_FOR_SP -> EXECUTED. + Other statements: CONVENTIONAL_EXECUTION never changes. + */ enum enum_state { INITIALIZED= 0, INITIALIZED_FOR_SP= 1, PREPARED= 2, @@ -1987,6 +1994,7 @@ class select_insert :public select_result_interceptor { virtual bool can_rollback_data() { return 0; } void send_error(uint errcode,const char *err); bool send_eof(); + void abort(); /* not implemented: select_insert is never re-used in prepared statements */ void cleanup(); }; diff --git a/sql/sql_error.cc b/sql/sql_error.cc index 61442c52de7..5ebeba6109a 100644 --- a/sql/sql_error.cc +++ b/sql/sql_error.cc @@ -126,7 +126,7 @@ MYSQL_ERROR *push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level, sp_rcontext *spcont= thd->spcont; thd->no_warnings_for_error= 1; - thd->spcont= 0; + thd->spcont= NULL; thd->killed= THD::KILL_BAD_DATA; my_message(code, msg, MYF(0)); diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index c0efa621422..eeac5e7c4fe 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1423,7 +1423,8 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) compare_record(table)) { if ((error=table->file->ha_update_row(table->record[1], - table->record[0]))) + table->record[0])) && + error != HA_ERR_RECORD_IS_THE_SAME) { if (info->ignore && !table->file->is_fatal_error(error, HA_CHECK_DUP_KEY)) @@ -1433,7 +1434,10 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) goto err; } - info->updated++; + if (error != HA_ERR_RECORD_IS_THE_SAME) + info->updated++; + else + error= 0; /* If ON DUP KEY UPDATE updates a row instead of inserting one, it's like a regular UPDATE statement: it should not affect the value of a @@ -1481,9 +1485,13 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) (!table->triggers || !table->triggers->has_delete_triggers())) { if ((error=table->file->ha_update_row(table->record[1], - table->record[0]))) + table->record[0])) && + error != HA_ERR_RECORD_IS_THE_SAME) goto err; - info->deleted++; + if (error != HA_ERR_RECORD_IS_THE_SAME) + info->deleted++; + else + error= 0; thd->record_first_successful_insert_id_in_cur_stmt(table->file->insert_id_for_cur_row); /* Since we pretend that we have done insert we should call @@ -3020,57 +3028,8 @@ void select_insert::send_error(uint errcode,const char *err) { DBUG_ENTER("select_insert::send_error"); - /* Avoid an extra 'unknown error' message if we already reported an error */ - if (errcode != ER_UNKNOWN_ERROR && !thd->net.report_error) - my_message(errcode, err, MYF(0)); - - /* - If the creation of the table failed (due to a syntax error, for - example), no table will have been opened and therefore 'table' - will be NULL. In that case, we still need to execute the rollback - and the end of the function. - */ - if (table) - { - /* - If we are not in prelocked mode, we end the bulk insert started - before. - */ - if (!thd->prelocked_mode) - table->file->ha_end_bulk_insert(); - - /* - If at least one row has been inserted/modified and will stay in - the table (the table doesn't have transactions) we must write to - the binlog (and the error code will make the slave stop). - - For many errors (example: we got a duplicate key error while - inserting into a MyISAM table), no row will be added to the table, - so passing the error to the slave will not help since there will - be an error code mismatch (the inserts will succeed on the slave - with no error). - - If table creation failed, the number of rows modified will also be - zero, so no check for that is made. - */ - if (info.copied || info.deleted || info.updated) - { - DBUG_ASSERT(table != NULL); - if (!table->file->has_transactions()) - { - if (mysql_bin_log.is_open()) - thd->binlog_query(THD::ROW_QUERY_TYPE, thd->query, thd->query_length, - table->file->has_transactions(), FALSE); - if (!thd->current_stmt_binlog_row_based && !table->s->tmp_table && - !can_rollback_data()) - thd->no_trans_update.all= TRUE; - query_cache_invalidate3(thd, table, 1); - } - } - table->file->ha_release_auto_increment(); - } + my_message(errcode, err, MYF(0)); - ha_rollback_stmt(thd); DBUG_VOID_RETURN; } @@ -3160,6 +3119,59 @@ bool select_insert::send_eof() DBUG_RETURN(0); } +void select_insert::abort() { + + DBUG_ENTER("select_insert::abort"); + /* + If the creation of the table failed (due to a syntax error, for + example), no table will have been opened and therefore 'table' + will be NULL. In that case, we still need to execute the rollback + and the end of the function. + */ + if (table) + { + /* + If we are not in prelocked mode, we end the bulk insert started + before. + */ + if (!thd->prelocked_mode) + table->file->ha_end_bulk_insert(); + + /* + If at least one row has been inserted/modified and will stay in + the table (the table doesn't have transactions) we must write to + the binlog (and the error code will make the slave stop). + + For many errors (example: we got a duplicate key error while + inserting into a MyISAM table), no row will be added to the table, + so passing the error to the slave will not help since there will + be an error code mismatch (the inserts will succeed on the slave + with no error). + + If table creation failed, the number of rows modified will also be + zero, so no check for that is made. + */ + if (info.copied || info.deleted || info.updated) + { + DBUG_ASSERT(table != NULL); + if (!table->file->has_transactions()) + { + if (mysql_bin_log.is_open()) + thd->binlog_query(THD::ROW_QUERY_TYPE, thd->query, thd->query_length, + table->file->has_transactions(), FALSE); + if (!thd->current_stmt_binlog_row_based && !table->s->tmp_table && + !can_rollback_data()) + thd->no_trans_update.all= TRUE; + query_cache_invalidate3(thd, table, 1); + } + } + table->file->ha_release_auto_increment(); + } + + ha_rollback_stmt(thd); + DBUG_VOID_RETURN; +} + /*************************************************************************** CREATE TABLE (SELECT) ... @@ -3597,6 +3609,14 @@ void select_create::abort() DBUG_ENTER("select_create::abort"); /* + Disable binlog, because we "roll back" partial inserts in ::abort + by removing the table, even for non-transactional tables. + */ + tmp_disable_binlog(thd); + select_insert::abort(); + reenable_binlog(thd); + + /* We roll back the statement, including truncating the transaction cache of the binary log, if the statement failed. diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 304feea5f5c..639f0d2325d 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -123,15 +123,19 @@ Lex_input_stream::Lex_input_stream(THD *thd, m_end_of_query(buffer + length), m_tok_start_prev(NULL), m_buf(buffer), + m_buf_length(length), m_echo(true), m_cpp_tok_start(NULL), m_cpp_tok_start_prev(NULL), m_cpp_tok_end(NULL), + m_body_utf8(NULL), + m_cpp_utf8_processed_ptr(NULL), next_state(MY_LEX_START), found_semicolon(NULL), ignore_space(test(thd->variables.sql_mode & MODE_IGNORE_SPACE)), stmt_prepare_mode(FALSE), - in_comment(NO_COMMENT) + in_comment(NO_COMMENT), + m_underscore_cs(NULL) { m_cpp_buf= (char*) thd->alloc(length + 1); m_cpp_ptr= m_cpp_buf; @@ -140,6 +144,133 @@ Lex_input_stream::Lex_input_stream(THD *thd, Lex_input_stream::~Lex_input_stream() {} +/** + The operation is called from the parser in order to + 1) designate the intention to have utf8 body; + 1) Indicate to the lexer that we will need a utf8 representation of this + statement; + 2) Determine the beginning of the body. + + @param thd Thread context. + @param begin_ptr Pointer to the start of the body in the pre-processed + buffer. +*/ + +void Lex_input_stream::body_utf8_start(THD *thd, const char *begin_ptr) +{ + DBUG_ASSERT(begin_ptr); + DBUG_ASSERT(m_cpp_buf <= begin_ptr && begin_ptr <= m_cpp_buf + m_buf_length); + + uint body_utf8_length= + (m_buf_length / thd->variables.character_set_client->mbminlen) * + my_charset_utf8_bin.mbmaxlen; + + m_body_utf8= (char *) thd->alloc(body_utf8_length + 1); + m_body_utf8_ptr= m_body_utf8; + *m_body_utf8_ptr= 0; + + m_cpp_utf8_processed_ptr= begin_ptr; +} + +/** + The operation appends unprocessed part of pre-processed buffer till + the given pointer (ptr) and sets m_cpp_utf8_processed_ptr to end_ptr. + + The idea is that some tokens in the pre-processed buffer (like character + set introducers) should be skipped. + + Example: + CPP buffer: SELECT 'str1', _latin1 'str2'; + m_cpp_utf8_processed_ptr -- points at the "SELECT ..."; + In order to skip "_latin1", the following call should be made: + body_utf8_append(<pointer to "_latin1 ...">, <pointer to " 'str2'...">) + + @param ptr Pointer in the pre-processed buffer, which specifies the + end of the chunk, which should be appended to the utf8 + body. + @param end_ptr Pointer in the pre-processed buffer, to which + m_cpp_utf8_processed_ptr will be set in the end of the + operation. +*/ + +void Lex_input_stream::body_utf8_append(const char *ptr, + const char *end_ptr) +{ + DBUG_ASSERT(m_cpp_buf <= ptr && ptr <= m_cpp_buf + m_buf_length); + DBUG_ASSERT(m_cpp_buf <= end_ptr && end_ptr <= m_cpp_buf + m_buf_length); + + if (!m_body_utf8) + return; + + if (m_cpp_utf8_processed_ptr >= ptr) + return; + + int bytes_to_copy= ptr - m_cpp_utf8_processed_ptr; + + memcpy(m_body_utf8_ptr, m_cpp_utf8_processed_ptr, bytes_to_copy); + m_body_utf8_ptr += bytes_to_copy; + *m_body_utf8_ptr= 0; + + m_cpp_utf8_processed_ptr= end_ptr; +} + +/** + The operation appends unprocessed part of the pre-processed buffer till + the given pointer (ptr) and sets m_cpp_utf8_processed_ptr to ptr. + + @param ptr Pointer in the pre-processed buffer, which specifies the end + of the chunk, which should be appended to the utf8 body. +*/ + +void Lex_input_stream::body_utf8_append(const char *ptr) +{ + body_utf8_append(ptr, ptr); +} + +/** + The operation converts the specified text literal to the utf8 and appends + the result to the utf8-body. + + @param thd Thread context. + @param txt Text literal. + @param txt_cs Character set of the text literal. + @param end_ptr Pointer in the pre-processed buffer, to which + m_cpp_utf8_processed_ptr will be set in the end of the + operation. +*/ + +void Lex_input_stream::body_utf8_append_literal(THD *thd, + const LEX_STRING *txt, + CHARSET_INFO *txt_cs, + const char *end_ptr) +{ + if (!m_cpp_utf8_processed_ptr) + return; + + LEX_STRING utf_txt; + + if (!my_charset_same(txt_cs, &my_charset_utf8_general_ci)) + { + thd->convert_string(&utf_txt, + &my_charset_utf8_general_ci, + txt->str, txt->length, + txt_cs); + } + else + { + utf_txt.str= txt->str; + utf_txt.length= txt->length; + } + + /* NOTE: utf_txt.length is in bytes, not in symbols. */ + + memcpy(m_body_utf8_ptr, utf_txt.str, utf_txt.length); + m_body_utf8_ptr += utf_txt.length; + *m_body_utf8_ptr= 0; + + m_cpp_utf8_processed_ptr= end_ptr; +} + /* This is called before every query that is to be parsed. @@ -231,6 +362,7 @@ void lex_start(THD *thd) lex->server_options.socket= 0; lex->server_options.owner= 0; lex->server_options.port= -1; + DBUG_VOID_RETURN; } @@ -311,6 +443,10 @@ static LEX_STRING get_token(Lex_input_stream *lip, uint skip, uint length) lip->yyUnget(); // ptr points now after last token char tmp.length=lip->yytoklen=length; tmp.str= lip->m_thd->strmake(lip->get_tok_start() + skip, tmp.length); + + lip->m_cpp_text_start= lip->get_cpp_tok_start() + skip; + lip->m_cpp_text_end= lip->m_cpp_text_start + tmp.length; + return tmp; } @@ -334,10 +470,17 @@ static LEX_STRING get_quoted_token(Lex_input_stream *lip, from= lip->get_tok_start() + skip; to= tmp.str; end= to+length; + + lip->m_cpp_text_start= lip->get_cpp_tok_start() + skip; + lip->m_cpp_text_end= lip->m_cpp_text_start + length; + for ( ; to != end; ) { if ((*to++= *from++) == quote) + { from++; // Skip double quotes + lip->m_cpp_text_start++; + } } *to= 0; // End null for safety return tmp; @@ -402,6 +545,10 @@ static char *get_text(Lex_input_stream *lip, int pre_skip, int post_skip) if (!(start= (char*) lip->m_thd->alloc((uint) (end-str)+1))) return (char*) ""; // Sql_alloc has set error flag + + lip->m_cpp_text_start= lip->get_cpp_tok_start() + pre_skip; + lip->m_cpp_text_end= lip->get_cpp_ptr() - post_skip; + if (!found_escape) { lip->yytoklen=(uint) (end-str); @@ -743,18 +890,33 @@ int MYSQLlex(void *arg, void *yythd) } yylval->lex_str=get_token(lip, 0, length); - /* + /* Note: "SELECT _bla AS 'alias'" _bla should be considered as a IDENT if charset haven't been found. - So we don't use MYF(MY_WME) with get_charset_by_csname to avoid + So we don't use MYF(MY_WME) with get_charset_by_csname to avoid producing an error. */ - if ((yylval->lex_str.str[0]=='_') && - (lex->underscore_charset= - get_charset_by_csname(yylval->lex_str.str + 1, - MY_CS_PRIMARY,MYF(0)))) - return(UNDERSCORE_CHARSET); + if (yylval->lex_str.str[0] == '_') + { + CHARSET_INFO *cs= get_charset_by_csname(yylval->lex_str.str + 1, + MY_CS_PRIMARY, MYF(0)); + if (cs) + { + yylval->charset= cs; + lip->m_underscore_cs= cs; + + lip->body_utf8_append(lip->m_cpp_text_start, + lip->get_cpp_tok_start() + length); + return(UNDERSCORE_CHARSET); + } + } + + lip->body_utf8_append(lip->m_cpp_text_start); + + lip->body_utf8_append_literal(thd, &yylval->lex_str, cs, + lip->m_cpp_text_end); + return(result_state); // IDENT or IDENT_QUOTED case MY_LEX_IDENT_SEP: // Found ident and now '.' @@ -852,6 +1014,12 @@ int MYSQLlex(void *arg, void *yythd) lip->next_state=MY_LEX_IDENT_SEP;// Next is '.' yylval->lex_str= get_token(lip, 0, lip->yyLength()); + + lip->body_utf8_append(lip->m_cpp_text_start); + + lip->body_utf8_append_literal(thd, &yylval->lex_str, cs, + lip->m_cpp_text_end); + return(result_state); case MY_LEX_USER_VARIABLE_DELIMITER: // Found quote char @@ -887,6 +1055,12 @@ int MYSQLlex(void *arg, void *yythd) if (c == quote_char) lip->yySkip(); // Skip end ` lip->next_state= MY_LEX_START; + + lip->body_utf8_append(lip->m_cpp_text_start); + + lip->body_utf8_append_literal(thd, &yylval->lex_str, cs, + lip->m_cpp_text_end); + return(IDENT_QUOTED); } case MY_LEX_INT_OR_REAL: // Complete int or incomplete real @@ -995,6 +1169,15 @@ int MYSQLlex(void *arg, void *yythd) break; } yylval->lex_str.length=lip->yytoklen; + + lip->body_utf8_append(lip->m_cpp_text_start); + + lip->body_utf8_append_literal(thd, &yylval->lex_str, + lip->m_underscore_cs ? lip->m_underscore_cs : cs, + lip->m_cpp_text_end); + + lip->m_underscore_cs= NULL; + return(TEXT_STRING); case MY_LEX_COMMENT: // Comment @@ -1201,6 +1384,12 @@ int MYSQLlex(void *arg, void *yythd) return(tokval); // Was keyword } yylval->lex_str=get_token(lip, 0, length); + + lip->body_utf8_append(lip->m_cpp_text_start); + + lip->body_utf8_append_literal(thd, &yylval->lex_str, cs, + lip->m_cpp_text_end); + return(result_state); } } diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 7a47c57a722..254403fe736 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -112,7 +112,8 @@ enum enum_sql_command { SQLCOM_SHOW_CONTRIBUTORS, SQLCOM_CREATE_SERVER, SQLCOM_DROP_SERVER, SQLCOM_ALTER_SERVER, SQLCOM_CREATE_EVENT, SQLCOM_ALTER_EVENT, SQLCOM_DROP_EVENT, - SQLCOM_SHOW_CREATE_EVENT, SQLCOM_SHOW_EVENTS, + SQLCOM_SHOW_CREATE_EVENT, SQLCOM_SHOW_EVENTS, + SQLCOM_SHOW_CREATE_TRIGGER, /* This should be the last !!! */ @@ -1330,6 +1331,26 @@ public: return (uint) ((m_ptr - m_tok_start) - 1); } + /** Get the utf8-body string. */ + const char *get_body_utf8_str() + { + return m_body_utf8; + } + + /** Get the utf8-body length. */ + uint get_body_utf8_length() + { + return m_body_utf8_ptr - m_body_utf8; + } + + void body_utf8_start(THD *thd, const char *begin_ptr); + void body_utf8_append(const char *ptr); + void body_utf8_append(const char *ptr, const char *end_ptr); + void body_utf8_append_literal(THD *thd, + const LEX_STRING *txt, + CHARSET_INFO *txt_cs, + const char *end_ptr); + /** Current thread. */ THD *m_thd; @@ -1361,6 +1382,9 @@ private: /** Begining of the query text in the input stream, in the raw buffer. */ const char* m_buf; + /** Length of the raw buffer. */ + uint m_buf_length; + /** Echo the parsed stream to the pre-processed buffer. */ bool m_echo; @@ -1388,6 +1412,18 @@ private: */ const char* m_cpp_tok_end; + /** UTF8-body buffer created during parsing. */ + char *m_body_utf8; + + /** Pointer to the current position in the UTF8-body buffer. */ + char *m_body_utf8_ptr; + + /** + Position in the pre-processed buffer. The query from m_cpp_buf to + m_cpp_utf_processed_ptr is converted to UTF8-body. + */ + const char *m_cpp_utf8_processed_ptr; + public: /** Current state of the lexical analyser. */ @@ -1410,6 +1446,29 @@ public: /** State of the lexical analyser for comments. */ enum_comment_state in_comment; + + /** + Starting position of the TEXT_STRING or IDENT in the pre-processed + buffer. + + NOTE: this member must be used within MYSQLlex() function only. + */ + const char *m_cpp_text_start; + + /** + Ending position of the TEXT_STRING or IDENT in the pre-processed + buffer. + + NOTE: this member must be used within MYSQLlex() function only. + */ + const char *m_cpp_text_end; + + /** + Character set specified by the character-set-introducer. + + NOTE: this member must be used within MYSQLlex() function only. + */ + CHARSET_INFO *m_underscore_cs; }; @@ -1444,7 +1503,7 @@ typedef struct st_lex : public Query_tables_list DYNAMIC_ARRAY plugins; plugin_ref plugins_static_buffer[INITIAL_LEX_PLUGIN_LIST_SIZE]; - CHARSET_INFO *charset, *underscore_charset; + CHARSET_INFO *charset; /* store original leaf_tables for INSERT SELECT and PS/SP */ TABLE_LIST *leaf_tables_insert; @@ -1635,6 +1694,8 @@ typedef struct st_lex : public Query_tables_list const char *fname_start; const char *fname_end; + LEX_STRING view_body_utf8; + /* Reference to a struct that contains information in various commands to add/create/drop/change table spaces. diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 4845f45948f..a49f560d8d4 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3012,6 +3012,7 @@ end_with_restore_list: break; case SQLCOM_LOCK_TABLES: unlock_locked_tables(thd); + /* we must end the trasaction first, regardless of anything */ if (end_active_trans(thd)) goto error; if (check_table_access(thd, LOCK_TABLES_ACL | SELECT_ACL, all_tables, 0)) @@ -3030,7 +3031,15 @@ end_with_restore_list: send_ok(thd); } else + { + /* + Need to end the current transaction, so the storage engine (InnoDB) + can free its locks if LOCK TABLES locked some tables before finding + that it can't lock a table in its list + */ + end_active_trans(thd); thd->options&= ~(ulong) (OPTION_TABLE_LOCK); + } thd->in_lock_tables=0; break; case SQLCOM_CREATE_DB: @@ -4074,8 +4083,25 @@ create_sp_error: break; } #endif // ifndef DBUG_OFF + case SQLCOM_SHOW_CREATE_TRIGGER: + { + if (lex->spname->m_name.length > NAME_LEN) + { + my_error(ER_TOO_LONG_IDENT, MYF(0), lex->spname->m_name.str); + goto error; + } + + if (show_create_trigger(thd, lex->spname)) + goto error; /* Error has been already logged. */ + + break; + } case SQLCOM_CREATE_VIEW: { + /* + Note: SQLCOM_CREATE_VIEW also handles 'ALTER VIEW' commands + as specified through the thd->lex->create_view_mode flag. + */ if (end_active_trans(thd)) goto error; @@ -5336,7 +5362,7 @@ void mysql_parse(THD *thd, const char *inBuf, uint length, Lex_input_stream lip(thd, inBuf, length); - bool err= parse_sql(thd, &lip); + bool err= parse_sql(thd, &lip, NULL); *found_semicolon= lip.found_semicolon; if (!err) @@ -5420,7 +5446,7 @@ bool mysql_test_parse_for_slave(THD *thd, char *inBuf, uint length) lex_start(thd); mysql_reset_thd_for_next_command(thd); - if (!parse_sql(thd, &lip) && + if (!parse_sql(thd, &lip, NULL) && all_tables_not_ok(thd,(TABLE_LIST*) lex->select_lex.table_list.first)) error= 1; /* Ignore question */ thd->end_statement(); @@ -7123,23 +7149,44 @@ extern int MYSQLparse(void *thd); // from sql_yacc.cc @param thd Thread context. @param lip Lexer context. + @param creation_ctx Object creation context. @return Error status. @retval FALSE on success. @retval TRUE on parsing error. */ -bool parse_sql(THD *thd, Lex_input_stream *lip) +bool parse_sql(THD *thd, + Lex_input_stream *lip, + Object_creation_ctx *creation_ctx) { - bool err_status; - DBUG_ASSERT(thd->m_lip == NULL); + /* Backup creation context. */ + + Object_creation_ctx *backup_ctx= NULL; + + if (creation_ctx) + backup_ctx= creation_ctx->set_n_backup(thd); + + /* Set Lex_input_stream. */ + thd->m_lip= lip; - err_status= MYSQLparse(thd) != 0 || thd->is_fatal_error; + /* Parse the query. */ + + bool err_status= MYSQLparse(thd) != 0 || thd->is_fatal_error; + + /* Reset Lex_input_stream. */ thd->m_lip= NULL; + /* Restore creation context. */ + + if (creation_ctx) + creation_ctx->restore_env(thd, backup_ctx); + + /* That's it. */ + return err_status; } diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index ad3cf2d3e7a..f3253e5b086 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -3728,7 +3728,7 @@ bool mysql_unpack_partition(THD *thd, lex.part_info->part_state= part_state; lex.part_info->part_state_len= part_state_len; DBUG_PRINT("info", ("Parse: %s", part_buf)); - if (parse_sql(thd, &lip)) + if (parse_sql(thd, &lip, NULL)) { thd->free_items(); goto end; diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 7badccd55d9..406e242cada 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1726,6 +1726,13 @@ static bool check_prepared_statement(Prepared_statement *stmt, res= mysql_test_create_table(stmt); break; + case SQLCOM_CREATE_VIEW: + if (lex->create_view_mode == VIEW_ALTER) + { + my_message(ER_UNSUPPORTED_PS, ER(ER_UNSUPPORTED_PS), MYF(0)); + goto error; + } + break; case SQLCOM_DO: res= mysql_test_do_fields(stmt, tables, lex->insert_list); break; @@ -1762,6 +1769,7 @@ static bool check_prepared_statement(Prepared_statement *stmt, case SQLCOM_SHOW_CREATE_PROC: case SQLCOM_SHOW_CREATE_FUNC: case SQLCOM_SHOW_CREATE_EVENT: + case SQLCOM_SHOW_CREATE_TRIGGER: case SQLCOM_SHOW_CREATE: case SQLCOM_SHOW_PROC_CODE: case SQLCOM_SHOW_FUNC_CODE: @@ -1779,7 +1787,6 @@ static bool check_prepared_statement(Prepared_statement *stmt, case SQLCOM_ROLLBACK: case SQLCOM_TRUNCATE: case SQLCOM_CALL: - case SQLCOM_CREATE_VIEW: case SQLCOM_DROP_VIEW: case SQLCOM_REPAIR: case SQLCOM_ANALYZE: @@ -2870,7 +2877,7 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len) lip.stmt_prepare_mode= TRUE; lex_start(thd); - error= parse_sql(thd, &lip) || + error= parse_sql(thd, &lip, NULL) || thd->net.report_error || init_param_array(this); @@ -2916,18 +2923,6 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len) thd->restore_backup_statement(this, &stmt_backup); thd->stmt_arena= old_stmt_arena; - if ((protocol->type() == Protocol::PROTOCOL_TEXT) && (param_count > 0)) - { - /* - This is a mysql_sql_stmt_prepare(); query expansion will insert user - variable references, and user variables are uncacheable, thus we have to - mark this statement as uncacheable. - This has to be done before setup_set_params(), as it may make expansion - unneeded. - */ - lex->safe_to_cache_query= FALSE; - } - if (error == 0) { setup_set_params(); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 9cb59d957de..a855e536fec 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -262,11 +262,8 @@ bool handle_select(THD *thd, LEX *lex, select_result *result, thd->net.report_error)); res|= thd->net.report_error; if (unlikely(res)) - { - /* If we had a another error reported earlier then this will be ignored */ - result->send_error(ER_UNKNOWN_ERROR, ER(ER_UNKNOWN_ERROR)); result->abort(); - } + DBUG_RETURN(res); } @@ -610,7 +607,7 @@ JOIN::prepare(Item ***rref_pointer_array, goto err; /* purecov: inspected */ /* Init join struct */ - count_field_types(&tmp_table_param, all_fields, 0); + count_field_types(select_lex, &tmp_table_param, all_fields, 0); ref_pointer_array_size= all_fields.elements*sizeof(Item*); this->group= group_list != 0; unit= unit_arg; @@ -1785,7 +1782,7 @@ JOIN::exec() if (make_simple_join(curr_join, curr_tmp_table)) DBUG_VOID_RETURN; calc_group_buffer(curr_join, group_list); - count_field_types(&curr_join->tmp_table_param, + count_field_types(select_lex, &curr_join->tmp_table_param, curr_join->tmp_all_fields1, curr_join->select_distinct && !curr_join->group_list); curr_join->tmp_table_param.hidden_field_count= @@ -1908,11 +1905,13 @@ JOIN::exec() if (make_simple_join(curr_join, curr_tmp_table)) DBUG_VOID_RETURN; calc_group_buffer(curr_join, curr_join->group_list); - count_field_types(&curr_join->tmp_table_param, *curr_all_fields, 0); + count_field_types(select_lex, &curr_join->tmp_table_param, + *curr_all_fields, 0); } if (procedure) - count_field_types(&curr_join->tmp_table_param, *curr_all_fields, 0); + count_field_types(select_lex, &curr_join->tmp_table_param, + *curr_all_fields, 0); if (curr_join->group || curr_join->tmp_table_param.sum_func_count || (procedure && (procedure->flags & PROC_GROUP))) @@ -13980,8 +13979,8 @@ next_item: *****************************************************************************/ void -count_field_types(TMP_TABLE_PARAM *param, List<Item> &fields, - bool reset_with_sum_func) +count_field_types(SELECT_LEX *select_lex, TMP_TABLE_PARAM *param, + List<Item> &fields, bool reset_with_sum_func) { List_iterator<Item> li(fields); Item *field; @@ -13999,18 +13998,22 @@ count_field_types(TMP_TABLE_PARAM *param, List<Item> &fields, if (! field->const_item()) { Item_sum *sum_item=(Item_sum*) field->real_item(); - if (!sum_item->quick_group) - param->quick_group=0; // UDF SUM function - param->sum_func_count++; - param->func_count++; + if (!sum_item->depended_from() || + sum_item->depended_from() == select_lex) + { + if (!sum_item->quick_group) + param->quick_group=0; // UDF SUM function + param->sum_func_count++; - for (uint i=0 ; i < sum_item->arg_count ; i++) - { - if (sum_item->args[0]->real_item()->type() == Item::FIELD_ITEM) - param->field_count++; - else - param->func_count++; - } + for (uint i=0 ; i < sum_item->arg_count ; i++) + { + if (sum_item->args[0]->real_item()->type() == Item::FIELD_ITEM) + param->field_count++; + else + param->func_count++; + } + } + param->func_count++; } } else @@ -14471,7 +14474,9 @@ bool JOIN::make_sum_func_list(List<Item> &field_list, List<Item> &send_fields, func= sum_funcs; while ((item=it++)) { - if (item->type() == Item::SUM_FUNC_ITEM && !item->const_item()) + if (item->type() == Item::SUM_FUNC_ITEM && !item->const_item() && + (!((Item_sum*) item)->depended_from() || + ((Item_sum *)item)->depended_from() == select_lex)) *func++= (Item_sum*) item; } if (before_group_by && rollup.state == ROLLUP::STATE_INITED) @@ -15053,7 +15058,10 @@ bool JOIN::rollup_make_fields(List<Item> &fields_arg, List<Item> &sel_fields, ref_array= ref_array_start; } - if (item->type() == Item::SUM_FUNC_ITEM && !item->const_item()) + if (item->type() == Item::SUM_FUNC_ITEM && !item->const_item() && + (!((Item_sum*) item)->depended_from() || + ((Item_sum *)item)->depended_from() == select_lex)) + { /* This is a top level summary function that must be replaced with diff --git a/sql/sql_select.h b/sql/sql_select.h index 290a0f5d992..98f2a7829dd 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -509,8 +509,8 @@ TABLE *create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, ulonglong select_options, ha_rows rows_limit, char* alias); void free_tmp_table(THD *thd, TABLE *entry); -void count_field_types(TMP_TABLE_PARAM *param, List<Item> &fields, - bool reset_with_sum_func); +void count_field_types(SELECT_LEX *select_lex, TMP_TABLE_PARAM *param, + List<Item> &fields, bool reset_with_sum_func); bool setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param, Item **ref_pointer_array, List<Item> &new_list1, List<Item> &new_list2, diff --git a/sql/sql_servers.cc b/sql/sql_servers.cc index 195e6743a72..ac5ea6f4ac4 100644 --- a/sql/sql_servers.cc +++ b/sql/sql_servers.cc @@ -872,11 +872,15 @@ update_server_record(TABLE *table, FOREIGN_SERVER *server) /* ok, so we can update since the record exists in the table */ store_record(table,record[1]); store_server_fields(table, server); - if ((error=table->file->ha_update_row(table->record[1],table->record[0]))) + if ((error=table->file->ha_update_row(table->record[1], + table->record[0])) && + error != HA_ERR_RECORD_IS_THE_SAME) { DBUG_PRINT("info",("problems with ha_update_row %d", error)); goto end; } + else + error= 0; } end: diff --git a/sql/sql_show.cc b/sql/sql_show.cc index dcaa466011e..8906c5654c7 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -54,10 +54,12 @@ enum enum_i_s_events_fields ISE_LAST_ALTERED, ISE_LAST_EXECUTED, ISE_EVENT_COMMENT, - ISE_ORIGINATOR + ISE_ORIGINATOR, + ISE_CLIENT_CS, + ISE_CONNECTION_CL, + ISE_DB_CL }; - #ifndef NO_EMBEDDED_ACCESS_CHECKS static const char *grant_names[]={ "select","insert","update","delete","create","drop","reload","shutdown", @@ -592,6 +594,10 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) } buffer.length(0); + + if (table_list->view) + buffer.set_charset(table_list->view_creation_ctx->get_client_cs()); + if ((table_list->view ? view_store_create_info(thd, table_list, &buffer) : store_create_info(thd, table_list, &buffer, NULL))) @@ -603,6 +609,10 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) field_list.push_back(new Item_empty_string("View",NAME_CHAR_LEN)); field_list.push_back(new Item_empty_string("Create View", max(buffer.length(),1024))); + field_list.push_back(new Item_empty_string("character_set_client", + MY_CS_NAME_SIZE)); + field_list.push_back(new Item_empty_string("collation_connection", + MY_CS_NAME_SIZE)); } else { @@ -626,10 +636,23 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) else protocol->store(table_list->table->alias, system_charset_info); } - protocol->store(buffer.ptr(), buffer.length(), buffer.charset()); + + if (table_list->view) + { + protocol->store(buffer.ptr(), buffer.length(), &my_charset_bin); + + protocol->store(table_list->view_creation_ctx->get_client_cs()->csname, + system_charset_info); + + protocol->store(table_list->view_creation_ctx->get_connection_cl()->name, + system_charset_info); + } + else + protocol->store(buffer.ptr(), buffer.length(), buffer.charset()); if (protocol->write()) DBUG_RETURN(TRUE); + send_eof(thd); DBUG_RETURN(FALSE); } @@ -842,7 +865,7 @@ append_identifier(THD *thd, String *packet, const char *name, uint length) if (q == EOF) { - packet->append(name, length, system_charset_info); + packet->append(name, length, packet->charset()); return; } @@ -860,7 +883,7 @@ append_identifier(THD *thd, String *packet, const char *name, uint length) uchar chr= (uchar) *name; length= my_mbcharlen(system_charset_info, chr); /* - my_mbcharlen can retur 0 on a wrong multibyte + my_mbcharlen can return 0 on a wrong multibyte sequence. It is possible when upgrading from 4.0, and identifier contains some accented characters. The manual says it does not work. So we'll just @@ -870,7 +893,7 @@ append_identifier(THD *thd, String *packet, const char *name, uint length) length= 1; if (length == 1 && chr == (uchar) quote_char) packet->append("e_char, 1, system_charset_info); - packet->append(name, length, packet->charset()); + packet->append(name, length, system_charset_info); } packet->append("e_char, 1, system_charset_info); } @@ -2379,6 +2402,7 @@ int make_db_list(THD *thd, List<char> *files, LEX *lex= thd->lex; *with_i_schema= 0; get_index_field_values(lex, idx_field_vals); + if (is_wild_value) { /* @@ -3426,7 +3450,7 @@ bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table, } if (full_access) { - get_field(thd->mem_root, proc_table->field[10], &tmp_string); + get_field(thd->mem_root, proc_table->field[19], &tmp_string); table->field[7]->store(tmp_string.ptr(), tmp_string.length(), cs); table->field[7]->set_notnull(); } @@ -3449,6 +3473,16 @@ bool store_schema_proc(THD *thd, TABLE *table, TABLE *proc_table, get_field(thd->mem_root, proc_table->field[15], &tmp_string); table->field[18]->store(tmp_string.ptr(), tmp_string.length(), cs); table->field[19]->store(definer.ptr(), definer.length(), cs); + + get_field(thd->mem_root, proc_table->field[16], &tmp_string); + table->field[20]->store(tmp_string.ptr(), tmp_string.length(), cs); + + get_field(thd->mem_root, proc_table->field[17], &tmp_string); + table->field[21]->store(tmp_string.ptr(), tmp_string.length(), cs); + + get_field(thd->mem_root, proc_table->field[18], &tmp_string); + table->field[22]->store(tmp_string.ptr(), tmp_string.length(), cs); + return schema_table_store_record(thd, table); } } @@ -3626,14 +3660,9 @@ static int get_schema_views_record(THD *thd, struct st_table_list *tables, table->field[2]->store(tables->view_name.str, tables->view_name.length, cs); if (tables->allowed_show) { - char buff[2048]; - String qwe_str(buff, sizeof(buff), cs); - qwe_str.length(0); - qwe_str.append(STRING_WITH_LEN("/* ")); - append_algorithm(tables, &qwe_str); - qwe_str.append(STRING_WITH_LEN("*/ ")); - qwe_str.append(tables->query.str, tables->query.length); - table->field[3]->store(qwe_str.ptr(), qwe_str.length(), cs); + table->field[3]->store(tables->view_body_utf8.str, + tables->view_body_utf8.length, + cs); } if (tables->with_check != VIEW_CHECK_NONE) @@ -3684,6 +3713,17 @@ static int get_schema_views_record(THD *thd, struct st_table_list *tables, table->field[7]->store(STRING_WITH_LEN("DEFINER"), cs); else table->field[7]->store(STRING_WITH_LEN("INVOKER"), cs); + + table->field[8]->store( + tables->view_creation_ctx->get_client_cs()->csname, + strlen(tables->view_creation_ctx->get_client_cs()->csname), + cs); + + table->field[9]->store( + tables->view_creation_ctx->get_connection_cl()->name, + strlen(tables->view_creation_ctx->get_connection_cl()->name), + cs); + if (schema_table_store_record(thd, table)) DBUG_RETURN(1); if (res) @@ -3777,7 +3817,10 @@ static bool store_trigger(THD *thd, TABLE *table, const char *db, enum trg_action_time_type timing, LEX_STRING *trigger_stmt, ulong sql_mode, - LEX_STRING *definer_buffer) + LEX_STRING *definer_buffer, + LEX_STRING *client_cs_name, + LEX_STRING *connection_cl_name, + LEX_STRING *db_cl_name) { CHARSET_INFO *cs= system_charset_info; LEX_STRING sql_mode_rep; @@ -3799,7 +3842,12 @@ static bool store_trigger(THD *thd, TABLE *table, const char *db, sys_var_thd_sql_mode::symbolic_mode_representation(thd, sql_mode, &sql_mode_rep); table->field[17]->store(sql_mode_rep.str, sql_mode_rep.length, cs); - table->field[18]->store((const char *)definer_buffer->str, definer_buffer->length, cs); + table->field[18]->store(definer_buffer->str, definer_buffer->length, cs); + table->field[19]->store(client_cs_name->str, client_cs_name->length, cs); + table->field[20]->store(connection_cl_name->str, + connection_cl_name->length, cs); + table->field[21]->store(db_cl_name->str, db_cl_name->length, cs); + return schema_table_store_record(thd, table); } @@ -3835,19 +3883,29 @@ static int get_schema_triggers_record(THD *thd, struct st_table_list *tables, ulong sql_mode; char definer_holder[USER_HOST_BUFF_SIZE]; LEX_STRING definer_buffer; + LEX_STRING client_cs_name; + LEX_STRING connection_cl_name; + LEX_STRING db_cl_name; + definer_buffer.str= definer_holder; if (triggers->get_trigger_info(thd, (enum trg_event_type) event, (enum trg_action_time_type)timing, &trigger_name, &trigger_stmt, &sql_mode, - &definer_buffer)) + &definer_buffer, + &client_cs_name, + &connection_cl_name, + &db_cl_name)) continue; if (store_trigger(thd, table, base_name, file_name, &trigger_name, (enum trg_event_type) event, (enum trg_action_time_type) timing, &trigger_stmt, sql_mode, - &definer_buffer)) + &definer_buffer, + &client_cs_name, + &connection_cl_name, + &db_cl_name)) DBUG_RETURN(1); } } @@ -4325,7 +4383,7 @@ copy_event_to_schema_table(THD *thd, TABLE *sch_table, TABLE *event_table) const char *wild= thd->lex->wild ? thd->lex->wild->ptr() : NullS; CHARSET_INFO *scs= system_charset_info; MYSQL_TIME time; - Event_timed et; + Event_timed et; DBUG_ENTER("copy_event_to_schema_table"); restore_record(sch_table, s->default_values); @@ -4362,8 +4420,8 @@ copy_event_to_schema_table(THD *thd, TABLE *sch_table, TABLE *event_table) store(tz_name->ptr(), tz_name->length(), scs); sch_table->field[ISE_EVENT_BODY]-> store(STRING_WITH_LEN("SQL"), scs); - sch_table->field[ISE_EVENT_DEFINITION]-> - store(et.body.str, et.body.length, scs); + sch_table->field[ISE_EVENT_DEFINITION]->store( + et.body_utf8.str, et.body_utf8.length, scs); /* SQL_MODE */ { @@ -4466,6 +4524,24 @@ copy_event_to_schema_table(THD *thd, TABLE *sch_table, TABLE *event_table) sch_table->field[ISE_EVENT_COMMENT]-> store(et.comment.str, et.comment.length, scs); + sch_table->field[ISE_CLIENT_CS]->set_notnull(); + sch_table->field[ISE_CLIENT_CS]->store( + et.creation_ctx->get_client_cs()->csname, + strlen(et.creation_ctx->get_client_cs()->csname), + scs); + + sch_table->field[ISE_CONNECTION_CL]->set_notnull(); + sch_table->field[ISE_CONNECTION_CL]->store( + et.creation_ctx->get_connection_cl()->name, + strlen(et.creation_ctx->get_connection_cl()->name), + scs); + + sch_table->field[ISE_DB_CL]->set_notnull(); + sch_table->field[ISE_DB_CL]->store( + et.creation_ctx->get_db_cl()->name, + strlen(et.creation_ctx->get_db_cl()->name), + scs); + if (schema_table_store_record(thd, sch_table)) DBUG_RETURN(1); @@ -4992,7 +5068,7 @@ int make_character_sets_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table) int make_proc_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table) { - int fields_arr[]= {2, 3, 4, 19, 16, 15, 14, 18, -1}; + int fields_arr[]= {2, 3, 4, 19, 16, 15, 14, 18, 20, 21, 22, -1}; int *field_num= fields_arr; ST_FIELD_INFO *field_info; Name_resolution_context *context= &thd->lex->select_lex.context; @@ -5375,14 +5451,20 @@ ST_FIELD_INFO events_fields_info[]= {"SQL_MODE", 65535, MYSQL_TYPE_STRING, 0, 0, 0}, {"STARTS", 0, MYSQL_TYPE_DATETIME, 0, 1, "Starts"}, {"ENDS", 0, MYSQL_TYPE_DATETIME, 0, 1, "Ends"}, - {"STATUS", 18, MYSQL_TYPE_STRING, 0, 0, "Status"}, + {"STATUS", 18, MYSQL_TYPE_STRING, 0, 0, "Status"}, {"ON_COMPLETION", 12, MYSQL_TYPE_STRING, 0, 0, 0}, {"CREATED", 0, MYSQL_TYPE_DATETIME, 0, 0, 0}, {"LAST_ALTERED", 0, MYSQL_TYPE_DATETIME, 0, 0, 0}, {"LAST_EXECUTED", 0, MYSQL_TYPE_DATETIME, 0, 1, 0}, {"EVENT_COMMENT", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0}, - {"ORIGINATOR", 10, MYSQL_TYPE_LONGLONG, 0, 0, "Originator"}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0} + {"ORIGINATOR", 10, MYSQL_TYPE_LONGLONG, 0, 0, "Originator"}, + {"CHARACTER_SET_CLIENT", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, + "character_set_client"}, + {"COLLATION_CONNECTION", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, + "collation_connection"}, + {"DATABASE_COLLATION", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, + "Database Collation"}, + {0, 0, MYSQL_TYPE_STRING, 0, 0, 0} }; @@ -5417,6 +5499,12 @@ ST_FIELD_INFO proc_fields_info[]= {"SQL_MODE", 65535, MYSQL_TYPE_STRING, 0, 0, 0}, {"ROUTINE_COMMENT", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, "Comment"}, {"DEFINER", 77, MYSQL_TYPE_STRING, 0, 0, "Definer"}, + {"CHARACTER_SET_CLIENT", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, + "character_set_client"}, + {"COLLATION_CONNECTION", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, + "collation_connection"}, + {"DATABASE_COLLATION", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, + "Database Collation"}, {0, 0, MYSQL_TYPE_STRING, 0, 0, 0} }; @@ -5453,6 +5541,8 @@ ST_FIELD_INFO view_fields_info[]= {"IS_UPDATABLE", 3, MYSQL_TYPE_STRING, 0, 0, 0}, {"DEFINER", 77, MYSQL_TYPE_STRING, 0, 0, 0}, {"SECURITY_TYPE", 7, MYSQL_TYPE_STRING, 0, 0, 0}, + {"CHARACTER_SET_CLIENT", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, 0}, + {"COLLATION_CONNECTION", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, 0}, {0, 0, MYSQL_TYPE_STRING, 0, 0, 0} }; @@ -5574,6 +5664,12 @@ ST_FIELD_INFO triggers_fields_info[]= {"CREATED", 0, MYSQL_TYPE_DATETIME, 0, 1, "Created"}, {"SQL_MODE", 65535, MYSQL_TYPE_STRING, 0, 0, "sql_mode"}, {"DEFINER", 65535, MYSQL_TYPE_STRING, 0, 0, "Definer"}, + {"CHARACTER_SET_CLIENT", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, + "character_set_client"}, + {"COLLATION_CONNECTION", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, + "collation_connection"}, + {"DATABASE_COLLATION", MY_CS_NAME_SIZE, MYSQL_TYPE_STRING, 0, 0, + "Database Collation"}, {0, 0, MYSQL_TYPE_STRING, 0, 0, 0} }; @@ -5861,3 +5957,294 @@ int finalize_schema_table(st_plugin_int *plugin) } DBUG_RETURN(0); } + + +/** + Output trigger information (SHOW CREATE TRIGGER) to the client. + + @param thd Thread context. + @param triggers List of triggers for the table. + @param trigger_idx Index of the trigger to dump. + + @return Operation status + @retval TRUE Error. + @retval FALSE Success. +*/ + +static bool show_create_trigger_impl(THD *thd, + Table_triggers_list *triggers, + int trigger_idx) +{ + int ret_code; + + Protocol *p= thd->protocol; + List<Item> fields; + + LEX_STRING trg_name; + ulonglong trg_sql_mode; + LEX_STRING trg_sql_mode_str; + LEX_STRING trg_sql_original_stmt; + LEX_STRING trg_client_cs_name; + LEX_STRING trg_connection_cl_name; + LEX_STRING trg_db_cl_name; + + /* + TODO: Check privileges here. This functionality will be added by + implementation of the following WL items: + - WL#2227: New privileges for new objects + - WL#3482: Protect SHOW CREATE PROCEDURE | FUNCTION | VIEW | TRIGGER + properly + + SHOW TRIGGERS and I_S.TRIGGERS will be affected too. + */ + + /* Prepare trigger "object". */ + + triggers->get_trigger_info(thd, + trigger_idx, + &trg_name, + &trg_sql_mode, + &trg_sql_original_stmt, + &trg_client_cs_name, + &trg_connection_cl_name, + &trg_db_cl_name); + + sys_var_thd_sql_mode::symbolic_mode_representation(thd, + trg_sql_mode, + &trg_sql_mode_str); + + /* Send header. */ + + fields.push_back(new Item_empty_string("Trigger", NAME_LEN)); + fields.push_back(new Item_empty_string("sql_mode", trg_sql_mode_str.length)); + + { + /* + NOTE: SQL statement field must be not less than 1024 in order not to + confuse old clients. + */ + + Item_empty_string *stmt_fld= + new Item_empty_string("SQL Original Statement", + max(trg_sql_original_stmt.length, 1024)); + + stmt_fld->maybe_null= TRUE; + + fields.push_back(stmt_fld); + } + + fields.push_back(new Item_empty_string("character_set_client", + MY_CS_NAME_SIZE)); + + fields.push_back(new Item_empty_string("collation_connection", + MY_CS_NAME_SIZE)); + + fields.push_back(new Item_empty_string("Database Collation", + MY_CS_NAME_SIZE)); + + if (p->send_fields(&fields, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) + return TRUE; + + /* Send data. */ + + p->prepare_for_resend(); + + p->store(trg_name.str, + trg_name.length, + system_charset_info); + + p->store(trg_sql_mode_str.str, + trg_sql_mode_str.length, + system_charset_info); + + p->store(trg_sql_original_stmt.str, + trg_sql_original_stmt.length, + &my_charset_bin); + + p->store(trg_client_cs_name.str, + trg_client_cs_name.length, + system_charset_info); + + p->store(trg_connection_cl_name.str, + trg_connection_cl_name.length, + system_charset_info); + + p->store(trg_db_cl_name.str, + trg_db_cl_name.length, + system_charset_info); + + ret_code= p->write(); + + if (!ret_code) + send_eof(thd); + + return ret_code != 0; +} + + +/** + Read TRN and TRG files to obtain base table name for the specified + trigger name and construct TABE_LIST object for the base table. + + @param thd Thread context. + @param trg_name Trigger name. + + @return TABLE_LIST object corresponding to the base table. + + TODO: This function is a copy&paste from add_table_to_list() and + sp_add_to_query_tables(). The problem is that in order to be compatible + with Stored Programs (Prepared Statements), we should not touch thd->lex. + The "source" functions also add created TABLE_LIST object to the + thd->lex->query_tables. + + The plan to eliminate this copy&paste is to: + + - get rid of sp_add_to_query_tables() and use Lex::add_table_to_list(). + Only add_table_to_list() must be used to add tables from the parser + into Lex::query_tables list. + + - do not update Lex::query_tables in add_table_to_list(). +*/ + +static TABLE_LIST *get_trigger_table_impl( + THD *thd, + const sp_name *trg_name) +{ + char trn_path_buff[FN_REFLEN]; + + LEX_STRING trn_path= { trn_path_buff, 0 }; + LEX_STRING tbl_name; + + build_trn_path(thd, trg_name, &trn_path); + + if (check_trn_exists(&trn_path)) + { + my_error(ER_TRG_DOES_NOT_EXIST, MYF(0)); + return NULL; + } + + if (load_table_name_for_trigger(thd, trg_name, &trn_path, &tbl_name)) + return NULL; + + /* We need to reset statement table list to be PS/SP friendly. */ + + TABLE_LIST *table; + + if (!(table= (TABLE_LIST *)thd->calloc(sizeof(TABLE_LIST)))) + { + my_error(ER_OUTOFMEMORY, MYF(0), sizeof(TABLE_LIST)); + return NULL; + } + + table->db_length= trg_name->m_db.length; + table->db= thd->strmake(trg_name->m_db.str, trg_name->m_db.length); + + table->table_name_length= tbl_name.length; + table->table_name= thd->strmake(tbl_name.str, tbl_name.length); + + table->alias= thd->strmake(tbl_name.str, tbl_name.length); + + table->lock_type= TL_IGNORE; + table->cacheable_table= 0; + + return table; +} + +/** + Read TRN and TRG files to obtain base table name for the specified + trigger name and construct TABE_LIST object for the base table. Acquire + LOCK_open when doing this. + + @param thd Thread context. + @param trg_name Trigger name. + + @return TABLE_LIST object corresponding to the base table. +*/ + +static TABLE_LIST *get_trigger_table(THD *thd, const sp_name *trg_name) +{ + /* Acquire LOCK_open (stop the server). */ + + pthread_mutex_lock(&LOCK_open); + + /* + Load base table name from the TRN-file and create TABLE_LIST object. + */ + + TABLE_LIST *lst= get_trigger_table_impl(thd, trg_name); + + /* Release LOCK_open (continue the server). */ + + pthread_mutex_unlock(&LOCK_open); + + /* That's it. */ + + return lst; +} + + +/** + SHOW CREATE TRIGGER high-level implementation. + + @param thd Thread context. + @param trg_name Trigger name. + + @return Operation status + @retval TRUE Error. + @retval FALSE Success. +*/ + +bool show_create_trigger(THD *thd, const sp_name *trg_name) +{ + TABLE_LIST *lst= get_trigger_table(thd, trg_name); + + /* + Open the table by name in order to load Table_triggers_list object. + + NOTE: there is race condition here -- the table can be dropped after + LOCK_open is released. It will be fixed later by introducing + acquire-shared-table-name-lock functionality. + */ + + uint num_tables; /* NOTE: unused, only to pass to open_tables(). */ + + if (open_tables(thd, &lst, &num_tables, 0)) + { + my_error(ER_TRG_CANT_OPEN_TABLE, MYF(0), + (const char *) trg_name->m_db.str, + (const char *) lst->table_name); + + return TRUE; + + /* Perform closing actions and return error status. */ + } + + DBUG_ASSERT(num_tables == 1); + + Table_triggers_list *triggers= lst->table->triggers; + + if (!triggers) + { + my_error(ER_TRG_DOES_NOT_EXIST, MYF(0)); + return TRUE; + } + + int trigger_idx= triggers->find_trigger_by_name(&trg_name->m_name); + + if (trigger_idx < 0) + { + my_error(ER_TRG_CORRUPTED_FILE, MYF(0), + (const char *) trg_name->m_db.str, + (const char *) lst->table_name); + + return TRUE; + } + + return show_create_trigger_impl(thd, triggers, trigger_idx); + + /* + NOTE: if show_create_trigger_impl() failed, that means we could not + send data to the client. In this case we simply raise the error + status and client connection will be closed. + */ +} diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index 7c28dff850a..06dd0dded43 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -20,6 +20,149 @@ #include "sql_trigger.h" #include "parse_file.h" +/*************************************************************************/ + +template <class T> +inline T *alloc_type(MEM_ROOT *m) +{ + return (T *) alloc_root(m, sizeof (T)); +} + +/* + NOTE: Since alloc_type() is declared as inline, alloc_root() calls should + be inlined by the compiler. So, implementation of alloc_root() is not + needed. However, let's put the implementation in object file just in case + of stupid MS or other old compilers. +*/ + +template LEX_STRING *alloc_type<LEX_STRING>(MEM_ROOT *m); +template ulonglong *alloc_type<ulonglong>(MEM_ROOT *m); + +inline LEX_STRING *alloc_lex_string(MEM_ROOT *m) +{ + return alloc_type<LEX_STRING>(m); +} + +/*************************************************************************/ +/** + Trigger_creation_ctx -- creation context of triggers. +*/ + +class Trigger_creation_ctx : public Stored_program_creation_ctx, + public Sql_alloc +{ +public: + static Trigger_creation_ctx *create(THD *thd, + const char *db_name, + const char *table_name, + const LEX_STRING *client_cs_name, + const LEX_STRING *connection_cl_name, + const LEX_STRING *db_cl_name); + +public: + virtual Stored_program_creation_ctx *clone(MEM_ROOT *mem_root) + { + return new (mem_root) Trigger_creation_ctx(m_client_cs, + m_connection_cl, + m_db_cl); + } + +protected: + virtual Object_creation_ctx *create_backup_ctx(THD *thd) const + { + return new Trigger_creation_ctx(thd); + } + +private: + Trigger_creation_ctx(THD *thd) + :Stored_program_creation_ctx(thd) + { } + + Trigger_creation_ctx(CHARSET_INFO *client_cs, + CHARSET_INFO *connection_cl, + CHARSET_INFO *db_cl) + :Stored_program_creation_ctx(client_cs, connection_cl, db_cl) + { } +}; + +/************************************************************************** + Trigger_creation_ctx implementation. +**************************************************************************/ + +Trigger_creation_ctx * +Trigger_creation_ctx::create(THD *thd, + const char *db_name, + const char *table_name, + const LEX_STRING *client_cs_name, + const LEX_STRING *connection_cl_name, + const LEX_STRING *db_cl_name) +{ + CHARSET_INFO *client_cs; + CHARSET_INFO *connection_cl; + CHARSET_INFO *db_cl; + + bool invalid_creation_ctx= FALSE; + + if (resolve_charset(client_cs_name->str, + thd->variables.character_set_client, + &client_cs)) + { + sql_print_warning("Trigger for table '%s'.'%s': " + "invalid character_set_client value (%s).", + (const char *) db_name, + (const char *) table_name, + (const char *) client_cs_name->str); + + invalid_creation_ctx= TRUE; + } + + if (resolve_collation(connection_cl_name->str, + thd->variables.collation_connection, + &connection_cl)) + { + sql_print_warning("Trigger for table '%s'.'%s': " + "invalid collation_connection value (%s).", + (const char *) db_name, + (const char *) table_name, + (const char *) connection_cl_name->str); + + invalid_creation_ctx= TRUE; + } + + if (resolve_collation(db_cl_name->str, NULL, &db_cl)) + { + sql_print_warning("Trigger for table '%s'.'%s': " + "invalid database_collation value (%s).", + (const char *) db_name, + (const char *) table_name, + (const char *) db_cl_name->str); + + invalid_creation_ctx= TRUE; + } + + if (invalid_creation_ctx) + { + push_warning_printf(thd, + MYSQL_ERROR::WARN_LEVEL_WARN, + ER_TRG_INVALID_CREATION_CTX, + ER(ER_TRG_INVALID_CREATION_CTX), + (const char *) db_name, + (const char *) table_name); + } + + /* + If we failed to resolve the database collation, load the default one + from the disk. + */ + + if (!db_cl) + db_cl= get_default_db_collation(thd, db_name); + + return new Trigger_creation_ctx(client_cs, connection_cl, db_cl); +} + +/*************************************************************************/ + static const LEX_STRING triggers_file_type= { C_STRING_WITH_LEN("TRIGGERS") }; @@ -48,6 +191,21 @@ static File_option triggers_file_parameters[]= my_offsetof(class Table_triggers_list, definers_list), FILE_OPTIONS_STRLIST }, + { + { C_STRING_WITH_LEN("client_cs_names") }, + my_offsetof(class Table_triggers_list, client_cs_names), + FILE_OPTIONS_STRLIST + }, + { + { C_STRING_WITH_LEN("connection_cl_names") }, + my_offsetof(class Table_triggers_list, connection_cl_names), + FILE_OPTIONS_STRLIST + }, + { + { C_STRING_WITH_LEN("db_cl_names") }, + my_offsetof(class Table_triggers_list, db_cl_names), + FILE_OPTIONS_STRLIST + }, { { 0, 0 }, 0, FILE_OPTIONS_STRING } }; @@ -64,7 +222,7 @@ File_option sql_modes_parameters= .trg file. */ -static const int TRG_NUM_REQUIRED_PARAMETERS= 4; +static const int TRG_NUM_REQUIRED_PARAMETERS= 6; /* Structure representing contents of .TRN file which are used to support @@ -118,6 +276,7 @@ public: MEM_ROOT *mem_root, char *end); }; + class Handle_old_incorrect_trigger_table_hook: public Unknown_key_hook { public: @@ -359,6 +518,9 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables, LEX_STRING *trg_definer; Item_trigger_field *trg_field; struct st_trigname trigname; + LEX_STRING *trg_client_cs_name; + LEX_STRING *trg_connection_cl_name; + LEX_STRING *trg_db_cl_name; /* Trigger must be in the same schema as target table. */ @@ -489,16 +651,26 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables, QQ: Hmm... probably we should not care about setting up active thread mem_root too. */ - if (!(trg_def= (LEX_STRING *)alloc_root(&table->mem_root, - sizeof(LEX_STRING))) || + if (!(trg_def= alloc_lex_string(&table->mem_root)) || definitions_list.push_back(trg_def, &table->mem_root) || - !(trg_sql_mode= (ulonglong*)alloc_root(&table->mem_root, - sizeof(ulonglong))) || + + !(trg_sql_mode= alloc_type<ulonglong>(&table->mem_root)) || definition_modes_list.push_back(trg_sql_mode, &table->mem_root) || - !(trg_definer= (LEX_STRING*) alloc_root(&table->mem_root, - sizeof(LEX_STRING))) || - definers_list.push_back(trg_definer, &table->mem_root)) + + !(trg_definer= alloc_lex_string(&table->mem_root)) || + definers_list.push_back(trg_definer, &table->mem_root) || + + !(trg_client_cs_name= alloc_lex_string(&table->mem_root)) || + client_cs_names.push_back(trg_client_cs_name, &table->mem_root) || + + !(trg_connection_cl_name= alloc_lex_string(&table->mem_root)) || + connection_cl_names.push_back(trg_connection_cl_name, &table->mem_root) || + + !(trg_db_cl_name= alloc_lex_string(&table->mem_root)) || + db_cl_names.push_back(trg_db_cl_name, &table->mem_root)) + { goto err_with_cleanup; + } *trg_sql_mode= thd->variables.sql_mode; @@ -541,6 +713,21 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables, } /* + Fill character set information: + - client character set contains charset info only; + - connection collation contains pair {character set, collation}; + - database collation contains pair {character set, collation}; + */ + + lex_string_set(trg_client_cs_name, thd->charset()->csname); + + lex_string_set(trg_connection_cl_name, + thd->variables.collation_connection->name); + + lex_string_set(trg_db_cl_name, + get_default_db_collation(thd, tables->db)->name); + + /* Create well-formed trigger definition query. Original query is not appropriated, because definer-clause can be not truncated. */ @@ -674,14 +861,20 @@ static bool save_trigger_file(Table_triggers_list *triggers, const char *db, bool Table_triggers_list::drop_trigger(THD *thd, TABLE_LIST *tables, String *stmt_query) { - LEX *lex= thd->lex; + const char *sp_name= thd->lex->spname->m_name.str; // alias + LEX_STRING *name; - List_iterator_fast<LEX_STRING> it_name(names_list); - List_iterator<LEX_STRING> it_def(definitions_list); - List_iterator<ulonglong> it_mod(definition_modes_list); - List_iterator<LEX_STRING> it_definer(definers_list); char path[FN_REFLEN]; + List_iterator_fast<LEX_STRING> it_name(names_list); + + List_iterator<ulonglong> it_mod(definition_modes_list); + List_iterator<LEX_STRING> it_def(definitions_list); + List_iterator<LEX_STRING> it_definer(definers_list); + List_iterator<LEX_STRING> it_client_cs_name(client_cs_names); + List_iterator<LEX_STRING> it_connection_cl_name(connection_cl_names); + List_iterator<LEX_STRING> it_db_cl_name(db_cl_names); + stmt_query->append(thd->query, thd->query_length); while ((name= it_name++)) @@ -689,9 +882,11 @@ bool Table_triggers_list::drop_trigger(THD *thd, TABLE_LIST *tables, it_def++; it_mod++; it_definer++; + it_client_cs_name++; + it_connection_cl_name++; + it_db_cl_name++; - if (my_strcasecmp(table_alias_charset, lex->spname->m_name.str, - name->str) == 0) + if (my_strcasecmp(table_alias_charset, sp_name, name->str) == 0) { /* Again we don't care much about other things required for @@ -700,6 +895,9 @@ bool Table_triggers_list::drop_trigger(THD *thd, TABLE_LIST *tables, it_def.remove(); it_mod.remove(); it_definer.remove(); + it_client_cs_name.remove(); + it_connection_cl_name.remove(); + it_db_cl_name.remove(); if (definitions_list.is_empty()) { @@ -718,7 +916,7 @@ bool Table_triggers_list::drop_trigger(THD *thd, TABLE_LIST *tables, return 1; } - if (rm_trigname_file(path, tables->db, lex->spname->m_name.str)) + if (rm_trigname_file(path, tables->db, sp_name)) return 1; return 0; } @@ -857,9 +1055,13 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, we should initialize the list for safety: - sql_modes; - definers; + - character sets (client, connection, database); */ triggers->definition_modes_list.empty(); triggers->definers_list.empty(); + triggers->client_cs_names.empty(); + triggers->connection_cl_names.empty(); + triggers->db_cl_names.empty(); if (parser->parse((uchar*)triggers, &table->mem_root, triggers_file_parameters, @@ -880,8 +1082,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, We use one mode (current) for all triggers, because we have not information about mode in old format. */ - if (!(trg_sql_mode= (ulonglong*)alloc_root(&table->mem_root, - sizeof(ulonglong)))) + if (!(trg_sql_mode= alloc_type<ulonglong>(&table->mem_root))) { DBUG_RETURN(1); // EOM } @@ -910,8 +1111,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, LEX_STRING *trg_definer; - if (! (trg_definer= (LEX_STRING*)alloc_root(&table->mem_root, - sizeof(LEX_STRING)))) + if (!(trg_definer= alloc_lex_string(&table->mem_root))) DBUG_RETURN(1); // EOM trg_definer->str= (char*) ""; @@ -929,10 +1129,85 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, it.rewind(); } + if (!triggers->definitions_list.is_empty() && + (triggers->client_cs_names.is_empty() || + triggers->connection_cl_names.is_empty() || + triggers->db_cl_names.is_empty())) + { + /* + It is old file format => we should fill lists of character sets. + */ + + LEX_STRING *trg_client_cs_name; + LEX_STRING *trg_connection_cl_name; + LEX_STRING *trg_db_cl_name; + + if (!triggers->client_cs_names.is_empty() || + !triggers->connection_cl_names.is_empty() || + !triggers->db_cl_names.is_empty()) + { + my_error(ER_TRG_CORRUPTED_FILE, MYF(0), + (const char *) db, + (const char *) table_name); + + DBUG_RETURN(1); // EOM + } + + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_TRG_NO_CREATION_CTX, + ER(ER_TRG_NO_CREATION_CTX), + (const char*) db, + (const char*) table_name); + + if (!(trg_client_cs_name= alloc_lex_string(&table->mem_root)) || + !(trg_connection_cl_name= alloc_lex_string(&table->mem_root)) || + !(trg_db_cl_name= alloc_lex_string(&table->mem_root))) + { + DBUG_RETURN(1); // EOM + } + + /* + Backward compatibility: assume that the query is in the current + character set. + */ + + lex_string_set(trg_client_cs_name, + thd->variables.character_set_client->csname); + + lex_string_set(trg_connection_cl_name, + thd->variables.collation_connection->name); + + lex_string_set(trg_db_cl_name, + thd->variables.collation_database->name); + + while (it++) + { + if (triggers->client_cs_names.push_back(trg_client_cs_name, + &table->mem_root) || + + triggers->connection_cl_names.push_back(trg_connection_cl_name, + &table->mem_root) || + + triggers->db_cl_names.push_back(trg_db_cl_name, + &table->mem_root)) + { + DBUG_RETURN(1); // EOM + } + } + + it.rewind(); + } + DBUG_ASSERT(triggers->definition_modes_list.elements == triggers->definitions_list.elements); DBUG_ASSERT(triggers->definers_list.elements == triggers->definitions_list.elements); + DBUG_ASSERT(triggers->client_cs_names.elements == + triggers->definitions_list.elements); + DBUG_ASSERT(triggers->connection_cl_names.elements == + triggers->definitions_list.elements); + DBUG_ASSERT(triggers->db_cl_names.elements == + triggers->definitions_list.elements); table->triggers= triggers; @@ -956,6 +1231,9 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, List_iterator_fast<ulonglong> itm(triggers->definition_modes_list); List_iterator_fast<LEX_STRING> it_definer(triggers->definers_list); + List_iterator_fast<LEX_STRING> it_client_cs_name(triggers->client_cs_names); + List_iterator_fast<LEX_STRING> it_connection_cl_name(triggers->connection_cl_names); + List_iterator_fast<LEX_STRING> it_db_cl_name(triggers->db_cl_names); LEX *old_lex= thd->lex, lex; sp_rcontext *save_spcont= thd->spcont; ulong save_sql_mode= thd->variables.sql_mode; @@ -974,10 +1252,19 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, thd->variables.sql_mode= (ulong)*trg_sql_mode; Lex_input_stream lip(thd, trg_create_str->str, trg_create_str->length); + + Trigger_creation_ctx *creation_ctx= + Trigger_creation_ctx::create(thd, + db, + table_name, + it_client_cs_name++, + it_connection_cl_name++, + it_db_cl_name++); + lex_start(thd); - thd->spcont= 0; + thd->spcont= NULL; - if (parse_sql(thd, &lip)) + if (parse_sql(thd, &lip, creation_ctx)) { /* Currently sphead is always deleted in case of a parse error */ DBUG_ASSERT(lex.sphead == 0); @@ -986,8 +1273,11 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, lex.sphead->set_info(0, 0, &lex.sp_chistics, (ulong) *trg_sql_mode); - triggers->bodies[lex.trg_chistics.event] - [lex.trg_chistics.action_time]= lex.sphead; + int event= lex.trg_chistics.event; + int action_time= lex.trg_chistics.action_time; + + lex.sphead->set_creation_ctx(creation_ctx); + triggers->bodies[event][action_time]= lex.sphead; if (!trg_definer->length) { @@ -1023,8 +1313,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, &table->mem_root)) goto err_with_lex_cleanup; - if (!(on_table_name= (LEX_STRING*) alloc_root(&table->mem_root, - sizeof(LEX_STRING)))) + if (!(on_table_name= alloc_lex_string(&table->mem_root))) goto err_with_lex_cleanup; on_table_name->str= (char*) lex.raw_trg_on_table_name_begin; @@ -1070,7 +1359,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db, trg_field; trg_field= trg_field->next_trg_field) { - trg_field->setup_field(thd, table, + trg_field->setup_field(thd, table, &triggers->subject_table_grants[lex.trg_chistics.event] [lex.trg_chistics.action_time]); } @@ -1132,14 +1421,20 @@ bool Table_triggers_list::get_trigger_info(THD *thd, trg_event_type event, LEX_STRING *trigger_name, LEX_STRING *trigger_stmt, ulong *sql_mode, - LEX_STRING *definer) + LEX_STRING *definer, + LEX_STRING *client_cs_name, + LEX_STRING *connection_cl_name, + LEX_STRING *db_cl_name) { sp_head *body; DBUG_ENTER("get_trigger_info"); if ((body= bodies[event][time_type])) { + Stored_program_creation_ctx *creation_ctx= + bodies[event][time_type]->get_creation_ctx(); + *trigger_name= body->m_name; - *trigger_stmt= body->m_body; + *trigger_stmt= body->m_body_utf8; *sql_mode= body->m_sql_mode; if (body->m_chistics->suid == SP_IS_NOT_SUID) @@ -1153,12 +1448,74 @@ bool Table_triggers_list::get_trigger_info(THD *thd, trg_event_type event, body->m_definer_host.str, NullS) - definer->str; } + lex_string_set(client_cs_name, + creation_ctx->get_client_cs()->csname); + + lex_string_set(connection_cl_name, + creation_ctx->get_connection_cl()->name); + + lex_string_set(db_cl_name, + creation_ctx->get_db_cl()->name); + DBUG_RETURN(0); } DBUG_RETURN(1); } +void Table_triggers_list::get_trigger_info(THD *thd, + int trigger_idx, + LEX_STRING *trigger_name, + ulonglong *sql_mode, + LEX_STRING *sql_original_stmt, + LEX_STRING *client_cs_name, + LEX_STRING *connection_cl_name, + LEX_STRING *db_cl_name) +{ + List_iterator_fast<LEX_STRING> it_trigger_name(names_list); + List_iterator_fast<ulonglong> it_sql_mode(definition_modes_list); + List_iterator_fast<LEX_STRING> it_sql_orig_stmt(definitions_list); + List_iterator_fast<LEX_STRING> it_client_cs_name(client_cs_names); + List_iterator_fast<LEX_STRING> it_connection_cl_name(connection_cl_names); + List_iterator_fast<LEX_STRING> it_db_cl_name(db_cl_names); + + for (int i = 0; i < trigger_idx; ++i) + { + it_trigger_name.next_fast(); + it_sql_mode.next_fast(); + it_sql_orig_stmt.next_fast(); + + it_client_cs_name.next_fast(); + it_connection_cl_name.next_fast(); + it_db_cl_name.next_fast(); + } + + *trigger_name= *(it_trigger_name++); + *sql_mode= *(it_sql_mode++); + *sql_original_stmt= *(it_sql_orig_stmt++); + + *client_cs_name= *(it_client_cs_name++); + *connection_cl_name= *(it_connection_cl_name++); + *db_cl_name= *(it_db_cl_name++); +} + + +int Table_triggers_list::find_trigger_by_name(const LEX_STRING *trg_name) +{ + List_iterator_fast<LEX_STRING> it(names_list); + + for (int i = 0; ; ++i) + { + LEX_STRING *cur_name= it++; + + if (!cur_name) + return -1; + + if (strcmp(cur_name->str, trg_name->str) == 0) + return i; + } +} + /** Find trigger's table from trigger identifier and add it to the statement table list. @@ -1177,7 +1534,7 @@ bool Table_triggers_list::get_trigger_info(THD *thd, trg_event_type event, */ bool add_table_for_trigger(THD *thd, - sp_name *trg_name, + const sp_name *trg_name, bool if_exists, TABLE_LIST **table) { diff --git a/sql/sql_trigger.h b/sql/sql_trigger.h index c305efb5029..bfdbae12bdc 100644 --- a/sql/sql_trigger.h +++ b/sql/sql_trigger.h @@ -83,6 +83,14 @@ public: List<LEX_STRING> definers_list; + /* Character set context, used for parsing and executing triggers. */ + + List<LEX_STRING> client_cs_names; + List<LEX_STRING> connection_cl_names; + List<LEX_STRING> db_cl_names; + + /* End of character ser context. */ + Table_triggers_list(TABLE *table_arg): record1_field(0), trigger_table(table_arg) { @@ -97,11 +105,26 @@ public: bool process_triggers(THD *thd, trg_event_type event, trg_action_time_type time_type, bool old_row_is_record1); + bool get_trigger_info(THD *thd, trg_event_type event, trg_action_time_type time_type, LEX_STRING *trigger_name, LEX_STRING *trigger_stmt, ulong *sql_mode, - LEX_STRING *definer); + LEX_STRING *definer, + LEX_STRING *client_cs_name, + LEX_STRING *connection_cl_name, + LEX_STRING *db_cl_name); + + void get_trigger_info(THD *thd, + int trigger_idx, + LEX_STRING *trigger_name, + ulonglong *sql_mode, + LEX_STRING *sql_original_stmt, + LEX_STRING *client_cs_name, + LEX_STRING *connection_cl_name, + LEX_STRING *db_cl_name); + + int find_trigger_by_name(const LEX_STRING *trigger_name); static bool check_n_load(THD *thd, const char *db, const char *table_name, TABLE *table, bool names_only); @@ -144,7 +167,7 @@ extern const LEX_STRING trg_action_time_type_names[]; extern const LEX_STRING trg_event_type_names[]; bool add_table_for_trigger(THD *thd, - sp_name *trg_name, + const sp_name *trg_name, bool continue_if_not_exist, TABLE_LIST **table); diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 693ba779e5d..ef1f46bfdd2 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -548,9 +548,12 @@ int mysql_update(THD *thd, error= table->file->ha_update_row(table->record[1], table->record[0]); } - if (!error) + if (!error || error == HA_ERR_RECORD_IS_THE_SAME) { - updated++; + if (error != HA_ERR_RECORD_IS_THE_SAME) + updated++; + else + error= 0; thd->no_trans_update.stmt= !transactional_table; if (table->triggers && @@ -1524,7 +1527,8 @@ bool multi_update::send_data(List<Item> ¬_used_values) main_table->file->extra(HA_EXTRA_PREPARE_FOR_UPDATE); } if ((error=table->file->ha_update_row(table->record[1], - table->record[0]))) + table->record[0])) && + error != HA_ERR_RECORD_IS_THE_SAME) { updated--; if (!ignore || @@ -1542,6 +1546,11 @@ bool multi_update::send_data(List<Item> ¬_used_values) } else { + if (error == HA_ERR_RECORD_IS_THE_SAME) + { + error= 0; + updated--; + } /* non-transactional or transactional table got modified */ /* either multi_update class' flag is raised in its branch */ if (table->file->has_transactions()) @@ -1768,13 +1777,17 @@ int multi_update::do_updates(bool from_send_error) goto err; } if ((local_error=table->file->ha_update_row(table->record[1], - table->record[0]))) + table->record[0])) && + local_error != HA_ERR_RECORD_IS_THE_SAME) { if (!ignore || table->file->is_fatal_error(local_error, HA_CHECK_DUP_KEY)) goto err; } - updated++; + if (local_error != HA_ERR_RECORD_IS_THE_SAME) + updated++; + else + local_error= 0; if (table->triggers && table->triggers->process_triggers(thd, TRG_EVENT_UPDATE, diff --git a/sql/sql_view.cc b/sql/sql_view.cc index ef87d226549..ce311f5d4a2 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -205,18 +205,17 @@ fill_defined_view_parts (THD *thd, TABLE_LIST *view) } -/* - Creating/altering VIEW procedure +/** + @brief Creating/altering VIEW procedure - SYNOPSIS - mysql_create_view() - thd - thread handler - views - views to create - mode - VIEW_CREATE_NEW, VIEW_ALTER, VIEW_CREATE_OR_REPLACE + @param thd thread handler + @param views views to create + @param mode VIEW_CREATE_NEW, VIEW_ALTER, VIEW_CREATE_OR_REPLACE - RETURN VALUE - FALSE OK - TRUE Error + @note This function handles both create and alter view commands. + + @retval FALSE Operation was a success. + @retval TRUE An error occured. */ bool mysql_create_view(THD *thd, TABLE_LIST *views, @@ -611,8 +610,8 @@ err: /* index of revision number in following table */ static const int revision_number_position= 8; -/* index of last required parameter for making view */ -static const int required_view_parameters= 10; +/* number of required parameters for making view */ +static const int required_view_parameters= 16; /* number of backups */ static const int num_view_backups= 3; @@ -624,7 +623,7 @@ static const int num_view_backups= 3; */ static File_option view_parameters[]= {{{ C_STRING_WITH_LEN("query")}, - my_offsetof(TABLE_LIST, query), + my_offsetof(TABLE_LIST, select_stmt), FILE_OPTIONS_ESTRING}, {{ C_STRING_WITH_LEN("md5")}, my_offsetof(TABLE_LIST, md5), @@ -659,6 +658,15 @@ static File_option view_parameters[]= {{ C_STRING_WITH_LEN("source")}, my_offsetof(TABLE_LIST, source), FILE_OPTIONS_ESTRING}, + {{(char*) STRING_WITH_LEN("client_cs_name")}, + my_offsetof(TABLE_LIST, view_client_cs_name), + FILE_OPTIONS_STRING}, + {{(char*) STRING_WITH_LEN("connection_cl_name")}, + my_offsetof(TABLE_LIST, view_connection_cl_name), + FILE_OPTIONS_STRING}, + {{(char*) STRING_WITH_LEN("view_body_utf8")}, + my_offsetof(TABLE_LIST, view_body_utf8), + FILE_OPTIONS_STRING}, {{NullS, 0}, 0, FILE_OPTIONS_STRING} }; @@ -686,7 +694,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view, { LEX *lex= thd->lex; char buff[4096]; - String str(buff,(uint32) sizeof(buff), system_charset_info); + String view_query(buff, sizeof (buff), thd->charset()); char md5[MD5_BUFF_LENGTH]; bool can_be_merged; char dir_buff[FN_REFLEN], path_buff[FN_REFLEN]; @@ -695,18 +703,18 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view, DBUG_ENTER("mysql_register_view"); /* print query */ - str.length(0); + view_query.length(0); { ulong sql_mode= thd->variables.sql_mode & MODE_ANSI_QUOTES; thd->variables.sql_mode&= ~MODE_ANSI_QUOTES; - lex->unit.print(&str); + lex->unit.print(&view_query); thd->variables.sql_mode|= sql_mode; } - DBUG_PRINT("info", ("View: %s", str.ptr())); + DBUG_PRINT("info", ("View: %s", view_query.ptr())); /* fill structure */ - view->query.str= str.c_ptr_safe(); - view->query.length= str.length(); + view->select_stmt.str= view_query.c_ptr_safe(); + view->select_stmt.length= view_query.length(); view->source.str= (char*) thd->lex->create_view_select_start; view->source.length= (thd->lex->create_view_select_end @@ -827,6 +835,23 @@ loop_out: } } + /* Initialize view creation context from the environment. */ + + view->view_creation_ctx= View_creation_ctx::create(thd); + + /* + Set LEX_STRING attributes in view-structure for parser to create + frm-file. + */ + + lex_string_set(&view->view_client_cs_name, + view->view_creation_ctx->get_client_cs()->csname); + + lex_string_set(&view->view_connection_cl_name, + view->view_creation_ctx->get_connection_cl()->name); + + view->view_body_utf8= lex->view_body_utf8; + /* Check that table of main select do not used in subqueries. @@ -863,8 +888,8 @@ loop_out: } DBUG_RETURN(0); err: - view->query.str= NULL; - view->query.length= 0; + view->select_stmt.str= NULL; + view->select_stmt.length= 0; view->md5.str= NULL; view->md5.length= 0; DBUG_RETURN(error); @@ -893,9 +918,10 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table, LEX *old_lex, *lex; Query_arena *arena, backup; TABLE_LIST *top_view= table->top_table(); - bool res; + bool parse_status; bool result, view_is_mergeable; TABLE_LIST *view_main_select_tables; + DBUG_ENTER("mysql_make_view"); DBUG_PRINT("info", ("table: 0x%lx (%s)", (ulong) table, table->table_name)); @@ -996,6 +1022,14 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table, /*TODO: md5 test here and warning if it is differ */ /* + Initialize view definition context by character set names loaded from + the view definition file. Use UTF8 character set if view definition + file is of old version and does not contain the character set names. + */ + + table->view_creation_ctx= View_creation_ctx::create(thd, table); + + /* TODO: TABLE mem root should be used here when VIEW will be stored in TABLE cache @@ -1004,12 +1038,15 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table, table->view= lex= thd->lex= (LEX*) new(thd->mem_root) st_lex_local; { - Lex_input_stream lip(thd, table->query.str, table->query.length); + Lex_input_stream lip(thd, + table->select_stmt.str, + table->select_stmt.length); + lex_start(thd); view_select= &lex->select_lex; view_select->select_number= ++thd->select_number; - ulong save_mode= thd->variables.sql_mode; + ulong saved_mode= thd->variables.sql_mode; /* switch off modes which can prevent normal parsing of VIEW - MODE_REAL_AS_FLOAT affect only CREATE TABLE parsing + MODE_PIPES_AS_CONCAT affect expression parsing @@ -1036,18 +1073,20 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table, */ thd->variables.sql_mode&= ~(MODE_PIPES_AS_CONCAT | MODE_ANSI_QUOTES | MODE_IGNORE_SPACE | MODE_NO_BACKSLASH_ESCAPES); - CHARSET_INFO *save_cs= thd->variables.character_set_client; - thd->variables.character_set_client= system_charset_info; - res= parse_sql(thd, &lip); + + /* Parse the query. */ + + parse_status= parse_sql(thd, &lip, table->view_creation_ctx); + + /* Restore environment. */ if ((old_lex->sql_command == SQLCOM_SHOW_FIELDS) || (old_lex->sql_command == SQLCOM_SHOW_CREATE)) lex->sql_command= old_lex->sql_command; - thd->variables.character_set_client= save_cs; - thd->variables.sql_mode= save_mode; + thd->variables.sql_mode= saved_mode; } - if (!res) + if (!parse_status) { TABLE_LIST *view_tables= lex->query_tables; TABLE_LIST *view_tables_tail= 0; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index d521b8e8a12..8def8a43249 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1091,7 +1091,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %type <lex_str> IDENT IDENT_QUOTED TEXT_STRING DECIMAL_NUM FLOAT_NUM NUM LONG_NUM HEX_NUM LEX_HOSTNAME ULONGLONG_NUM field_ident select_alias ident ident_or_text - UNDERSCORE_CHARSET IDENT_sys TEXT_STRING_sys TEXT_STRING_literal + 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 @@ -1207,6 +1207,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); collation_name collation_name_or_default opt_load_data_charset + UNDERSCORE_CHARSET %type <variable> internal_variable_name @@ -1718,21 +1719,24 @@ event_tail: YYTHD->client_capabilities is set back to original value */ { - Lex->create_info.options= $2; + THD *thd= YYTHD; + LEX *lex=Lex; - if (!(Lex->event_parse_data= Event_parse_data::new_instance(YYTHD))) + lex->create_info.options= $2; + + if (!(lex->event_parse_data= Event_parse_data::new_instance(thd))) MYSQL_YYABORT; - Lex->event_parse_data->identifier= $3; + lex->event_parse_data->identifier= $3; /* We have to turn of CLIENT_MULTI_QUERIES while parsing a stored procedure, otherwise yylex will chop it into pieces at each ';'. */ - $<ulong_num>$= YYTHD->client_capabilities & CLIENT_MULTI_QUERIES; - YYTHD->client_capabilities &= (~CLIENT_MULTI_QUERIES); + $<ulong_num>$= thd->client_capabilities & CLIENT_MULTI_QUERIES; + thd->client_capabilities &= (~CLIENT_MULTI_QUERIES); - Lex->sql_command= SQLCOM_CREATE_EVENT; + lex->sql_command= SQLCOM_CREATE_EVENT; /* We need that for disallowing subqueries */ } ON SCHEDULE_SYM ev_schedule_time @@ -1865,16 +1869,16 @@ ev_sql_stmt: if (!(lex->sphead= new sp_head())) MYSQL_YYABORT; - lex->sphead->reset_thd_mem_root(YYTHD); + lex->sphead->reset_thd_mem_root(thd); lex->sphead->init(lex); - lex->sphead->init_sp_name(YYTHD, Lex->event_parse_data->identifier); + lex->sphead->init_sp_name(thd, lex->event_parse_data->identifier); lex->sphead->m_type= TYPE_ENUM_PROCEDURE; bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics)); lex->sphead->m_chistics= &lex->sp_chistics; - lex->sphead->set_body_begin_ptr(lip, lip->get_cpp_ptr()); + lex->sphead->set_body_start(thd, lip->get_cpp_ptr()); } ev_sql_stmt_inner { @@ -1882,7 +1886,7 @@ ev_sql_stmt: LEX *lex= thd->lex; /* return back to the original memory root ASAP */ - lex->sphead->init_strings(thd, lex); + lex->sphead->set_stmt_end(thd); lex->sphead->restore_thd_mem_root(thd); lex->sp_chistics.suid= SP_IS_SUID; //always the definer! @@ -1948,7 +1952,7 @@ sp_name: MYSQL_YYABORT; $$= new sp_name(db, $1, false); if ($$) - $$->init_qname(YYTHD); + $$->init_qname(thd); } ; @@ -2068,7 +2072,7 @@ create_function_tail: Lex_input_stream *lip= thd->m_lip; lex->sphead->m_chistics= &lex->sp_chistics; - lex->sphead->set_body_begin_ptr(lip, lip->get_cpp_tok_start()); + lex->sphead->set_body_start(thd, lip->get_cpp_tok_start()); } sp_proc_stmt { @@ -2080,7 +2084,7 @@ create_function_tail: MYSQL_YYABORT; lex->sql_command= SQLCOM_CREATE_SPFUNCTION; - sp->init_strings(thd, lex); + sp->set_stmt_end(thd); if (!(sp->m_flags & sp_head::HAS_RETURN)) { my_error(ER_SP_NORETURN, MYF(0), sp->m_qname.str); @@ -3606,14 +3610,20 @@ create2: create3 {} | LIKE table_ident { - Lex->create_info.options|= HA_LEX_CREATE_TABLE_LIKE; - if (!Lex->select_lex.add_table_to_list(YYTHD, $2, NULL, 0, TL_READ)) + THD *thd= YYTHD; + LEX *lex= thd->lex; + + lex->create_info.options|= HA_LEX_CREATE_TABLE_LIKE; + if (!lex->select_lex.add_table_to_list(thd, $2, NULL, 0, TL_READ)) MYSQL_YYABORT; } | '(' LIKE table_ident ')' { - Lex->create_info.options|= HA_LEX_CREATE_TABLE_LIKE; - if (!Lex->select_lex.add_table_to_list(YYTHD, $3, NULL, 0, TL_READ)) + THD *thd= YYTHD; + LEX *lex= thd->lex; + + lex->create_info.options|= HA_LEX_CREATE_TABLE_LIKE; + if (!lex->select_lex.add_table_to_list(thd, $3, NULL, 0, TL_READ)) MYSQL_YYABORT; } ; @@ -5178,7 +5188,14 @@ alter: } | ALTER view_algorithm definer { - Lex->create_view_mode= VIEW_ALTER; + LEX *lex= Lex; + + if (lex->sphead) + { + my_error(ER_SP_BADSTATEMENT, MYF(0), "ALTER VIEW"); + MYSQL_YYABORT; + } + lex->create_view_mode= VIEW_ALTER; } view_tail {} @@ -5190,6 +5207,12 @@ alter: */ { LEX *lex= Lex; + + if (lex->sphead) + { + my_error(ER_SP_BADSTATEMENT, MYF(0), "ALTER VIEW"); + MYSQL_YYABORT; + } lex->create_view_algorithm= VIEW_ALGORITHM_UNDEFINED; lex->create_view_mode= VIEW_ALTER; } @@ -7125,8 +7148,11 @@ opt_distinct: |DISTINCT { $$ = 1; }; opt_gconcat_separator: - /* empty */ { $$ = new (YYTHD->mem_root) String(",",1,default_charset_info); } - |SEPARATOR_SYM text_string { $$ = $2; }; + /* empty */ + { + $$= new (YYTHD->mem_root) String(",", 1, &my_charset_latin1); + } + | SEPARATOR_SYM text_string { $$ = $2; }; opt_gorder_clause: @@ -8665,7 +8691,7 @@ show_param: { Lex->create_info.db_type= NULL; } | opt_full COLUMNS from_or_in table_ident opt_db wild_and_where { - LEX *lex= Lex; + LEX *lex= Lex; lex->sql_command= SQLCOM_SHOW_FIELDS; if ($5) $4->change_db($5); @@ -8863,6 +8889,12 @@ show_param: lex->sql_command = SQLCOM_SHOW_CREATE_FUNC; lex->spname= $3; } + | CREATE TRIGGER_SYM sp_name + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_CREATE_TRIGGER; + lex->spname= $3; + } | PROCEDURE STATUS_SYM wild_and_where { LEX *lex= Lex; @@ -9303,7 +9335,9 @@ text_literal: | NCHAR_STRING { $$= new Item_string($1.str,$1.length,national_charset_info); } | UNDERSCORE_CHARSET TEXT_STRING - { $$ = new Item_string($2.str,$2.length,Lex->underscore_charset); } + { + $$ = new Item_string($2.str, $2.length, $1); + } | text_literal TEXT_STRING_literal { ((Item_string*) $1)->append($2.str,$2.length); } ; @@ -9390,7 +9424,7 @@ literal: (String*) 0; $$= new Item_string(str ? str->ptr() : "", str ? str->length() : 0, - Lex->underscore_charset); + $1); } | UNDERSCORE_CHARSET BIN_NUM { @@ -9665,6 +9699,7 @@ IDENT_sys: | IDENT_QUOTED { THD *thd= YYTHD; + if (thd->charset_is_system_charset) { CHARSET_INFO *cs= system_charset_info; @@ -9690,6 +9725,7 @@ TEXT_STRING_sys: TEXT_STRING { THD *thd= YYTHD; + if (thd->charset_is_system_charset) $$= $1; else @@ -9702,6 +9738,7 @@ TEXT_STRING_literal: TEXT_STRING { THD *thd= YYTHD; + if (thd->charset_is_collation_connection) $$= $1; else @@ -9715,6 +9752,7 @@ TEXT_STRING_filesystem: TEXT_STRING { THD *thd= YYTHD; + if (thd->charset_is_character_set_filesystem) $$= $1; else @@ -10406,7 +10444,8 @@ option_value: internal_variable_name: ident { - LEX *lex= Lex; + THD *thd= YYTHD; + LEX *lex= thd->lex; sp_pcontext *spc= lex->spcont; sp_variable_t *spv; @@ -10414,7 +10453,7 @@ internal_variable_name: if (!spc || !(spv = spc->find_variable(&$1))) { /* Not an SP local variable */ - sys_var *tmp=find_sys_var(YYTHD, $1.str, $1.length); + sys_var *tmp=find_sys_var(thd, $1.str, $1.length); if (!tmp) MYSQL_YYABORT; $$.var= tmp; @@ -11374,8 +11413,27 @@ view_tail: if (!lex->select_lex.add_table_to_list(thd, $3, NULL, TL_OPTION_UPDATING)) MYSQL_YYABORT; } - view_list_opt AS view_select - {} + view_list_opt AS + { + THD *thd= YYTHD; + Lex_input_stream *lip= thd->m_lip; + + lip->body_utf8_start(thd, lip->get_cpp_ptr()); + } + view_select + { + THD *thd= YYTHD; + LEX *lex= thd->lex; + Lex_input_stream *lip= thd->m_lip; + + lip->body_utf8_append(lip->get_cpp_ptr()); + + lex->view_body_utf8.str= thd->strmake(lip->get_body_utf8_str(), + lip->get_body_utf8_length()); + lex->view_body_utf8.length= lip->get_body_utf8_length(); + + trim_whitespace(&my_charset_utf8_general_ci, &lex->view_body_utf8); + } ; view_list_opt: @@ -11502,7 +11560,7 @@ trigger_tail: bzero((char *)&lex->sp_chistics, sizeof(st_sp_chistics)); lex->sphead->m_chistics= &lex->sp_chistics; - lex->sphead->set_body_begin_ptr(lip, lip->get_cpp_ptr()); + lex->sphead->set_body_start(thd, lip->get_cpp_ptr()); } sp_proc_stmt /* $16 */ { /* $17 */ @@ -11510,7 +11568,7 @@ trigger_tail: sp_head *sp= lex->sphead; lex->sql_command= SQLCOM_CREATE_TRIGGER; - sp->init_strings(YYTHD, lex); + sp->set_stmt_end(YYTHD); /* Restore flag if it was cleared above */ YYTHD->client_capabilities |= $<ulong_num>15; @@ -11605,14 +11663,14 @@ sp_tail: Lex_input_stream *lip= thd->m_lip; lex->sphead->m_chistics= &lex->sp_chistics; - lex->sphead->set_body_begin_ptr(lip, lip->get_cpp_tok_start()); + lex->sphead->set_body_start(thd, lip->get_cpp_tok_start()); } sp_proc_stmt { LEX *lex= Lex; sp_head *sp= lex->sphead; - sp->init_strings(YYTHD, lex); + sp->set_stmt_end(YYTHD); lex->sql_command= SQLCOM_CREATE_PROCEDURE; /* Restore flag if it was cleared above diff --git a/sql/table.cc b/sql/table.cc index 72a4d4974eb..35a60dd8527 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -32,6 +32,127 @@ static void fix_type_pointers(const char ***array, TYPELIB *point_to_type, static uint find_field(Field **fields, uchar *record, uint start, uint length); +/************************************************************************** + Object_creation_ctx implementation. +**************************************************************************/ + +Object_creation_ctx *Object_creation_ctx::set_n_backup(THD *thd) +{ + Object_creation_ctx *backup_ctx= create_backup_ctx(thd); + + change_env(thd); + + return backup_ctx; +} + +void Object_creation_ctx::restore_env(THD *thd, Object_creation_ctx *backup_ctx) +{ + if (!backup_ctx) + return; + + backup_ctx->change_env(thd); + + delete backup_ctx; +} + +/************************************************************************** + Default_object_creation_ctx implementation. +**************************************************************************/ + +Default_object_creation_ctx::Default_object_creation_ctx(THD *thd) + : m_client_cs(thd->variables.character_set_client), + m_connection_cl(thd->variables.collation_connection) +{ } + +Default_object_creation_ctx::Default_object_creation_ctx( + CHARSET_INFO *client_cs, CHARSET_INFO *connection_cl) + : m_client_cs(client_cs), + m_connection_cl(connection_cl) +{ } + +Object_creation_ctx * +Default_object_creation_ctx::create_backup_ctx(THD *thd) +{ + return new Default_object_creation_ctx(thd); +} + +void Default_object_creation_ctx::change_env(THD *thd) const +{ + thd->variables.character_set_client= m_client_cs; + thd->variables.collation_connection= m_connection_cl; + + thd->update_charset(); +} + +/************************************************************************** + View_creation_ctx implementation. +**************************************************************************/ + +View_creation_ctx *View_creation_ctx::create(THD *thd) +{ + View_creation_ctx *ctx= new (thd->mem_root) View_creation_ctx(thd); + + return ctx; +} + +/*************************************************************************/ + +View_creation_ctx * View_creation_ctx::create(THD *thd, + st_table_list *view) +{ + View_creation_ctx *ctx= new (thd->mem_root) View_creation_ctx(thd); + + /* Throw a warning if there is NULL cs name. */ + + if (!view->view_client_cs_name.str || + !view->view_connection_cl_name.str) + { + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, + ER_VIEW_NO_CREATION_CTX, + ER(ER_VIEW_NO_CREATION_CTX), + (const char *) view->db, + (const char *) view->table_name); + + ctx->m_client_cs= system_charset_info; + ctx->m_connection_cl= system_charset_info; + + return ctx; + } + + /* Resolve cs names. Throw a warning if there is unknown cs name. */ + + bool invalid_creation_ctx; + + invalid_creation_ctx= resolve_charset(view->view_client_cs_name.str, + system_charset_info, + &ctx->m_client_cs); + + invalid_creation_ctx= resolve_collation(view->view_connection_cl_name.str, + system_charset_info, + &ctx->m_connection_cl) || + invalid_creation_ctx; + + if (invalid_creation_ctx) + { + sql_print_warning("View '%s'.'%s': there is unknown charset/collation " + "names (client: '%s'; connection: '%s').", + (const char *) view->db, + (const char *) view->table_name, + (const char *) view->view_client_cs_name.str, + (const char *) view->view_connection_cl_name.str); + + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, + ER_VIEW_INVALID_CREATION_CTX, + ER(ER_VIEW_INVALID_CREATION_CTX), + (const char *) view->db, + (const char *) view->table_name); + } + + return ctx; +} + +/*************************************************************************/ + /* Get column name from column hash */ static uchar *get_field_name(Field **buff, size_t *length, @@ -42,7 +163,6 @@ static uchar *get_field_name(Field **buff, size_t *length, } - /* Returns pointer to '.frm' extension of the file name. @@ -2222,7 +2342,19 @@ File create_frm(THD *thd, const char *name, const char *db, ha_checktype(thd,ha_legacy_type(create_info->db_type),0,0)); fileinfo[4]=1; int2store(fileinfo+6,IO_SIZE); /* Next block starts here */ - key_length=keys*(7+NAME_LEN+MAX_REF_PARTS*9)+16; + /* + Keep in sync with pack_keys() in unireg.cc + For each key: + 8 bytes for the key header + 9 bytes for each key-part (MAX_REF_PARTS) + NAME_LEN bytes for the name + 1 byte for the NAMES_SEP_CHAR (before the name) + For all keys: + 6 bytes for the header + 1 byte for the NAMES_SEP_CHAR (after the last name) + 9 extra bytes (padding for safety? alignment?) + */ + key_length= keys * (8 + MAX_REF_PARTS * 9 + NAME_LEN + 1) + 16; length= next_io_size((ulong) (IO_SIZE+key_length+reclength+ create_info->extra_size)); int4store(fileinfo+10,length); @@ -2734,7 +2866,7 @@ void st_table_list::calc_md5(char *buffer) my_MD5_CTX context; uchar digest[16]; my_MD5Init(&context); - my_MD5Update(&context,(uchar *) query.str, query.length); + my_MD5Update(&context,(uchar *) select_stmt.str, select_stmt.length); my_MD5Final(digest, &context); sprintf((char *) buffer, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", diff --git a/sql/table.h b/sql/table.h index 1843c0038c7..47b2cbd3075 100644 --- a/sql/table.h +++ b/sql/table.h @@ -25,6 +25,29 @@ class partition_info; class COND_EQUAL; class Security_context; +/*************************************************************************/ + +/** + View_creation_ctx -- creation context of view objects. +*/ + +class View_creation_ctx : public Default_object_creation_ctx, + public Sql_alloc +{ +public: + static View_creation_ctx *create(THD *thd); + + static View_creation_ctx *create(THD *thd, + struct st_table_list *view); + +private: + View_creation_ctx(THD *thd) + : Default_object_creation_ctx(thd) + { } +}; + +/*************************************************************************/ + /* Order clause list element */ typedef struct st_order { @@ -864,7 +887,7 @@ typedef struct st_table_list st_table_list *next_leaf; Item *where; /* VIEW WHERE clause condition */ Item *check_option; /* WITH CHECK OPTION condition */ - LEX_STRING query; /* text of (CRETE/SELECT) statement */ + LEX_STRING select_stmt; /* text of (CREATE/SELECT) statement */ LEX_STRING md5; /* md5 of query text */ LEX_STRING source; /* source of CREATE VIEW */ LEX_STRING view_db; /* saved view database */ @@ -931,6 +954,32 @@ typedef struct st_table_list */ bool create; + + /* View creation context. */ + + View_creation_ctx *view_creation_ctx; + + /* + Attributes to save/load view creation context in/from frm-file. + + Ther are required only to be able to use existing parser to load + view-definition file. As soon as the parser parsed the file, view + creation context is initialized and the attributes become redundant. + + These attributes MUST NOT be used for any purposes but the parsing. + */ + + LEX_STRING view_client_cs_name; + LEX_STRING view_connection_cl_name; + + /* + View definition (SELECT-statement) in the UTF-form. + */ + + LEX_STRING view_body_utf8; + + /* End of view definition context. */ + enum enum_schema_table_state schema_table_state; void calc_md5(char *buffer); void set_underlying_merge(); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index e2c16ca193a..0f249b9e9bc 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -623,7 +623,7 @@ convert_error_code_to_mysql( } else if (error == (int) DB_TABLE_NOT_FOUND) { - return(HA_ERR_KEY_NOT_FOUND); + return(HA_ERR_NO_SUCH_TABLE); } else if (error == (int) DB_TOO_BIG_RECORD) { @@ -2276,35 +2276,11 @@ Get the table flags to use for the statement. */ handler::Table_flags ha_innobase::table_flags() const { - THD *const thd= current_thd; - /* We are using thd->variables.tx_isolation here instead of - trx->isolation_level since store_lock() has not been called - yet. - - The trx->isolation_level is set inside store_lock() (which - is called from mysql_lock_tables()) until after this - function has been called (which is called in lock_tables() - before that function calls mysql_lock_tables()). */ - ulong const tx_isolation= thd_tx_isolation(thd); + /* Need to use tx_isolation here since table flags is (also) + called before prebuilt is inited. */ + ulong const tx_isolation = thd_tx_isolation(current_thd); if (tx_isolation <= ISO_READ_COMMITTED) - { - ulong const binlog_format= thd->variables.binlog_format; - /* Statement based binlogging does not work in these - isolation levels since the necessary locks cannot - be taken */ - if (binlog_format == BINLOG_FORMAT_STMT) - { - char buf[256]; - my_snprintf(buf, sizeof(buf), - "Transaction level '%s' in InnoDB is" - " not safe for binlog mode '%s'", - tx_isolation_names[tx_isolation], - binlog_format_names[binlog_format]); - my_error(ER_BINLOG_LOGGING_IMPOSSIBLE, MYF(0), buf); - } return int_table_flags; - } - return int_table_flags | HA_BINLOG_STMT_CAPABLE; } @@ -6284,6 +6260,29 @@ ha_innobase::external_lock( update_thd(thd); + /* Statement based binlogging does not work in isolation level + READ UNCOMMITTED and READ COMMITTED since the necessary + locks cannot be taken. In this case, we print an + informative error message and return with an error. */ + if (lock_type == F_WRLCK) + { + ulong const binlog_format= thd->variables.binlog_format; + ulong const tx_isolation = thd_tx_isolation(current_thd); + if (tx_isolation <= ISO_READ_COMMITTED && + binlog_format == BINLOG_FORMAT_STMT) + { + char buf[256]; + my_snprintf(buf, sizeof(buf), + "Transaction level '%s' in" + " InnoDB is not safe for binlog mode '%s'", + tx_isolation_names[tx_isolation], + binlog_format_names[binlog_format]); + my_error(ER_BINLOG_LOGGING_IMPOSSIBLE, MYF(0), buf); + DBUG_RETURN(HA_ERR_LOGGING_IMPOSSIBLE); + } + } + + trx = prebuilt->trx; prebuilt->sql_stat_start = TRUE; diff --git a/storage/myisam/mi_key.c b/storage/myisam/mi_key.c index 87b149ee1ea..05f128a7a98 100644 --- a/storage/myisam/mi_key.c +++ b/storage/myisam/mi_key.c @@ -254,16 +254,16 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old, if (keyseg->flag & HA_SPACE_PACK) { uchar *end=pos+length; - if (type != HA_KEYTYPE_NUM) - { - while (end > pos && end[-1] == ' ') - end--; - } - else + if (type == HA_KEYTYPE_NUM) { while (pos < end && pos[0] == ' ') pos++; } + else if (type != HA_KEYTYPE_BINARY) + { + while (end > pos && end[-1] == ' ') + end--; + } length=(uint) (end-pos); FIX_LENGTH(cs, pos, length, char_length); store_key_length_inc(key,char_length); diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c index 66546abb52a..70b44c14716 100644 --- a/storage/myisam/mi_open.c +++ b/storage/myisam/mi_open.c @@ -237,7 +237,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) key_parts+=fulltext_keys*FT_SEGS; if (share->base.max_key_length > HA_MAX_KEY_BUFF || keys > MI_MAX_KEY || - key_parts >= MI_MAX_KEY * HA_MAX_KEY_SEG) + key_parts > MI_MAX_KEY * HA_MAX_KEY_SEG) { DBUG_PRINT("error",("Wrong key info: Max_key_length: %d keys: %d key_parts: %d", share->base.max_key_length, keys, key_parts)); my_errno=HA_ERR_UNSUPPORTED; diff --git a/storage/ndb/src/kernel/blocks/ERROR_codes.txt b/storage/ndb/src/kernel/blocks/ERROR_codes.txt index 17d6c9b0867..6f0cfbff7e9 100644 --- a/storage/ndb/src/kernel/blocks/ERROR_codes.txt +++ b/storage/ndb/src/kernel/blocks/ERROR_codes.txt @@ -4,8 +4,8 @@ Next NDBFS 2000 Next DBACC 3002 Next DBTUP 4029 Next DBLQH 5045 -Next DBDICT 6007 -Next DBDIH 7184 +Next DBDICT 6008 +Next DBDIH 7186 Next DBTC 8040 Next CMVMI 9000 Next BACKUP 10038 @@ -77,6 +77,10 @@ Delay GCP_SAVEREQ by 10 secs 7183: Crash when receiving COPY_GCIREQ +7184: Crash before starting next GCP after a node failure + +7185: Dont reply to COPY_GCI_REQ where reason == GCP + ERROR CODES FOR TESTING NODE FAILURE, LOCAL CHECKPOINT HANDLING: ----------------------------------------------------------------- @@ -503,6 +507,7 @@ Dbdict: 6003 Crash in participant @ CreateTabReq::Prepare 6004 Crash in participant @ CreateTabReq::Commit 6005 Crash in participant @ CreateTabReq::CreateDrop +6007 Fail on readTableFile for READ_TAB_FILE1 (28770) Dbtup: 4014 - handleInsert - Out of undo buffer diff --git a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp index edc8c0131db..569958a6aa9 100644 --- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp +++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp @@ -802,6 +802,15 @@ void Dbdict::execFSREADCONF(Signal* signal) readSchemaConf(signal ,fsPtr); break; case FsConnectRecord::READ_TAB_FILE1: + if(ERROR_INSERTED(6007)){ + jam(); + FsRef * const fsRef = (FsRef *)&signal->theData[0]; + fsRef->userPointer = fsConf->userPointer; + fsRef->setErrorCode(fsRef->errorCode, NDBD_EXIT_AFS_UNKNOWN); + fsRef->osErrorCode = ~0; // Indicate local error + execFSREADREF(signal); + return; + }//Testing how DICT behave if read of file 1 fails (Bug#28770) case FsConnectRecord::READ_TAB_FILE2: jam(); readTableConf(signal ,fsPtr); diff --git a/storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp b/storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp index b4dc445e94d..5bef13cd0b9 100644 --- a/storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp +++ b/storage/ndb/src/kernel/blocks/dbdih/Dbdih.hpp @@ -898,7 +898,7 @@ private: void ndbsttorry10Lab(Signal *, Uint32 _line); void createMutexes(Signal* signal, Uint32 no); void createMutex_done(Signal* signal, Uint32 no, Uint32 retVal); - void crashSystemAtGcpStop(Signal *); + void crashSystemAtGcpStop(Signal *, bool); void sendFirstDictfragsreq(Signal *, TabRecordPtr regTabPtr); void addtabrefuseLab(Signal *, ConnectRecordPtr regConnectPtr, Uint32 errorCode); void GCP_SAVEhandling(Signal *, Uint32 nodeId); diff --git a/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp b/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp index 4a103a76323..762d4ea5141 100644 --- a/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp +++ b/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp @@ -749,6 +749,12 @@ done: CRASH_INSERTION(7183); + if (ERROR_INSERTED(7185) && reason==CopyGCIReq::GLOBAL_CHECKPOINT) + { + jam(); + return; + } + /* ----------------------------------------------------------------------- */ /* WE START BY TRYING TO OPEN THE FIRST RESTORABLE GCI FILE. */ /* ----------------------------------------------------------------------- */ @@ -4152,6 +4158,11 @@ void Dbdih::execNODE_FAILREP(Signal* signal) CLEAR_ERROR_INSERT_VALUE; } + if (ERROR_INSERTED(7184)) + { + SET_ERROR_INSERT_VALUE(7000); + } + /*-------------------------------------------------------------------------*/ // The first step is to convert from a bit mask to an array of failed nodes. /*-------------------------------------------------------------------------*/ @@ -7826,7 +7837,7 @@ void Dbdih::checkGcpStopLab(Signal* signal) g_eventLogger.error("System crash due to GCP Stop in state = %u", (Uint32) cgcpStatus); #endif - crashSystemAtGcpStop(signal); + crashSystemAtGcpStop(signal, false); return; }//if } else { @@ -7840,7 +7851,7 @@ void Dbdih::checkGcpStopLab(Signal* signal) g_eventLogger.error("System crash due to GCP Stop in state = %u", (Uint32) cgcpStatus); #endif - crashSystemAtGcpStop(signal); + crashSystemAtGcpStop(signal, false); return; }//if } else { @@ -11196,41 +11207,132 @@ void Dbdih::tableCloseLab(Signal* signal, FileRecordPtr filePtr) * GCP stop detected, * send SYSTEM_ERROR to all other alive nodes */ -void Dbdih::crashSystemAtGcpStop(Signal* signal) +void Dbdih::crashSystemAtGcpStop(Signal* signal, bool local) { + if (local) + goto dolocal; + switch(cgcpStatus){ + case GCP_PREPARE_SENT: + { + jam(); + /** + * We're waiting for a GCP PREPARE CONF + */ + infoEvent("Detected GCP stop(%d)...sending kill to %s", + cgcpStatus, c_GCP_PREPARE_Counter.getText()); + ndbout_c("Detected GCP stop(%d)...sending kill to %s", + cgcpStatus, c_GCP_PREPARE_Counter.getText()); + + { + NodeReceiverGroup rg(DBDIH, c_GCP_PREPARE_Counter); + signal->theData[0] = 7022; + sendSignal(rg, GSN_DUMP_STATE_ORD, signal, 1, JBA); + } + + { + NodeReceiverGroup rg(NDBCNTR, c_GCP_PREPARE_Counter); + SystemError * const sysErr = (SystemError*)&signal->theData[0]; + sysErr->errorCode = SystemError::GCPStopDetected; + sysErr->errorRef = reference(); + sysErr->data1 = cgcpStatus; + sysErr->data2 = cgcpOrderBlocked; + sendSignal(rg, GSN_SYSTEM_ERROR, signal, + SystemError::SignalLength, JBA); + } + ndbrequire(!c_GCP_PREPARE_Counter.done()); + return; + } + case GCP_COMMIT_SENT: + { + jam(); + /** + * We're waiting for a GCP_NODEFINISH + */ + infoEvent("Detected GCP stop(%d)...sending kill to %s", + cgcpStatus, c_GCP_COMMIT_Counter.getText()); + ndbout_c("Detected GCP stop(%d)...sending kill to %s", + cgcpStatus, c_GCP_COMMIT_Counter.getText()); + + { + NodeReceiverGroup rg(DBDIH, c_GCP_COMMIT_Counter); + signal->theData[0] = 7022; + sendSignal(rg, GSN_DUMP_STATE_ORD, signal, 1, JBA); + } + + { + NodeReceiverGroup rg(NDBCNTR, c_GCP_COMMIT_Counter); + SystemError * const sysErr = (SystemError*)&signal->theData[0]; + sysErr->errorCode = SystemError::GCPStopDetected; + sysErr->errorRef = reference(); + sysErr->data1 = cgcpStatus; + sysErr->data2 = cgcpOrderBlocked; + sendSignal(rg, GSN_SYSTEM_ERROR, signal, + SystemError::SignalLength, JBA); + } + ndbrequire(!c_GCP_COMMIT_Counter.done()); + return; + } case GCP_NODE_FINISHED: { + jam(); /** * We're waiting for a GCP save conf */ - ndbrequire(!c_GCP_SAVEREQ_Counter.done()); NodeReceiverGroup rg(DBLQH, c_GCP_SAVEREQ_Counter); signal->theData[0] = 2305; sendSignal(rg, GSN_DUMP_STATE_ORD, signal, 1, JBB); - infoEvent("Detected GCP stop...sending kill to %s", - c_GCP_SAVEREQ_Counter.getText()); - g_eventLogger.error("Detected GCP stop...sending kill to %s", - c_GCP_SAVEREQ_Counter.getText()); + infoEvent("Detected GCP stop(%d)...sending kill to %s", + cgcpStatus, c_GCP_SAVEREQ_Counter.getText()); + ndbout_c("Detected GCP stop(%d)...sending kill to %s", + cgcpStatus, c_GCP_SAVEREQ_Counter.getText()); + ndbrequire(!c_GCP_SAVEREQ_Counter.done()); return; } case GCP_SAVE_LQH_FINISHED: - g_eventLogger.error("m_copyReason: %d m_waiting: %d", - c_copyGCIMaster.m_copyReason, - c_copyGCIMaster.m_waiting); - break; - case GCP_READY: // shut up lint - case GCP_PREPARE_SENT: - case GCP_COMMIT_SENT: - break; + { + jam(); + /** + * We're waiting for a COPY_GCICONF + */ + infoEvent("Detected GCP stop(%d)...sending kill to %s", + cgcpStatus, c_COPY_GCIREQ_Counter.getText()); + ndbout_c("Detected GCP stop(%d)...sending kill to %s", + cgcpStatus, c_COPY_GCIREQ_Counter.getText()); + + { + NodeReceiverGroup rg(DBDIH, c_COPY_GCIREQ_Counter); + signal->theData[0] = 7022; + sendSignal(rg, GSN_DUMP_STATE_ORD, signal, 1, JBA); + } + + { + NodeReceiverGroup rg(NDBCNTR, c_COPY_GCIREQ_Counter); + SystemError * const sysErr = (SystemError*)&signal->theData[0]; + sysErr->errorCode = SystemError::GCPStopDetected; + sysErr->errorRef = reference(); + sysErr->data1 = cgcpStatus; + sysErr->data2 = cgcpOrderBlocked; + sendSignal(rg, GSN_SYSTEM_ERROR, signal, + SystemError::SignalLength, JBA); + } + ndbrequire(!c_COPY_GCIREQ_Counter.done()); + return; + } + case GCP_READY: (void)1; } + +dolocal: + ndbout_c("m_copyReason: %d m_waiting: %d", + c_copyGCIMaster.m_copyReason, + c_copyGCIMaster.m_waiting); - g_eventLogger.error("c_copyGCISlave: sender{Data, Ref} %d %x reason: %d nextWord: %d", - c_copyGCISlave.m_senderData, - c_copyGCISlave.m_senderRef, - c_copyGCISlave.m_copyReason, - c_copyGCISlave.m_expectedNextWord); + ndbout_c("c_copyGCISlave: sender{Data, Ref} %d %x reason: %d nextWord: %d", + c_copyGCISlave.m_senderData, + c_copyGCISlave.m_senderRef, + c_copyGCISlave.m_copyReason, + c_copyGCISlave.m_expectedNextWord); FileRecordPtr file0Ptr; file0Ptr.i = crestartInfoFile[0]; @@ -11281,23 +11383,39 @@ void Dbdih::crashSystemAtGcpStop(Signal* signal) c_TCGETOPSIZEREQ_Counter.getText()); ndbout_c("c_UPDATE_TOREQ_Counter = %s", c_UPDATE_TOREQ_Counter.getText()); - NodeRecordPtr nodePtr; - for (nodePtr.i = 1; nodePtr.i < MAX_NDB_NODES; nodePtr.i++) { + if (local == false) + { jam(); - ptrAss(nodePtr, nodeRecord); - if (nodePtr.p->nodeStatus == NodeRecord::ALIVE) { + NodeRecordPtr nodePtr; + for (nodePtr.i = 1; nodePtr.i < MAX_NDB_NODES; nodePtr.i++) { jam(); - const BlockReference ref = - numberToRef(refToBlock(cntrlblockref), nodePtr.i); - SystemError * const sysErr = (SystemError*)&signal->theData[0]; - sysErr->errorCode = SystemError::GCPStopDetected; - sysErr->errorRef = reference(); - sysErr->data1 = cgcpStatus; - sysErr->data2 = cgcpOrderBlocked; - sendSignal(ref, GSN_SYSTEM_ERROR, signal, - SystemError::SignalLength, JBA); - }//if - }//for + ptrAss(nodePtr, nodeRecord); + if (nodePtr.p->nodeStatus == NodeRecord::ALIVE) { + jam(); + const BlockReference ref = + numberToRef(refToBlock(cntrlblockref), nodePtr.i); + SystemError * const sysErr = (SystemError*)&signal->theData[0]; + sysErr->errorCode = SystemError::GCPStopDetected; + sysErr->errorRef = reference(); + sysErr->data1 = cgcpStatus; + sysErr->data2 = cgcpOrderBlocked; + sendSignal(ref, GSN_SYSTEM_ERROR, signal, + SystemError::SignalLength, JBA); + }//if + }//for + } + else + { + jam(); + SystemError * const sysErr = (SystemError*)&signal->theData[0]; + sysErr->errorCode = SystemError::GCPStopDetected; + sysErr->errorRef = reference(); + sysErr->data1 = cgcpStatus; + sysErr->data2 = cgcpOrderBlocked; + EXECUTE_DIRECT(NDBCNTR, GSN_SYSTEM_ERROR, + signal, SystemError::SignalLength); + ndbrequire(false); + } return; }//Dbdih::crashSystemAtGcpStop() @@ -14392,6 +14510,12 @@ Dbdih::execDUMP_STATE_ORD(Signal* signal) infoEvent(buf); } } + + if (arg == 7022) + { + jam(); + crashSystemAtGcpStop(signal, true); + } }//Dbdih::execDUMP_STATE_ORD() void diff --git a/storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp b/storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp index 64d214d472b..6f8e5569831 100644 --- a/storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp +++ b/storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp @@ -1586,7 +1586,8 @@ public: ACTIVE_WRITE_LOG = 17, ///< A write operation during ///< writing of log READ_SR_INVALIDATE_PAGES = 18, - WRITE_SR_INVALIDATE_PAGES = 19 + WRITE_SR_INVALIDATE_PAGES = 19, + WRITE_SR_INVALIDATE_PAGES_UPDATE_PAGE0 = 20 }; /** * We have to remember the log pages read. @@ -2381,7 +2382,7 @@ private: void errorReport(Signal* signal, int place); void warningReport(Signal* signal, int place); void invalidateLogAfterLastGCI(Signal *signal); - void readFileInInvalidate(Signal *signal); + void readFileInInvalidate(Signal *signal, bool stepNext); void exitFromInvalidate(Signal* signal); Uint32 calcPageCheckSum(LogPageRecordPtr logP); Uint32 handleLongTupKey(Signal* signal, Uint32* dataPtr, Uint32 len); diff --git a/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp b/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp index 8f42a8039d8..e47fcf34471 100644 --- a/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp +++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp @@ -139,6 +139,10 @@ operator<<(NdbOut& out, Operation_t op) //#define MARKER_TRACE 1 //#define TRACE_SCAN_TAKEOVER 1 +#ifndef DEBUG_REDO +#define DEBUG_REDO 0 +#endif + const Uint32 NR_ScanNo = 0; #if defined VM_TRACE || defined ERROR_INSERT || defined NDBD_TRACENR @@ -11790,6 +11794,13 @@ void Dblqh::sendLCP_COMPLETE_REP(Signal* signal, Uint32 lcpId) jam(); sendEMPTY_LCP_CONF(signal, true); } + + if (getNodeState().getNodeRestartInProgress()) + { + jam(); + ndbrequire(cstartRecReq == 2); + cstartRecReq = 3; + } return; }//Dblqh::sendCOMP_LCP_ROUND() @@ -12060,15 +12071,27 @@ void Dblqh::execGCP_SAVEREQ(Signal* signal) }//if ndbrequire(ccurrentGcprec == RNIL); - ccurrentGcprec = 0; - gcpPtr.i = ccurrentGcprec; - ptrCheckGuard(gcpPtr, cgcprecFileSize, gcpRecord); - cnewestCompletedGci = gci; if (gci > cnewestGci) { jam(); cnewestGci = gci; }//if + + if(getNodeState().getNodeRestartInProgress() && cstartRecReq < 3) + { + GCPSaveRef * const saveRef = (GCPSaveRef*)&signal->theData[0]; + saveRef->dihPtr = dihPtr; + saveRef->nodeId = getOwnNodeId(); + saveRef->gci = gci; + saveRef->errorCode = GCPSaveRef::NodeRestartInProgress; + sendSignal(dihBlockRef, GSN_GCP_SAVEREF, signal, + GCPSaveRef::SignalLength, JBB); + return; + } + + ccurrentGcprec = 0; + gcpPtr.i = ccurrentGcprec; + ptrCheckGuard(gcpPtr, cgcprecFileSize, gcpRecord); gcpPtr.p->gcpBlockref = dihBlockRef; gcpPtr.p->gcpUserptr = dihPtr; @@ -12322,9 +12345,6 @@ void Dblqh::execFSCLOSECONF(Signal* signal) case LogFileRecord::CLOSE_SR_INVALIDATE_PAGES: jam(); logFilePtr.p->logFileStatus = LogFileRecord::CLOSED; - // Set the prev file to check if we shall close it. - logFilePtr.i = logFilePtr.p->prevLogFile; - ptrCheckGuard(logFilePtr, clogFileFileSize, logFileRecord); logPartPtr.i = logFilePtr.p->logPartRec; ptrCheckGuard(logPartPtr, clogPartFileSize, logPartRecord); @@ -12374,7 +12394,7 @@ void Dblqh::execFSOPENCONF(Signal* signal) case LogFileRecord::OPEN_SR_INVALIDATE_PAGES: jam(); logFilePtr.p->logFileStatus = LogFileRecord::OPEN; - readFileInInvalidate(signal); + readFileInInvalidate(signal, false); return; case LogFileRecord::OPENING_INIT: jam(); @@ -12574,6 +12594,7 @@ void Dblqh::execFSWRITECONF(Signal* signal) case LogFileOperationRecord::WRITE_SR_INVALIDATE_PAGES: jam(); invalidateLogAfterLastGCI(signal); + CRASH_INSERTION(5047); return; case LogFileOperationRecord::WRITE_PAGE_ZERO: jam(); @@ -12611,6 +12632,14 @@ void Dblqh::execFSWRITECONF(Signal* signal) jam(); firstPageWriteLab(signal); return; + case LogFileOperationRecord::WRITE_SR_INVALIDATE_PAGES_UPDATE_PAGE0: + jam(); + // We are done...send completed signal and exit this phase. + releaseLfo(signal); + signal->theData[0] = ZSR_FOURTH_COMP; + signal->theData[1] = logPartPtr.i; + sendSignal(cownref, GSN_CONTINUEB, signal, 2, JBB); + return; default: jam(); systemErrorLab(signal, __LINE__); @@ -13689,6 +13718,12 @@ void Dblqh::writeSinglePage(Signal* signal, Uint32 pageNo, signal->theData[6] = logPagePtr.i; signal->theData[7] = pageNo; sendSignal(NDBFS_REF, GSN_FSWRITEREQ, signal, 8, JBA); + + if (DEBUG_REDO) + ndbout_c("writeSingle 1 page at part: %u file: %u pos: %u", + logPartPtr.i, + logFilePtr.p->fileNo, + pageNo); }//Dblqh::writeSinglePage() /* ########################################################################## @@ -13754,6 +13789,12 @@ void Dblqh::openSrLastFileLab(Signal* signal) void Dblqh::readSrLastFileLab(Signal* signal) { logPartPtr.p->logLap = logPagePtr.p->logPageWord[ZPOS_LOG_LAP]; + if (DEBUG_REDO) + ndbout_c("readSrLastFileLab part: %u logExecState: %u logPartState: %u logLap: %u", + logPartPtr.i, + logPartPtr.p->logExecState, + logPartPtr.p->logPartState, + logPartPtr.p->logLap); if (logPartPtr.p->noLogFiles > cmaxLogFilesInPageZero) { jam(); initGciInLogFileRec(signal, cmaxLogFilesInPageZero); @@ -14825,6 +14866,20 @@ void Dblqh::srLogLimits(Signal* signal) break; }//if }//while + + if (DEBUG_REDO) + { + LogFileRecordPtr tmp; + tmp.i = logPartPtr.p->stopLogfile; + ptrCheckGuard(tmp, clogFileFileSize, logFileRecord); + ndbout_c("srLogLimits part: %u start file: %u mb: %u stop file: %u mb: %u", + logPartPtr.i, + tlastPrepRef >> 16, + tlastPrepRef & 65535, + tmp.p->fileNo, + logPartPtr.p->stopMbyte); + } + /* ------------------------------------------------------------------------ * WE HAVE NOW FOUND BOTH THE START AND THE STOP OF THE LOG. NOW START * EXECUTING THE LOG. THE FIRST ACTION IS TO OPEN THE LOG FILE WHERE TO @@ -15251,6 +15306,12 @@ void Dblqh::execSr(Signal* signal) case ZCOMPLETED_GCI_TYPE: jam(); logWord = readLogword(signal); + if (DEBUG_REDO) + ndbout_c("found gci: %u part: %u file: %u page: %u", + logWord, + logPartPtr.i, + logFilePtr.p->fileNo, + logFilePtr.p->currentFilepage); if (logWord == logPartPtr.p->logLastGci) { jam(); /*---------------------------------------------------------------------------*/ @@ -15267,6 +15328,10 @@ void Dblqh::execSr(Signal* signal) logPartPtr.p->headPageNo = logFilePtr.p->currentFilepage; logPartPtr.p->headPageIndex = logPagePtr.p->logPageWord[ZCURR_PAGE_INDEX]; + logPartPtr.p->logLap = logPagePtr.p->logPageWord[ZPOS_LOG_LAP]; + if (DEBUG_REDO) + ndbout_c("execSr part: %u logLap: %u", + logPartPtr.i, logPartPtr.p->logLap); }//if /*---------------------------------------------------------------------------*/ /* THERE IS NO NEED OF EXECUTING PAST THIS LINE SINCE THERE WILL ONLY BE LOG */ @@ -15429,67 +15494,140 @@ void Dblqh::invalidateLogAfterLastGCI(Signal* signal) { } switch (lfoPtr.p->lfoState) { - case LogFileOperationRecord::WRITE_SR_INVALIDATE_PAGES: - jam(); - releaseLfo(signal); - releaseLogpage(signal); - if (logPartPtr.p->invalidatePageNo < (clogFileSize * ZPAGES_IN_MBYTE - 1)) { - // We continue in this file. - logPartPtr.p->invalidatePageNo++; - } else { - // We continue in the next file. - logFilePtr.i = logFilePtr.p->nextLogFile; - ptrCheckGuard(logFilePtr, clogFileFileSize, logFileRecord); - logPartPtr.p->invalidateFileNo = logFilePtr.p->fileNo; - // Page 0 is used for file descriptors. - logPartPtr.p->invalidatePageNo = 1; - if (logFilePtr.p->logFileStatus != LogFileRecord::OPEN) { - jam(); - logFilePtr.p->logFileStatus = LogFileRecord::OPEN_SR_INVALIDATE_PAGES; - openFileRw(signal, logFilePtr); - return; - break; - } - } - // Read a page from the log file. - readFileInInvalidate(signal); - return; - break; - case LogFileOperationRecord::READ_SR_INVALIDATE_PAGES: jam(); - releaseLfo(signal); // Check if this page must be invalidated. // If the log lap number on a page after the head of the tail is the same // as the actual log lap number we must invalidate this page. Otherwise it // could be impossible to find the end of the log in a later system/node // restart. - if (logPagePtr.p->logPageWord[ZPOS_LOG_LAP] == logPartPtr.p->logLap) { + if (logPagePtr.p->logPageWord[ZPOS_LOG_LAP] == logPartPtr.p->logLap) + { // This page must be invalidated. - logPagePtr.p->logPageWord[ZPOS_LOG_LAP] = 0; - // Contact NDBFS. Real time break. - writeSinglePage(signal, logPartPtr.p->invalidatePageNo, - ZPAGE_SIZE - 1, __LINE__); - lfoPtr.p->lfoState = LogFileOperationRecord::WRITE_SR_INVALIDATE_PAGES; - } else { - // We are done with invalidating. Finish start phase 3.4. + // We search for end + // read next + releaseLfo(signal); + releaseLogpage(signal); + readFileInInvalidate(signal, true); + lfoPtr.p->lfoState = LogFileOperationRecord::READ_SR_INVALIDATE_PAGES; + return; + } + + /** + * We found the "last" page to invalidate... + * Invalidate backwards until head... + */ + + // Fall through... + case LogFileOperationRecord::WRITE_SR_INVALIDATE_PAGES: + jam(); + + releaseLfo(signal); + releaseLogpage(signal); + + // Step backwards... + logPartPtr.p->invalidatePageNo--; + + if (logPartPtr.p->invalidatePageNo == 0) + { + jam(); + + if (logFilePtr.p->fileNo == 0) + { + /** + * We're wrapping in the log... + * update logLap + */ + logPartPtr.p->logLap--; + ndbrequire(logPartPtr.p->logLap); // Should always be > 0 + if (DEBUG_REDO) + ndbout_c("invalidateLogAfterLastGCI part: %u wrap from file 0 -> logLap: %u", + logPartPtr.i, logPartPtr.p->logLap); + } + + /** + * Move to prev file + */ + logFilePtr.i = logFilePtr.p->prevLogFile; + ptrCheckGuard(logFilePtr, clogFileFileSize, logFileRecord); + logPartPtr.p->invalidateFileNo = logFilePtr.p->fileNo; + logPartPtr.p->invalidatePageNo = clogFileSize * ZPAGES_IN_MBYTE - 1; + } + + if (logPartPtr.p->invalidateFileNo == logPartPtr.p->headFileNo && + logPartPtr.p->invalidatePageNo == logPartPtr.p->headPageNo) + { + /** + * Done... + */ + logFilePtr.i = logPartPtr.p->currentLogfile; + ptrCheckGuard(logFilePtr, clogFileFileSize, logFileRecord); + + logFilePtr.i = logFilePtr.p->nextLogFile; + ptrCheckGuard(logFilePtr, clogFileFileSize, logFileRecord); + + // Close files if necessary. Current file and the next file should be + // left open. exitFromInvalidate(signal); + return; } - return; - break; + seizeLogpage(signal); + + /** + * Make page really empty + */ + bzero(logPagePtr.p, sizeof(LogPageRecord)); + writeSinglePage(signal, logPartPtr.p->invalidatePageNo, + ZPAGE_SIZE - 1, __LINE__); + + lfoPtr.p->lfoState = LogFileOperationRecord::WRITE_SR_INVALIDATE_PAGES; + return; default: jam(); systemError(signal, __LINE__); return; break; } - - return; }//Dblqh::invalidateLogAfterLastGCI -void Dblqh::readFileInInvalidate(Signal* signal) { +void Dblqh::readFileInInvalidate(Signal* signal, bool stepNext) +{ jam(); + + if (stepNext) + { + logPartPtr.p->invalidatePageNo++; + if (logPartPtr.p->invalidatePageNo == (clogFileSize * ZPAGES_IN_MBYTE)) + { + // We continue in the next file. + logFilePtr.i = logFilePtr.p->nextLogFile; + ptrCheckGuard(logFilePtr, clogFileFileSize, logFileRecord); + logPartPtr.p->invalidateFileNo = logFilePtr.p->fileNo; + // Page 0 is used for file descriptors. + logPartPtr.p->invalidatePageNo = 1; + + if (logFilePtr.p->fileNo == 0) + { + /** + * We're wrapping in the log... + * update logLap + */ + logPartPtr.p->logLap++; + if (DEBUG_REDO) + ndbout_c("readFileInInvalidate part: %u wrap to file 0 -> logLap: %u", + logPartPtr.i, logPartPtr.p->logLap); + } + if (logFilePtr.p->logFileStatus != LogFileRecord::OPEN) + { + jam(); + logFilePtr.p->logFileStatus = LogFileRecord::OPEN_SR_INVALIDATE_PAGES; + openFileRw(signal, logFilePtr); + return; + } + } + } + // Contact NDBFS. Real time break. readSinglePage(signal, logPartPtr.p->invalidatePageNo); lfoPtr.p->lfoState = LogFileOperationRecord::READ_SR_INVALIDATE_PAGES; @@ -15497,34 +15635,57 @@ void Dblqh::readFileInInvalidate(Signal* signal) { void Dblqh::exitFromInvalidate(Signal* signal) { jam(); - // Close files if necessary. Current file and the next file should be - // left open. - if (logFilePtr.i != logPartPtr.p->currentLogfile) { - LogFileRecordPtr currentLogFilePtr; - LogFileRecordPtr nextAfterCurrentLogFilePtr; - - currentLogFilePtr.i = logPartPtr.p->currentLogfile; - ptrCheckGuard(currentLogFilePtr, clogFileFileSize, logFileRecord); - - nextAfterCurrentLogFilePtr.i = currentLogFilePtr.p->nextLogFile; - - if (logFilePtr.i != nextAfterCurrentLogFilePtr.i) { - // This file should be closed. - logFilePtr.p->logFileStatus = LogFileRecord::CLOSE_SR_INVALIDATE_PAGES; - closeFile(signal, logFilePtr, __LINE__); - // Return from this function and wait for close confirm. Then come back - // and test the previous file for closing. - return; - } - } - // We are done with closing files, send completed signal and exit this phase. - signal->theData[0] = ZSR_FOURTH_COMP; - signal->theData[1] = logPartPtr.i; - sendSignal(cownref, GSN_CONTINUEB, signal, 2, JBB); +loop: + logFilePtr.i = logFilePtr.p->nextLogFile; + ptrCheckGuard(logFilePtr, clogFileFileSize, logFileRecord); + + if (logFilePtr.i == logPartPtr.p->currentLogfile) + { + jam(); + goto done; + } + + if (logFilePtr.p->fileNo == 0) + { + jam(); + /** + * Logfile 0 shoult *not* be closed + */ + goto loop; + } + + if (logFilePtr.p->logFileStatus == LogFileRecord::CLOSED) + { + jam(); + goto done; + } + + jam(); + ndbrequire(logFilePtr.p->logFileStatus == LogFileRecord::OPEN); + logFilePtr.p->logFileStatus = LogFileRecord::CLOSE_SR_INVALIDATE_PAGES; + closeFile(signal, logFilePtr, __LINE__); return; -} +done: + if (DEBUG_REDO) + ndbout_c("exitFromInvalidate part: %u head file: %u page: %u", + logPartPtr.i, + logPartPtr.p->headFileNo, + logPartPtr.p->headPageNo); + + logFilePtr.i = logPartPtr.p->firstLogfile; + ptrCheckGuard(logFilePtr, clogFileFileSize, logFileRecord); + logPagePtr.i = logFilePtr.p->logPageZero; + ptrCheckGuard(logPagePtr, clogPageFileSize, logPageRecord); + logPagePtr.p->logPageWord[ZPAGE_HEADER_SIZE + ZPOS_FILE_NO] = + logPartPtr.p->headFileNo; + writeSinglePage(signal, 0, ZPAGE_SIZE - 1, __LINE__); + + lfoPtr.p->logFileRec = logFilePtr.i; + lfoPtr.p->lfoState = LogFileOperationRecord::WRITE_SR_INVALIDATE_PAGES_UPDATE_PAGE0; + return; +} /*---------------------------------------------------------------------------*/ /* THE EXECUTION OF A LOG RECORD IS COMPLETED. RELEASE PAGES IF THEY WERE */ @@ -15916,20 +16077,10 @@ void Dblqh::readSrFourthZeroLab(Signal* signal) ptrCheckGuard(logFilePtr, clogFileFileSize, logFileRecord); logPartPtr.p->invalidateFileNo = logPartPtr.p->headFileNo; logPartPtr.p->invalidatePageNo = logPartPtr.p->headPageNo; - logPartPtr.p->logExecState = LogPartRecord::LES_EXEC_LOG_INVALIDATE; - seizeLfo(signal); - initLfo(signal); - // The state here is a little confusing, but simulates that we return - // to invalidateLogAfterLastGCI() from an invalidate write and are ready - // to read a page from file. - lfoPtr.p->lfoState = LogFileOperationRecord::WRITE_SR_INVALIDATE_PAGES; - - /** - * Make sure we dont release zero page - */ - seizeLogpage(signal); - invalidateLogAfterLastGCI(signal); + + readFileInInvalidate(signal, true); + lfoPtr.p->lfoState = LogFileOperationRecord::READ_SR_INVALIDATE_PAGES; return; }//Dblqh::readSrFourthZeroLab() @@ -16442,6 +16593,14 @@ void Dblqh::completedLogPage(Signal* signal, Uint32 clpType, Uint32 place) signal->theData[4] = ZVAR_NO_LOG_PAGE_WORD; signal->theData[5] = twlpNoPages; sendSignal(NDBFS_REF, GSN_FSWRITEREQ, signal, 15, JBA); + + if (DEBUG_REDO) + ndbout_c("writing %d pages at part: %u file: %u pos: %u", + twlpNoPages, + logPartPtr.i, + logFilePtr.p->fileNo, + logFilePtr.p->filePosition); + if (twlpType == ZNORMAL) { jam(); lfoPtr.p->lfoState = LogFileOperationRecord::ACTIVE_WRITE_LOG; @@ -17601,6 +17760,14 @@ void Dblqh::readExecLog(Signal* signal) signal->theData[14] = lfoPtr.p->logPageArray[8]; signal->theData[15] = lfoPtr.p->logPageArray[9]; sendSignal(NDBFS_REF, GSN_FSREADREQ, signal, 16, JBA); + + if (DEBUG_REDO) + ndbout_c("readExecLog %u page at part: %u file: %u pos: %u", + lfoPtr.p->noPagesRw, + logPartPtr.i, + logFilePtr.p->fileNo, + logPartPtr.p->execSrStartPageNo); + }//Dblqh::readExecLog() /* ------------------------------------------------------------------------- */ @@ -17663,6 +17830,14 @@ void Dblqh::readExecSr(Signal* signal) signal->theData[13] = lfoPtr.p->logPageArray[7]; signal->theData[14] = tresPageid; sendSignal(NDBFS_REF, GSN_FSREADREQ, signal, 15, JBA); + + if (DEBUG_REDO) + ndbout_c("readExecSr %u page at part: %u file: %u pos: %u", + 8, + logPartPtr.i, + logFilePtr.p->fileNo, + tresPageid); + }//Dblqh::readExecSr() /* ------------------------------------------------------------------------- */ @@ -17818,6 +17993,13 @@ void Dblqh::readSinglePage(Signal* signal, Uint32 pageNo) signal->theData[6] = logPagePtr.i; signal->theData[7] = pageNo; sendSignal(NDBFS_REF, GSN_FSREADREQ, signal, 8, JBA); + + if (DEBUG_REDO) + ndbout_c("readSinglePage 1 page at part: %u file: %u pos: %u", + logPartPtr.i, + logFilePtr.p->fileNo, + pageNo); + }//Dblqh::readSinglePage() /* -------------------------------------------------------------------------- @@ -18301,8 +18483,17 @@ void Dblqh::writeCompletedGciLog(Signal* signal) jam(); changeMbyte(signal); }//if + logFilePtr.p->remainingWordsInMbyte = logFilePtr.p->remainingWordsInMbyte - ZCOMPLETED_GCI_LOG_SIZE; + + if (DEBUG_REDO) + ndbout_c("writeCompletedGciLog gci: %u part: %u file: %u page: %u", + cnewestCompletedGci, + logPartPtr.i, + logFilePtr.p->fileNo, + logFilePtr.p->currentFilepage); + writeLogWord(signal, ZCOMPLETED_GCI_TYPE); writeLogWord(signal, cnewestCompletedGci); logPartPtr.p->logPartNewestCompletedGCI = cnewestCompletedGci; @@ -18339,6 +18530,13 @@ void Dblqh::writeDirty(Signal* signal, Uint32 place) signal->theData[6] = logPagePtr.i; signal->theData[7] = logPartPtr.p->prevFilepage; sendSignal(NDBFS_REF, GSN_FSWRITEREQ, signal, 8, JBA); + + if (DEBUG_REDO) + ndbout_c("writeDirty 1 page at part: %u file: %u pos: %u", + logPartPtr.i, + logFilePtr.p->fileNo, + logPartPtr.p->prevFilepage); + }//Dblqh::writeDirty() /* -------------------------------------------------------------------------- diff --git a/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp b/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp index 024d7bdb00c..3e030de959e 100644 --- a/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp +++ b/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp @@ -10235,6 +10235,7 @@ void Dbtc::inithost(Signal* signal) hostptr.p->noOfWordsTCINDXCONF = 0; hostptr.p->noOfPackedWordsLqh = 0; hostptr.p->hostLqhBlockRef = calcLqhBlockRef(hostptr.i); + hostptr.p->m_nf_bits = 0; }//for c_alive_nodes.clear(); }//Dbtc::inithost() diff --git a/storage/ndb/src/kernel/blocks/pgman.cpp b/storage/ndb/src/kernel/blocks/pgman.cpp index 5e40480f84f..d8e0c053984 100644 --- a/storage/ndb/src/kernel/blocks/pgman.cpp +++ b/storage/ndb/src/kernel/blocks/pgman.cpp @@ -694,7 +694,14 @@ Pgman::lirs_reference(Ptr<Page_entry> ptr) if (state & Page_entry::ONSTACK) { jam(); + bool at_bottom = ! pl_stack.hasPrev(ptr); pl_stack.remove(ptr); + if (at_bottom) + { + jam(); + ndbassert(state & Page_entry::HOT); + lirs_stack_prune(); + } } pl_stack.add(ptr); state |= Page_entry::ONSTACK; @@ -1889,9 +1896,10 @@ Pgman::drop_page(Ptr<Page_entry> ptr) bool at_bottom = ! pl_stack.hasPrev(ptr); pl_stack.remove(ptr); state &= ~ Page_entry::ONSTACK; - if (at_bottom && (state & Page_entry::HOT)) + if (at_bottom) { jam(); + ndbassert(state & Page_entry::HOT); lirs_stack_prune(); } } @@ -1903,6 +1911,7 @@ Pgman::drop_page(Ptr<Page_entry> ptr) state &= ~ Page_entry::ONQUEUE; } + ndbassert(ptr.p->m_real_page_i != RNIL); if (ptr.p->m_real_page_i != RNIL) { jam(); diff --git a/storage/ndb/test/ndbapi/testNodeRestart.cpp b/storage/ndb/test/ndbapi/testNodeRestart.cpp index 97b831963fc..99b72699762 100644 --- a/storage/ndb/test/ndbapi/testNodeRestart.cpp +++ b/storage/ndb/test/ndbapi/testNodeRestart.cpp @@ -963,12 +963,62 @@ int runBug24717(NDBT_Context* ctx, NDBT_Step* step){ restarter.startNodes(&nodeId, 1); - for (Uint32 i = 0; i < 100; i++) - { - hugoTrans.pkReadRecords(pNdb, 100, 1, NdbOperation::LM_CommittedRead); - } - + do { + for (Uint32 i = 0; i < 100; i++) + { + hugoTrans.pkReadRecords(pNdb, 100, 1, NdbOperation::LM_CommittedRead); + } + } while (restarter.waitClusterStarted(5) != 0); + } + + return NDBT_OK; +} + +int +runBug29364(NDBT_Context* ctx, NDBT_Step* step){ + int result = NDBT_OK; + int loops = ctx->getNumLoops(); + int records = ctx->getNumRecords(); + NdbRestarter restarter; + Ndb* pNdb = GETNDB(step); + + HugoTransactions hugoTrans(*ctx->getTab()); + + if (restarter.getNumDbNodes() < 4) + return NDBT_OK; + + int dump0[] = { 9000, 0 } ; + int dump1[] = { 9001, 0 } ; + Uint32 ownNode = refToNode(pNdb->getReference()); + dump0[1] = ownNode; + + for (; loops; loops --) + { + int node0 = restarter.getDbNodeId(rand() % restarter.getNumDbNodes()); + int node1 = restarter.getRandomNodeOtherNodeGroup(node0, rand()); + + restarter.restartOneDbNode(node0, false, true, true); + restarter.waitNodesNoStart(&node0, 1); + restarter.startNodes(&node0, 1); restarter.waitClusterStarted(); + + restarter.restartOneDbNode(node1, false, true, true); + restarter.waitNodesNoStart(&node1, 1); + if (restarter.dumpStateOneNode(node1, dump0, 2)) + return NDBT_FAILED; + + restarter.startNodes(&node1, 1); + + do { + + for (Uint32 i = 0; i < 100; i++) + { + hugoTrans.pkReadRecords(pNdb, 100, 1, NdbOperation::LM_CommittedRead); + } + } while (restarter.waitClusterStarted(5) != 0); + + if (restarter.dumpStateOneNode(node1, dump1, 1)) + return NDBT_FAILED; } return NDBT_OK; @@ -2075,6 +2125,9 @@ TESTCASE("Bug28023", ""){ TESTCASE("Bug28717", ""){ INITIALIZER(runBug28717); } +TESTCASE("Bug29364", ""){ + INITIALIZER(runBug29364); +} NDBT_TESTSUITE_END(testNodeRestart); int main(int argc, const char** argv){ diff --git a/storage/ndb/test/ndbapi/testSystemRestart.cpp b/storage/ndb/test/ndbapi/testSystemRestart.cpp index 8fada42697d..901c0e35568 100644 --- a/storage/ndb/test/ndbapi/testSystemRestart.cpp +++ b/storage/ndb/test/ndbapi/testSystemRestart.cpp @@ -1261,6 +1261,39 @@ runBug29167(NDBT_Context* ctx, NDBT_Step* step) return result; } +int +runBug28770(NDBT_Context* ctx, NDBT_Step* step) { + Ndb* pNdb = GETNDB(step); + NdbRestarter restarter; + int result = NDBT_OK; + int count = 0; + Uint32 i = 0; + Uint32 loops = ctx->getNumLoops(); + int records = ctx->getNumRecords(); + UtilTransactions utilTrans(*ctx->getTab()); + HugoTransactions hugoTrans(*ctx->getTab()); + + g_info << "Loading records..." << endl; hugoTrans.loadTable(pNdb, + records); + + + while(i<=loops && result != NDBT_FAILED){ + g_info << "Loop " << i << "/"<< loops <<" started" << endl; + CHECK(restarter.restartAll(false, true, false) == 0); + NdbSleep_SecSleep(3); + CHECK(restarter.waitClusterNoStart() == 0); + restarter.insertErrorInAllNodes(6007); + CHECK(restarter.startAll()== 0); + CHECK(restarter.waitClusterStarted() == 0); + CHECK(utilTrans.selectCount(pNdb, 64, &count) == 0); + CHECK(count == records); + i++; + } + ndbout << " runBug28770 finished" << endl; + return result; +} + + NDBT_TESTSUITE(testSystemRestart); TESTCASE("SR1", "Basic system restart test. Focus on testing restart from REDO log.\n" @@ -1446,6 +1479,20 @@ TESTCASE("Bug29167", "") INITIALIZER(runWaitStarted); STEP(runBug29167); } +TESTCASE("Bug28770", + "Check readTableFile1 fails, readTableFile2 succeeds\n" + "1. Restart all node -nostart\n" + "2. Insert error 6100 into all nodes\n" + "3. Start all nodes\n" + "4. Ensure cluster start\n" + "5. Read and verify reocrds\n" + "6. Repeat until looping is completed\n"){ + INITIALIZER(runWaitStarted); + INITIALIZER(runClearTable); + STEP(runBug28770); + FINALIZER(runClearTable); +} + NDBT_TESTSUITE_END(testSystemRestart); diff --git a/storage/ndb/test/run-test/daily-basic-tests.txt b/storage/ndb/test/run-test/daily-basic-tests.txt index 2a52c2cbd59..ed4dbf67b20 100644 --- a/storage/ndb/test/run-test/daily-basic-tests.txt +++ b/storage/ndb/test/run-test/daily-basic-tests.txt @@ -489,6 +489,10 @@ max-time: 300 cmd: testSystemRestart args: -n Bug29167 T1 +max-time: 300 +cmd: testSystemRestart +args: -l 2 -n Bug28770 T1 + max-time: 1000 cmd: testNodeRestart args: -n Bug27283 T1 @@ -565,6 +569,10 @@ max-time: 1000 cmd: testNodeRestart args: -n Bug28023 T7 D2 +max-time: 1000 +cmd: testNodeRestart +args: -n Bug29364 T1 + # # DICT TESTS max-time: 1500 diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c index d1572834ad3..903811e2ab9 100644 --- a/strings/ctype-mb.c +++ b/strings/ctype-mb.c @@ -567,6 +567,8 @@ my_bool my_like_range_mb(CHARSET_INFO *cs, char *min_end= min_str + res_length; char *max_end= max_str + res_length; size_t maxcharlen= res_length / cs->mbmaxlen; + const char *contraction_flags= cs->contractions ? + ((const char*) cs->contractions) + 0x40*0x40 : NULL; for (; ptr != end && min_str != min_end && maxcharlen ; maxcharlen--) { @@ -575,6 +577,7 @@ my_bool my_like_range_mb(CHARSET_INFO *cs, ptr++; /* Skip escape */ else if (*ptr == w_one || *ptr == w_many) /* '_' and '%' in SQL */ { +fill_max_and_min: /* Calculate length of keys: 'a\0\0... is the smallest possible string when we have space expand @@ -606,8 +609,74 @@ my_bool my_like_range_mb(CHARSET_INFO *cs, *min_str++= *max_str++= *ptr++; } else - *min_str++= *max_str++= *ptr++; + { + /* + Special case for collations with contractions. + For example, in Chezh, 'ch' is a separate letter + which is sorted between 'h' and 'i'. + If the pattern 'abc%', 'c' at the end can mean: + - letter 'c' itself, + - beginning of the contraction 'ch'. + + If we simply return this LIKE range: + + 'abc\min\min\min' and 'abc\max\max\max' + + then this query: SELECT * FROM t1 WHERE a LIKE 'abc%' + will only find values starting from 'abc[^h]', + but won't find values starting from 'abch'. + We must ignore contraction heads followed by w_one or w_many. + ('Contraction head' means any letter which can be the first + letter in a contraction) + + For example, for Czech 'abc%', we will return LIKE range, + which is equal to LIKE range for 'ab%': + + 'ab\min\min\min\min' and 'ab\max\max\max\max'. + + */ + if (contraction_flags && ptr + 1 < end && + contraction_flags[(uchar) *ptr]) + { + /* Ptr[0] is a contraction head. */ + + if (ptr[1] == w_one || ptr[1] == w_many) + { + /* Contraction head followed by a wildcard, quit. */ + goto fill_max_and_min; + } + + /* + Some letters can be both contraction heads and contraction tails. + For example, in Danish 'aa' is a separate single letter which + is sorted after 'z'. So 'a' can be both head and tail. + + If ptr[0]+ptr[1] is a contraction, + then put both letters together. + + If ptr[1] can be a contraction part, but ptr[0]+ptr[1] + is not a contraction, then we put only ptr[0], + and continue with ptr[1] on the next loop. + */ + if (contraction_flags[(uchar) ptr[1]] && + cs->contractions[(*ptr-0x40)*0x40 + ptr[1] - 0x40]) + { + /* Contraction found */ + if (maxcharlen == 1 || min_str + 1 >= min_end) + { + /* Both contraction parts don't fit, quit */ + goto fill_max_and_min; + } + + /* Put contraction head */ + *min_str++= *max_str++= *ptr++; + maxcharlen--; + } + } + /* Put contraction tail, or a single character */ + *min_str++= *max_str++= *ptr++; + } } *min_length= *max_length = (size_t) (min_str - min_org); diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index 99e41611eaa..9a80b932d20 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -186,7 +186,7 @@ int my_strnncollsp_simple(CHARSET_INFO * cs, const uchar *a, size_t a_length, for (end= a + a_length-length; a < end ; a++) { if (*a != ' ') - return (*a < ' ') ? -swap : swap; + return (map[*a] < ' ') ? -swap : swap; } } return res; diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c index 4d106b5b897..1ed758bc105 100644 --- a/strings/ctype-uca.c +++ b/strings/ctype-uca.c @@ -7938,10 +7938,16 @@ static my_bool create_tailoring(CHARSET_INFO *cs, void *(*alloc)(size_t)) /* Now process contractions */ if (ncontractions) { - uint size= 0x40*0x40*sizeof(uint16); /* 8K, for basic latin letter only */ + /* + 8K for weights for basic latin letter pairs, + plus 256 bytes for "is contraction part" flags. + */ + uint size= 0x40*0x40*sizeof(uint16) + 256; + char *contraction_flags; if (!(cs->contractions= (uint16*) (*alloc)(size))) return 1; bzero((void*)cs->contractions, size); + contraction_flags= ((char*) cs->contractions) + 0x40*0x40; for (i=0; i < rc; i++) { if (rule[i].curr[1]) @@ -7967,6 +7973,9 @@ static my_bool create_tailoring(CHARSET_INFO *cs, void *(*alloc)(size_t)) /* Copy base weight applying primary difference */ cs->contractions[offsc]= offsb[0] + rule[i].diff[0]; + /* Mark both letters as "is contraction part */ + contraction_flags[rule[i].curr[0]]= 1; + contraction_flags[rule[i].curr[1]]= 1; } } } diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index a8d0f051abf..1df8221072e 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -1527,6 +1527,8 @@ my_bool my_like_range_ucs2(CHARSET_INFO *cs, char *min_org=min_str; char *min_end=min_str+res_length; size_t charlen= res_length / cs->mbmaxlen; + const char *contraction_flags= cs->contractions ? + ((const char*) cs->contractions) + 0x40*0x40 : NULL; for ( ; ptr + 1 < end && min_str + 1 < min_end && charlen > 0 ; ptr+=2, charlen--) @@ -1548,6 +1550,7 @@ my_bool my_like_range_ucs2(CHARSET_INFO *cs, } if (ptr[0] == '\0' && ptr[1] == w_many) /* '%' in SQL */ { +fill_max_and_min: /* Calculate length of keys: 'a\0\0... is the smallest possible string when we have space expand @@ -1564,6 +1567,38 @@ my_bool my_like_range_ucs2(CHARSET_INFO *cs, } while (min_str + 1 < min_end); return 0; } + + if (contraction_flags && ptr + 3 < end && + ptr[0] == '\0' && contraction_flags[(uchar) ptr[1]]) + { + /* Contraction head found */ + if (ptr[2] == '\0' && (ptr[3] == w_one || ptr[3] == w_many)) + { + /* Contraction head followed by a wildcard, quit */ + goto fill_max_and_min; + } + + /* + Check if the second letter can be contraction part, + and if two letters really produce a contraction. + */ + if (ptr[2] == '\0' && contraction_flags[(uchar) ptr[3]] && + cs->contractions[(ptr[1]-0x40)*0x40 + ptr[3] - 0x40]) + { + /* Contraction found */ + if (charlen == 1 || min_str + 2 >= min_end) + { + /* Full contraction doesn't fit, quit */ + goto fill_max_and_min; + } + + /* Put contraction head */ + *min_str++= *max_str++= *ptr++; + *min_str++= *max_str++= *ptr++; + charlen--; + } + } + /* Put contraction tail, or a single character */ *min_str++= *max_str++ = ptr[0]; *min_str++= *max_str++ = ptr[1]; } diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index eefaa6ce071..cb1561ad6f5 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -7836,7 +7836,7 @@ static void test_explain_bug() else { verify_prepare_field(result, 6, "key_len", "", MYSQL_TYPE_VAR_STRING, "", - "", "", NAME_CHAR_LEN*MAX_KEY, 0); + "", "", NAME_CHAR_LEN*MAX_KEY/ my_charset_utf8_general_ci.mbmaxlen, 0); } verify_prepare_field(result, 7, "ref", "", MYSQL_TYPE_VAR_STRING, |