1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-07 06:01:31 +03:00

BUG#48506 crash in CREATE TABLE IF NOT EXISTS <existing_view> LIKE

<tmp_tbl> with RBL

When binlogging the statement, the server always handle the existing
object as a table, even though it is a view. However a view is
handled differently in other parts of the code thus leading the
statement to crash in RBL if the view exists.

This happens because the underlying tables for the view are not opened
when we try to call store_create_info() on the view in order to build
a CREATE TABLE statement.

This patch will only address the crash problem, other binlogging
problems related to CREATE TABLE IF NOT EXISTS LIKE when the existing
object is a view will be solved by BUG 47442.
This commit is contained in:
Alfranio Correia
2009-11-27 13:34:39 +00:00
parent 96ffcff059
commit 6b31aa1040
3 changed files with 75 additions and 5 deletions

View File

@ -5419,12 +5419,20 @@ binlog:
}
VOID(pthread_mutex_unlock(&LOCK_open));
IF_DBUG(int result=)
store_create_info(thd, table, &query,
create_info, FALSE /* show_database */);
/*
The condition avoids a crash as described in BUG#48506. Other
binlogging problems related to CREATE TABLE IF NOT EXISTS LIKE
when the existing object is a view will be solved by BUG 47442.
*/
if (!table->view)
{
IF_DBUG(int result=)
store_create_info(thd, table, &query,
create_info, FALSE /* show_database */);
DBUG_ASSERT(result == 0); // store_create_info() always return 0
write_bin_log(thd, TRUE, query.ptr(), query.length());
DBUG_ASSERT(result == 0); // store_create_info() always return 0
write_bin_log(thd, TRUE, query.ptr(), query.length());
}
}
else // Case 1
write_bin_log(thd, TRUE, thd->query(), thd->query_length());