From 6e27ef435e3863382295f1a1d41424c9b8d4c197 Mon Sep 17 00:00:00 2001 From: Satya B Date: Fri, 4 Sep 2009 12:21:54 +0530 Subject: Fix for BUG#46384 - mysqld segfault when trying to create table with same name as existing view When trying to create a table with the same name as existing view with join, mysql server crashes. The problem is when create table is issued with the same name as view, while verifying with the existing tables, we assume that base table object is created always. In this case, since it is a view over multiple tables, we don't have the mysql derived table object. Fixed the logic which checks if there is an existing table to not to assume that table object is created when the base table is view over multiple tables. mysql-test/r/create.result: BUG#46384 - mysqld segfault when trying to create table with same name as existing view Testcase for the bug mysql-test/t/create.test: BUG#46384 - mysqld segfault when trying to create table with same name as existing view Testcase for the bug sql/sql_insert.cc: BUG#46384 - mysqld segfault when trying to create table with same name as existing view Fixed create_table_from_items() method to properly check, if the base table is a view over multiple tables. --- mysql-test/r/create.result | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'mysql-test/r/create.result') diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index d37c1a04daa..dfd376a6bde 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -1559,4 +1559,17 @@ CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY) SELECT a FROM t1; ERROR 23000: Duplicate entry '1' for key 1 DROP TABLE t1, t2; +# +# BUG#46384 - mysqld segfault when trying to create table with same +# name as existing view +# +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +INSERT INTO t2 VALUES (1),(2),(3); +CREATE VIEW v1 AS SELECT t1.a FROM t1, t2; +CREATE TABLE v1 AS SELECT * FROM t1; +ERROR 42S01: Table 'v1' already exists +DROP VIEW v1; +DROP TABLE t1,t2; End of 5.0 tests -- cgit v1.2.1 From 377d710296c3b0c85ea4cdc018d1d8e08bfa022a Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 16 Jan 2010 15:44:24 +0800 Subject: BUG#47418 RBR fails, failure with mixup of base/temporary/view 'CREATE TABLE IF NOT EXISTS ... SELECT' statement were causing 'CREATE TEMPORARY TABLE ...' to be written to the binary log in row-based mode (a.k.a. RBR), when there was a temporary table with the same name. Because the 'CREATE TABLE ... SELECT' statement was executed as 'INSERT ... SELECT' into the temporary table. Since in RBR mode no other statements related to temporary tables are written into binary log, this sometimes broke replication. This patch changes behavior of 'CREATE TABLE [IF NOT EXISTS] ... SELECT ...'. it ignores existence of temporary table with the same name as table being created and is interpreted as attempt to create/insert into base table. This makes behavior of 'CREATE TABLE [IF NOT EXISTS] ... SELECT' consistent with how ordinary 'CREATE TABLE' and 'CREATE TABLE ... LIKE' behave. --- mysql-test/r/create.result | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'mysql-test/r/create.result') diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index b829ef30fb1..cfdf2565c9c 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -820,16 +820,13 @@ i drop table t1; create temporary table t1 (j int); create table if not exists t1 select 1; -Warnings: -Note 1050 Table 't1' already exists select * from t1; j -1 drop temporary table t1; select * from t1; -ERROR 42S02: Table 'test.t1' doesn't exist +1 +1 drop table t1; -ERROR 42S02: Unknown table 't1' create table t1 (i int); insert into t1 values (1), (2); lock tables t1 read; -- cgit v1.2.1 From 85d78b62ccf99fc93ec40f994658dc394a3e5987 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Sun, 27 Dec 2009 15:54:41 +0200 Subject: Fix test suite so that it works when doing configure --without-uca Simplify testing of needed characterset Remove ndb from --with-plugins=max build mysqlbug now sends email to maria-developers@lists.launchpad.net client/mysqltest.cc: SKIP now expands variables (for better error messages) mysql-test/include/have_big5.inc: Simplify by using have_collation.inc mysql-test/include/have_collation.inc: Test if '$collation' is supported mysql-test/include/have_cp1250_ch.inc: Simplify by using have_collation.inc mysql-test/include/have_cp1251.inc: Simplify by using have_collation.inc mysql-test/include/have_cp866.inc: Simplify by using have_collation.inc mysql-test/include/have_cp932.inc: Simplify by using have_collation.inc mysql-test/include/have_eucjpms.inc: Simplify by using have_collation.inc mysql-test/include/have_euckr.inc: Simplify by using have_collation.inc mysql-test/include/have_gb2312.inc: Simplify by using have_collation.inc mysql-test/include/have_gbk.inc: Simplify by using have_collation.inc mysql-test/include/have_koi8r.inc: Simplify by using have_collation.inc mysql-test/include/have_latin2_ch.inc: Simplify by using have_collation.inc mysql-test/include/have_sjis.inc: Simplify by using have_collation.inc mysql-test/include/have_tis620.inc: Simplify by using have_collation.inc mysql-test/include/have_ucs2.inc: Simplify by using have_collation.inc mysql-test/include/have_ujis.inc: Simplify by using have_collation.inc mysql-test/include/have_utf8.inc: Simplify by using have_collation.inc mysql-test/r/create-uca.result: Create tests that uses unicode mysql-test/r/create.result: Move test with unicode to create-uca.test mysql-test/r/have_big5.require: Not needed anymore mysql-test/r/have_cp1250_ch.require: Not needed anymore mysql-test/r/have_cp1251.require: Not needed anymore mysql-test/r/have_cp866.require: Not needed anymore mysql-test/r/have_cp932.require: Not needed anymore mysql-test/r/have_eucjpms.require: Not needed anymore mysql-test/r/have_euckr.require: Not needed anymore mysql-test/r/have_gb2312.require: Not needed anymore mysql-test/r/have_gbk.require: Not needed anymore mysql-test/r/have_koi8r.require: Not needed anymore mysql-test/r/have_latin2_ch.require: Not needed anymore mysql-test/r/have_sjis.require: Not needed anymore mysql-test/r/have_tis620.require: Not needed anymore mysql-test/r/have_ucs2.require: Not needed anymore mysql-test/r/have_ujis.require: Not needed anymore mysql-test/r/have_utf8.require: Not needed anymore mysql-test/r/innodb.result: Move tests that depends on unicode to innodb_utf8.test mysql-test/r/innodb_utf8.result: Test moved from innodb.test mysql-test/suite/rpl/t/rpl_ignore_table.test: Test for required collations mysql-test/t/create-uca.test: Create tests that uses unicode mysql-test/t/create.test: Move test with unicode to create-uca.test mysql-test/t/ctype_utf8.test: Test that require unicode mysql-test/t/ddl_i18n_koi8r.test: Test for required collations mysql-test/t/ddl_i18n_utf8.test: Test for required collations mysql-test/t/fulltext.test: Test for required collations mysql-test/t/fulltext2.test: Test for required collations mysql-test/t/innodb.test: Move tests that depends on unicode to innodb_utf8.test mysql-test/t/innodb_utf8.test: Tests that uses unicode mysql-test/t/query_cache_ps_no_prot.test: Test for required collations mysql-test/t/query_cache_ps_ps_prot.test: Test for required collations scripts/mysqlbug.sh: Send emails to maria-developers@lists.launchpad.net storage/ndb/plug.in: Don't include ndb in 'max' builds --- mysql-test/r/create.result | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) (limited to 'mysql-test/r/create.result') diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index 29686d6e023..dc2cb6786c7 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -1792,52 +1792,6 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MEMORY DEFAULT CHARSET=utf8 drop table t1; -# -- -# -- Bug#21380: DEFAULT definition not always transfered by CREATE -# -- TABLE/SELECT to the new table. -# -- - -DROP TABLE IF EXISTS t1; -DROP TABLE IF EXISTS t2; - -CREATE TABLE t1( -c1 INT DEFAULT 12 COMMENT 'column1', -c2 INT NULL COMMENT 'column2', -c3 INT NOT NULL COMMENT 'column3', -c4 VARCHAR(255) CHARACTER SET utf8 NOT NULL DEFAULT 'a', -c5 VARCHAR(255) COLLATE utf8_unicode_ci NULL DEFAULT 'b', -c6 VARCHAR(255)) -COLLATE latin1_bin; - -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int(11) DEFAULT '12' COMMENT 'column1', - `c2` int(11) DEFAULT NULL COMMENT 'column2', - `c3` int(11) NOT NULL COMMENT 'column3', - `c4` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT 'a', - `c5` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT 'b', - `c6` varchar(255) COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_bin - -CREATE TABLE t2 AS SELECT * FROM t1; - -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `c1` int(11) DEFAULT '12' COMMENT 'column1', - `c2` int(11) DEFAULT NULL COMMENT 'column2', - `c3` int(11) NOT NULL COMMENT 'column3', - `c4` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT 'a', - `c5` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT 'b', - `c6` varchar(255) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 - -DROP TABLE t2; -DROP TABLE t1; - -# -- End of test case for Bug#21380. - # -- # -- Bug#18834: ALTER TABLE ADD INDEX on table with two timestamp fields # -- -- cgit v1.2.1