mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 13:02:28 +01:00
dcd050c550
The failure was caused by executing a CREATE-SELECT statement that creates a table in another database than the current one. In row-based logging, the CREATE statement was written to the binary log without the database, hence creating the table in the wrong database, causing the following inserts to fail since the table didn't exist in the given database. Fixed the bug by adding a parameter to store_create_info() that will make the function print the database name before the table name and used that in the calls that write the CREATE statement to the binary log. The database name is only printed if it is different than the currently selected database. The output of SHOW CREATE TABLE has not changed and is still printed without the database name. mysql-test/suite/rpl/t/rpl_row_create_table.test: Added test to check that CREATE-SELECT into another database than the current one replicates. sql/sql_insert.cc: Adding parameter to calls to store_create_info(). sql/sql_show.cc: Adding parameter to calls to store_create_info(). Extending store_create_info() with parameter 'show_database' that will cause the database to be written before the table name. sql/sql_show.h: Adding parameter to call to store_create_info() to tell if the database should be shown or not. sql/sql_table.cc: Adding parameter to calls to store_create_info().
41 lines
1.4 KiB
C++
41 lines
1.4 KiB
C++
/* Copyright (C) 2006 MySQL AB
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; version 2 of the License.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
|
|
|
#ifndef SQL_SHOW_H
|
|
#define SQL_SHOW_H
|
|
|
|
/* Forward declarations */
|
|
class String;
|
|
class THD;
|
|
struct st_ha_create_information;
|
|
typedef st_ha_create_information HA_CREATE_INFO;
|
|
struct TABLE_LIST;
|
|
|
|
enum find_files_result {
|
|
FIND_FILES_OK,
|
|
FIND_FILES_OOM,
|
|
FIND_FILES_DIR
|
|
};
|
|
|
|
find_files_result find_files(THD *thd, List<LEX_STRING> *files, const char *db,
|
|
const char *path, const char *wild, bool dir);
|
|
|
|
int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
|
|
HA_CREATE_INFO *create_info_arg, bool show_database);
|
|
int view_store_create_info(THD *thd, TABLE_LIST *table, String *buff);
|
|
|
|
int copy_event_to_schema_table(THD *thd, TABLE *sch_table, TABLE *event_table);
|
|
|
|
#endif /* SQL_SHOW_H */
|