MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Martin Hansson Date:August 20 2009 11:56am
Subject:bzr commit into mysql-5.0-bugteam branch (martin.hansson:2789) Bug#46616
View as plain text  
#At file:///data0/martin/bzr/bug46616/5.0bt-gca/ based on revid:davi.arnaut@stripped

 2789 Martin Hansson	2009-08-20
      Bug#46616: Assertion `!table->auto_increment_field_not_null' on 
      view manipulations
            
      The bespoke flag was not properly reset after last call to 
      fill_record. Fixed by resetting in caller mysql_update.
     @ 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	2007-05-30 12:04:04 +0000
+++ b/mysql-test/r/auto_increment.result	2009-08-20 11:56:29 +0000
@@ -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;

=== modified file 'mysql-test/t/auto_increment.test'
--- a/mysql-test/t/auto_increment.test	2006-06-16 23:35:10 +0000
+++ b/mysql-test/t/auto_increment.test	2009-08-20 11:56:29 +0000
@@ -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;

=== modified file 'sql/sql_update.cc'
--- a/sql/sql_update.cc	2009-07-13 15:11:16 +0000
+++ b/sql/sql_update.cc	2009-08-20 11:56:29 +0000
@@ -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


Attachment: [text/bzr-bundle] bzr/martin.hansson@sun.com-20090820115629-rrg6u89iy0opaexy.bundle
Thread
bzr commit into mysql-5.0-bugteam branch (martin.hansson:2789) Bug#46616Martin Hansson20 Aug