summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Hansson <martin.hansson@sun.com>2009-08-21 14:31:40 +0200
committerMartin Hansson <martin.hansson@sun.com>2009-08-21 14:31:40 +0200
commit8f75260b7d8fcee21309f54b336f02975fe145b4 (patch)
tree9ee219dda0e3459042cec55431035f716e2851d4
parent0665536995fa1afe4ac71e13451dd8258063ff36 (diff)
parente66fba53a76b54d63d7ce6edc680a2e8886018d8 (diff)
downloadmariadb-git-8f75260b7d8fcee21309f54b336f02975fe145b4.tar.gz
Merge.
-rw-r--r--mysql-test/r/auto_increment.result14
-rw-r--r--mysql-test/t/auto_increment.test16
-rw-r--r--sql/sql_update.cc1
3 files changed, 31 insertions, 0 deletions
diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result
index 90ba00e1019..44b2e3797b2 100644
--- a/mysql-test/r/auto_increment.result
+++ b/mysql-test/r/auto_increment.result
@@ -440,3 +440,17 @@ a val
2 1
3 1
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 1
+UPDATE t2 SET a = 2;
+SELECT a FROM t2;
+a
+2
+DROP TABLE t1, t2;
diff --git a/mysql-test/t/auto_increment.test b/mysql-test/t/auto_increment.test
index 5d22bdd46a0..00849a3b131 100644
--- a/mysql-test/t/auto_increment.test
+++ b/mysql-test/t/auto_increment.test
@@ -292,3 +292,19 @@ update t1 set a=2 where a=1;
insert into t1 (val) values (1);
select * from t1;
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;
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index f95f0a22a71..c18c34fc1d1 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -527,6 +527,7 @@ int mysql_update(THD *thd,
table->file->unlock_row();
thd->row_count++;
}
+ table->auto_increment_field_not_null= FALSE;
/*
Caching the killed status to pass as the arg to query event constuctor;
The cached value can not change whereas the killed status can