• unknown's avatar
    Proposed fix for bug #17764 "Trigger crashes MyISAM table" · 297c18ad
    unknown authored
    A table with an on insert trigger was reported as crashed when the insert
    was processed with bulk insert mode on (handler::start_bulk_insert).
    The trigger was also selecting from the same table, and that caused
    the "crash".
    The same problem was present when an insert statement, which was processed
    in bulk mode, also used a stored function that was reading the same table.
    
    This fix disables bulk inserts if a statement uses functions or invokes
    triggers. Implementing more granular checks will require much more code and
    therefore can hardly be done in 5.0
    
    
    mysql-test/r/trigger.result:
      Added test bug #17764 "Trigger crashes MyISAM table".
    mysql-test/t/trigger.test:
      Added test bug #17764 "Trigger crashes MyISAM table".
    sql/sql_insert.cc:
      We should not start bulk inserts for INSERT (or similar) statement if it uses
      functions or invokes triggers since they may access to the same table and
      therefore should not see its inconsistent state created by this optimization.
    sql/sql_load.cc:
      We should not start bulk inserts for INSERT (or similar) statement if it uses
      functions or invokes triggers since they may access to the same table and
      therefore should not see its inconsistent state created by this optimization.
    297c18ad
sql_insert.cc 76.5 KB