Skip to content
  • Roy Lyseng's avatar
    b5917273
    Bug#21807818: Generated columns not updated with empty insert list · b5917273
    Roy Lyseng authored
    fill_record() has some logic to trigger the update of generated
    columns for the tables to update. However, when the list of columns
    to update is empty, no table will be identified for insert, and hence
    the generated columns are never updated before sending the row to
    the storage engine. No wonder all sorts of inconsistencies occur.
    
    Looking more closely at calls to fill_record(), we see that we always
    insert into exactly one table, and that table is always known by the
    caller, hence it is a far better choice to add a TABLE * argument to
    fill_record() and use it inside, instead of identifying the table
    from the field arguments.
    
    Doing this also triggered removing quite a bit of code.
    
    A heads up to the update of TABLE::auto_increment_field_not_null:
    It must be set to false only when the list of columns supplied to
    the function is non-empty. I did not try to understand this logic,
    just copied the existing logic as closely as possible.
    b5917273
    Bug#21807818: Generated columns not updated with empty insert list
    Roy Lyseng authored
    fill_record() has some logic to trigger the update of generated
    columns for the tables to update. However, when the list of columns
    to update is empty, no table will be identified for insert, and hence
    the generated columns are never updated before sending the row to
    the storage engine. No wonder all sorts of inconsistencies occur.
    
    Looking more closely at calls to fill_record(), we see that we always
    insert into exactly one table, and that table is always known by the
    caller, hence it is a far better choice to add a TABLE * argument to
    fill_record() and use it inside, instead of identifying the table
    from the field arguments.
    
    Doing this also triggered removing quite a bit of code.
    
    A heads up to the update of TABLE::auto_increment_field_not_null:
    It must be set to false only when the list of columns supplied to
    the function is non-empty. I did not try to understand this logic,
    just copied the existing logic as closely as possible.
Loading