summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2004-12-03 00:05:11 +0100
committerunknown <jimw@mysql.com>2004-12-03 00:05:11 +0100
commit9286d1c1452d53dd36c94fbe94a3f99be7b1dfb2 (patch)
treec6630df438ab32a1664bb54903e60729d5755629 /mysql-test
parenta845e882fd31c1b6e52d2a19017c8a2bd6f9c66c (diff)
downloadmariadb-git-9286d1c1452d53dd36c94fbe94a3f99be7b1dfb2.tar.gz
Prevent adding 'CREATE TABLE .. SELECT' query to the binary log when the
insertion of new records partially failed. It would get logged because of the logic to log a partially-failed 'INSERT ... SELECT' (which can't be rolled back in non-transactional tables), but 'CREATE TABLE ... SELECT' is always rolled back on failure, even for non-transactional tables. (Bug #6682) (Original fix reimplemented after review by Serg and Guilhem.) mysql-test/t/insert_select.test: Add test case for Bug #6682 mysql-test/r/insert_select.result: Add results for test case for Bug #6682 sql/sql_table.cc: moved tmp_disable_binlog() and reenable_binlog macros to sql/sql_class.h sql/sql_insert.cc: disable binlog during call to super's ::send_error in select_create class sql/sql_class.h: add select_create::send_error() BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/insert_select.result9
-rw-r--r--mysql-test/t/insert_select.test13
2 files changed, 22 insertions, 0 deletions
diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result
index a10e7fc02bb..ecd26f2d9fb 100644
--- a/mysql-test/r/insert_select.result
+++ b/mysql-test/r/insert_select.result
@@ -78,6 +78,15 @@ master-bin.001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
master-bin.001 79 Query 1 79 use `test`; insert into t1 select * from t2
drop table t1, t2;
drop table if exists t1, t2;
+create table t1(a int);
+insert into t1 values(1),(1);
+reset master;
+create table t2(unique(a)) select a from t1;
+Duplicate entry '1' for key 1
+show binlog events;
+Log_name Pos Event_type Server_id Orig_log_pos Info
+master-bin.001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
+drop table t1;
create table t1 (a int not null);
create table t2 (a int not null);
insert into t1 values (1);
diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test
index d9a8cfaf1be..deb80dbcdbf 100644
--- a/mysql-test/t/insert_select.test
+++ b/mysql-test/t/insert_select.test
@@ -86,6 +86,19 @@ show binlog events;
drop table t1, t2;
drop table if exists t1, t2;
+# Verify that a partly-completed CREATE TABLE .. SELECT does not
+# get into the binlog (Bug #6682)
+create table t1(a int);
+insert into t1 values(1),(1);
+reset master;
+--error 1062
+create table t2(unique(a)) select a from t1;
+# The above should produce an error, *and* not appear in the binlog
+let $VERSION=`select version()`;
+--replace_result $VERSION VERSION
+show binlog events;
+drop table t1;
+
#
# Test of insert ... select from same table
#