From 61c9a7d55c8238c2aeb95db0260992f936f1fe4a Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 28 Sep 2006 18:51:27 +0300 Subject: bug#22027: CREATE TABLE IF NOT EXISTS SELECT logged improperly with rbr binlog, and #22762: create talbe if not exists like a-temp-table binlogged w/o "if not exists" These are rbr bugs. store_create_info, which generates the create statement e.g for binlogging, did not account a lex option HA_LEX_CREATE_IF_NOT_EXISTS. The fix makes the generated query to include the parent's statement option if that was supplied. mysql-test/extra/binlog_tests/binlog.test: test cases for #22027, #22762 mysql-test/r/binlog_row_binlog.result: results changed mysql-test/r/binlog_row_mix_innodb_myisam.result: results changed because of the test's query has "if not exists" mysql-test/r/binlog_stm_binlog.result: results changed sql/sql_show.cc: store_create_info inserts "if not exists" into output when an input query contains the qualifier. --- sql/sql_show.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sql') diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 236f5737a3d..024e5910cf8 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1042,6 +1042,9 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, packet->append(STRING_WITH_LEN("CREATE TEMPORARY TABLE ")); else packet->append(STRING_WITH_LEN("CREATE TABLE ")); + if (create_info_arg && + (create_info_arg->options & HA_LEX_CREATE_IF_NOT_EXISTS)) + packet->append(STRING_WITH_LEN("IF NOT EXISTS ")); if (table_list->schema_table) alias= table_list->schema_table->table_name; else -- cgit v1.2.1