1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Bug#44653: Server crash noticed when executing random queries with partitions.

When opening a table, it is imperative that the flag
TABLE::auto_increment_field_not_null be false. But if an error occured during
the creation of a table (e.g. the table exists already) with an auto_increment
column and a BEFORE trigger that used the INSERT ... SELECT construct, the
flag was not reset until after error checking. Thus if an error occured,
select_insert::send_data() returned immediately and it was not reset (see * in
pseudocode below).  Crash happened if the table was opened again. Fixed by
resetting the flag after error checking.

nested-loops_join():
  for each row in SELECT table {
    select_insert::send_data():
      if a values is supplied for AUTO_INCREMENT column
         table->auto_increment_field_not_null= TRUE
       else
         table->auto_increment_field_not_null= FALSE
       if (error)
         return 1; *
       if (table->auto_increment_field_not_null == FALSE)
         ...
       table->auto_increment_field_not_null == FALSE 
  }
<-- table returned to table cache and later retrieved by open_table: 
open_table():
  assert(table->auto_increment_field_not_null)
This commit is contained in:
Martin Hansson
2009-06-22 14:51:33 +02:00
parent a141a6375a
commit 2cc1134c2c
3 changed files with 43 additions and 0 deletions

View File

@@ -3100,7 +3100,10 @@ bool select_insert::send_data(List<Item> &values)
store_values(values);
thd->count_cuted_fields= CHECK_FIELD_IGNORE;
if (thd->is_error())
{
table->auto_increment_field_not_null= FALSE;
DBUG_RETURN(1);
}
if (table_list) // Not CREATE ... SELECT
{
switch (table_list->view_check_option(thd, info.ignore)) {