• unknown's avatar
    Save and clear run context before executing a stored function or trigger and restore it afterwards. · 262075d1
    unknown authored
    This allows us to use statement replication with functions and triggers
    The following things are fixed with this patch:
    - NOW() and automatic timestamps takes the value from the main event for functions and triggers (which allows these to replicate with statement level logging)
    - No side effects for triggers or functions with auto-increment values(), last_insert_id(), rand() or found_rows()
    - Triggers can't return result sets
    
    Fixes bugs:
    #12480: NOW() is not constant in a trigger
    #12481: Using NOW() in a stored function breaks statement based replication
    #12482: Triggers has side effects with auto_increment values
    #11587: trigger causes lost connection error
    
    
    mysql-test/r/trigger.result:
      Added test fpr big
    mysql-test/t/sp-error.test:
      Changed error message numbers
    mysql-test/t/trigger.test:
      Added test for trigger returning result (#11587)
    sql/item_func.cc:
      Store the first used seed value for RAND() ...
    262075d1
item_func.cc 114 KB