• Dmitry Shulga's avatar
    Fixed bug#11753738 (formely known as bug#45235) - 5.1 DOES NOT SUPPORT 5.0-ONLY · 8867ad80
    Dmitry Shulga authored
    SYNTAX TRIGGERS IN ANY WAY
    
    Table with triggers which were using deprecated (5.0-only) syntax became
    unavailable for any DML and DDL after upgrade to 5.1 version of server.
    Attempt to execute any statement on such a table resulted in parsing
    error reported. Since this included DROP TRIGGER and DROP TABLE
    statements (actually, the latter was allowed but was not functioning
    properly for such tables) it was impossible to fix the problem without
    manual operations on .TRG and .TRN files in data directory.
    
    The problem was that failure to parse trigger body (due to 5.0-only
    syntax) when opening trigger file for a table prevented the table
    from being open. This made all operations on the table impossible
    (except DROP TABLE which due to peculiarity in its implementation
    dropped the table but left trigger files around).
    
    This patch solves this problem by silencing error which occurs when
    we parse trigger body during table open. Error message is preserved
    for the future use and table is marked as having a broken trigger.
    We also try to analyze parse tree to recover trigger name, which
    will be needed in order to drop the broken trigger. DML statements
    which invoke triggers on the table marked as having broken trigger
    are prohibited and emit saved error message. The same happens for
    DDL which change triggers except DROP TRIGGER and DROP TABLE which
    try their best to do what was requested. Table becomes no longer
    marked as having broken trigger when last such trigger is dropped.
    8867ad80
trigger-compat.test 8.31 KB