#At file:///home/ram/mysql/b45998-5.1-bugteam/ based on revid:jimw@stripped
3022 Ramil Kalimullin 2009-07-14
Fix for bug#45998: database crashes when running
"create as select" (innodb table)
Problem: code constructing "CREATE TABLE..." statement
doesn't take into account that current database is not set
in some cases. That may lead to a server crash.
Fix: check if current database is set.
@ mysql-test/extra/binlog_tests/binlog.test
Fix for bug#45998: database crashes when running
"create as select" (innodb table)
- test case.
@ mysql-test/suite/binlog/r/binlog_row_binlog.result
Fix for bug#45998: database crashes when running
"create as select" (innodb table)
- test result.
@ sql/sql_show.cc
Fix for bug#45998: database crashes when running
"create as select" (innodb table)
- added check if there's current database set.
modified:
mysql-test/extra/binlog_tests/binlog.test
mysql-test/suite/binlog/r/binlog_row_binlog.result
sql/sql_show.cc
=== modified file 'mysql-test/extra/binlog_tests/binlog.test'
--- a/mysql-test/extra/binlog_tests/binlog.test 2009-03-25 19:41:16 +0000
+++ b/mysql-test/extra/binlog_tests/binlog.test 2009-07-14 15:07:29 +0000
@@ -258,3 +258,15 @@ dec $it;
}
show master status /* must show new binlog index after rotating */;
drop table t3;
+
+--echo #
+--echo # Bug #45998: database crashes when running "create as select"
+--echo #
+CREATE DATABASE test1;
+USE test1;
+DROP DATABASE test1;
+CREATE TABLE test.t1(a int);
+INSERT INTO test.t1 VALUES (1), (2);
+CREATE TABLE test.t2 SELECT * FROM test.t1;
+USE test;
+DROP TABLES t1, t2;
=== modified file 'mysql-test/suite/binlog/r/binlog_row_binlog.result'
--- a/mysql-test/suite/binlog/r/binlog_row_binlog.result 2009-05-31 05:44:41 +0000
+++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result 2009-07-14 15:07:29 +0000
@@ -1298,3 +1298,14 @@ show master status /* must show new binl
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000002 106
drop table t3;
+#
+# Bug #45998: database crashes when running "create as select"
+#
+CREATE DATABASE test1;
+USE test1;
+DROP DATABASE test1;
+CREATE TABLE test.t1(a int);
+INSERT INTO test.t1 VALUES (1), (2);
+CREATE TABLE test.t2 SELECT * FROM test.t1;
+USE test;
+DROP TABLES t1, t2;
=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc 2009-06-25 10:52:50 +0000
+++ b/sql/sql_show.cc 2009-07-14 15:07:29 +0000
@@ -1151,7 +1151,7 @@ int store_create_info(THD *thd, TABLE_LI
{
const LEX_STRING *const db=
table_list->schema_table ? &INFORMATION_SCHEMA_NAME : &table->s->db;
- if (strcmp(db->str, thd->db) != 0)
+ if (!thd->db || strcmp(db->str, thd->db))
{
append_identifier(thd, packet, db->str, db->length);
packet->append(STRING_WITH_LEN("."));
Attachment: [text/bzr-bundle] bzr/ramil@mysql.com-20090714150729-xqv7aicsnoz6epy6.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-bugteam branch (ramil:3022) Bug#45998 | Ramil Kalimullin | 14 Jul |