• kroki@mysql.com's avatar
    Bug#16461: connection_id() does not work properly inside trigger · c8e22ff7
    kroki@mysql.com authored
    CONNECTION_ID() was implemented as a constant Item, i.e. an instance of
    Item_static_int_func class holding value computed at creation time.
    Since Items are created on parsing, and trigger statements are parsed
    on table open, the first connection to open a particular table would
    effectively set its own CONNECTION_ID() inside trigger statements for
    that table.
    
    Re-implement CONNECTION_ID() as a class derived from Item_int_func, and
    compute connection_id on every call to fix_fields().
    c8e22ff7
trigger.test 36.8 KB