summaryrefslogtreecommitdiff
path: root/mysql-test/t/update.test
diff options
context:
space:
mode:
authorJon Olav Hauglid <jon.hauglid@sun.com>2009-10-23 15:09:14 +0200
committerJon Olav Hauglid <jon.hauglid@sun.com>2009-10-23 15:09:14 +0200
commit6354112983d5e2a9fda44a873211ec7c21c1cd3d (patch)
tree196c2f18f06f575e89d3902381989d8a89df0141 /mysql-test/t/update.test
parent20674b1a6f65ea73f7afb3648821e7005fb53bf0 (diff)
downloadmariadb-git-6354112983d5e2a9fda44a873211ec7c21c1cd3d.tar.gz
Bug #47919 assert in open_table during ALTER temporary table
This assertion would occur if UPDATE was used to update multiple tables containing an AUTO_INCREMENT column and if the inserted row had a user-supplied value for that column. The assertion could then be triggered by the next statement. The problem was only noticeable on debug builds of the server. The cause of the problem was that the code for multi update did not properly reset the TABLE->auto_increment_if_null flag after update. The flag is used to indicate that a non-null value of an auto_increment field has been provided by the user or retrieved from a current record. Open_tables() contains an assertion that tests this flag, and this was triggered in this case by ALTER TABLE. This patch fixes the problem by resetting the auto_increment_if_null field to FALSE once a row has been updated. This bug is similar to Bug#47274, but for multi update rather than INSERT DELAYED. Test case added to update.test.
Diffstat (limited to 'mysql-test/t/update.test')
-rw-r--r--mysql-test/t/update.test15
1 files changed, 15 insertions, 0 deletions
diff --git a/mysql-test/t/update.test b/mysql-test/t/update.test
index 7d56df259ba..02e8763a630 100644
--- a/mysql-test/t/update.test
+++ b/mysql-test/t/update.test
@@ -452,3 +452,18 @@ DROP TABLE t1;
DROP FUNCTION f1;
--echo End of 5.0 tests
+
+--echo #
+--echo # Bug #47919 assert in open_table during ALTER temporary table
+--echo #
+
+CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT, PRIMARY KEY (f1));
+CREATE TEMPORARY TABLE t2 LIKE t1;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+
+ALTER TABLE t2 COMMENT = 'ABC';
+UPDATE t2, t1 SET t2.f1 = 2, t1.f1 = 9;
+ALTER TABLE t2 COMMENT = 'DEF';
+
+DROP TABLE t1, t2;