From 976f0a391c9d20982d495cd01ab6e8f701d915fd Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 7 Feb 2007 00:46:03 +0300 Subject: Bug#19978: INSERT .. ON DUPLICATE erroneously reports some records were updated. INSERT ... ON DUPLICATE KEY UPDATE reports that a record was updated when the duplicate key occurs even if the record wasn't actually changed because the update values are the same as those in the record. Now the compare_record() function is used to check whether the record was changed and the update of a record reported only if the record differs from the original one. sql/sql_update.cc: Bug#19978: INSERT .. ON DUPLICATE erroneously reports some records were updated. The compare_record() function was changed to non-static one. sql/sql_insert.cc: Bug#19978: INSERT .. ON DUPLICATE erroneously reports some records were updated. Now the compare_record() function is used to check whether the record was changed and the update of a record reported only if the record differs from the original one. sql/mysql_priv.h: Bug#19978: INSERT .. ON DUPLICATE erroneously reports some records were updated. Added the prototype of the compare_record() function. mysql-test/t/insert_select.test: Added a test case for bug#19978: INSERT .. ON DUPLICATE erroneously reports some records were updated. mysql-test/r/insert_select.result: Added a test case for bug#19978: INSERT .. ON DUPLICATE erroneously reports some records were updated. --- sql/mysql_priv.h | 1 + 1 file changed, 1 insertion(+) (limited to 'sql/mysql_priv.h') diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index ce5df434295..1ffcad12414 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -701,6 +701,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, char* packet, uint packet_length); void log_slow_statement(THD *thd); bool check_dup(const char *db, const char *name, TABLE_LIST *tables); +bool compare_record(TABLE *table, query_id_t query_id); bool table_cache_init(void); void table_cache_free(void); -- cgit v1.2.1 From 2572c82621b04cb852b29736f835bcb204f5bfc0 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 12 Feb 2007 16:06:14 +0400 Subject: Bug#24630 Subselect query crashes mysqld The crash happens because second filling of the same I_S table happens in case of subselect with order by. table->sort.io_cache previously allocated in create_sort_index() is deleted during second filling (function get_schema_tables_result). There are two places where I_S table can be filled: JOIN::exec and create_sort_index(). To fix the bug we should check if the table was already filled in one of these places and skip processing of the table in second. mysql-test/r/information_schema.result: test case mysql-test/t/information_schema.test: test case sql/mysql_priv.h: added new parameter 'executed_place' to function get_schema_tables_result() sql/sql_select.cc: added new parameter 'executed_place' to function get_schema_tables_result() sql/sql_show.cc: added more accurate check for cases when we need to refresh I_S table sql/table.cc: added more accurate check for cases when we need to refresh I_S table sql/table.h: added more accurate check for cases when we need to refresh I_S table --- sql/mysql_priv.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sql/mysql_priv.h') diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 1ffcad12414..1dd3c9dceca 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -932,7 +932,8 @@ int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond); int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond); int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond); int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond); -bool get_schema_tables_result(JOIN *join); +bool get_schema_tables_result(JOIN *join, + enum enum_schema_table_state executed_place); #define is_schema_db(X) \ !my_strcasecmp(system_charset_info, information_schema_name.str, (X)) -- cgit v1.2.1