summaryrefslogtreecommitdiff
path: root/sql/sql_update.cc
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
commit111da3a4c0dd88df7f572f6529f2ed26f2c1ff66 (patch)
tree196c2f18f06f575e89d3902381989d8a89df0141 /sql/sql_update.cc
parentc7a02cf80745614b8584b5dd39945203062bb8fc (diff)
downloadmariadb-git-111da3a4c0dd88df7f572f6529f2ed26f2c1ff66.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 'sql/sql_update.cc')
-rw-r--r--sql/sql_update.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 152613c0009..c2fb9172931 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -1696,6 +1696,11 @@ bool multi_update::send_data(List<Item> &not_used_values)
TRG_EVENT_UPDATE))
DBUG_RETURN(1);
+ /*
+ Reset the table->auto_increment_field_not_null as it is valid for
+ only one row.
+ */
+ table->auto_increment_field_not_null= FALSE;
found++;
if (!can_compare_record || compare_record(table))
{