#At file:///data0/martin/bzr/bug46616/5.1bt-gca/ based on revid:ramil@stripped
3070 Martin Hansson 2009-08-20 [merge]
Bug#46616: Merge
@ mysql-test/r/auto_increment.result
Bug#46616: Test result.
@ mysql-test/t/auto_increment.test
Bug#46616: Test case.
@ sql/sql_update.cc
Bug#46616: Fix.
modified:
mysql-test/r/auto_increment.result
mysql-test/t/auto_increment.test
sql/sql_update.cc
=== modified file 'mysql-test/r/auto_increment.result'
--- a/mysql-test/r/auto_increment.result 2009-02-05 09:49:32 +0000
+++ b/mysql-test/r/auto_increment.result 2009-08-20 12:30:59 +0000
@@ -462,3 +462,17 @@ select last_insert_id();
last_insert_id()
3
drop table t1;
+#
+# Bug#46616: Assertion `!table->auto_increment_field_not_null' on view
+# manipulations
+#
+CREATE TABLE t1 ( a INT );
+INSERT INTO t1 VALUES (1), (1);
+CREATE TABLE t2 ( a INT AUTO_INCREMENT KEY );
+CREATE TABLE IF NOT EXISTS t2 AS SELECT a FROM t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+UPDATE t2 SET a = 2;
+SELECT a FROM t2;
+a
+2
+DROP TABLE t1, t2;
=== modified file 'mysql-test/t/auto_increment.test'
--- a/mysql-test/t/auto_increment.test 2009-02-05 09:49:32 +0000
+++ b/mysql-test/t/auto_increment.test 2009-08-20 12:30:59 +0000
@@ -324,3 +324,21 @@ insert into t1 values(null,0,0,0,null);
replace into t1 values(null,1,0,2,null);
select last_insert_id();
drop table t1;
+
+--echo #
+--echo # Bug#46616: Assertion `!table->auto_increment_field_not_null' on view
+--echo # manipulations
+--echo #
+CREATE TABLE t1 ( a INT );
+INSERT INTO t1 VALUES (1), (1);
+
+CREATE TABLE t2 ( a INT AUTO_INCREMENT KEY );
+--error ER_DUP_ENTRY
+CREATE TABLE IF NOT EXISTS t2 AS SELECT a FROM t1;
+
+UPDATE t2 SET a = 2;
+
+SELECT a FROM t2;
+
+DROP TABLE t1, t2;
+
=== modified file 'sql/sql_update.cc'
--- a/sql/sql_update.cc 2009-07-13 17:36:54 +0000
+++ b/sql/sql_update.cc 2009-08-20 12:30:59 +0000
@@ -730,6 +730,7 @@ int mysql_update(THD *thd,
break;
}
}
+ table->auto_increment_field_not_null= FALSE;
dup_key_found= 0;
/*
Caching the killed status to pass as the arg to query event constuctor;
Attachment: [text/bzr-bundle] bzr/martin.hansson@sun.com-20090820123059-0tbvzbps6jh89378.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-bugteam branch (martin.hansson:3070) Bug#46616 | Martin Hansson | 20 Aug |