• unknown's avatar
    Fix for bugs #5892/6182/8751/8758/10994 (based on Antony's patch) · a32bf7fb
    unknown authored
      "Triggers have the wrong namespace"
      "Triggers: duplicate names allowed"
      "Triggers: CREATE TRIGGER does not accept fully qualified names"
      "SHOW TRIGGERS"
    
    
    mysql-test/r/information_schema.result:
      Added tests for new INFORMATION_SCHEMA.TRIGGERS view and SHOW TRIGGERS command.
    mysql-test/r/information_schema_db.result:
      INFORMATION_SCHEMA.TRIGGERS view was added.
    mysql-test/r/rpl_sp.result:
      Now DROP TRIGGER interprets first part of trigger identifier as database
      name and not as table name. Adjusted tests properly.
    mysql-test/r/trigger.result:
      Now DROP TRIGGER interprets first part of trigger identifier as database
      name and not as table name. Adjusted tests properly.
      Added test checking that triggers have database wide namespace.
      Added test for bug #8791 "Triggers: Allowed to create triggers on a subject
      table in a different DB".
    mysql-test/r/view.result:
      Now DROP TRIGGER interprets first part of trigger identifier as database
      name and not as table name. Adjusted tests properly.
    mysql-test/t/information_schema.test:
      Added tests for new INFORMATION_SCHEMA.TRIGGERS view and SHOW TRIGGERS command.
    mysql-test/t/rpl_sp.test:
      Now DROP TRIGGER interprets first part of trigger identifier as database
      name and not as table name. Adjusted tests properly.
    mysql-test/t/trigger.test:
      Now DROP TRIGGER interprets first part of trigger identifier as database
      name and not as table name. Adjusted tests properly.
      Added test checking that triggers have database wide namespace.
      Added test for bug #8791 "Triggers: Allowed to create triggers on a subject
      table in a different DB".
    mysql-test/t/view.test:
      Now DROP TRIGGER interprets first part of trigger identifier as database
      name and not as table name. Adjusted tests properly.
    sql/handler.cc:
      Added .TRN tho the list of known file extensions assoicated with tables.
    sql/item.h:
      trg_action_time_type/trg_event_type enums:
        Added TRG_ACTION_MAX/TRG_EVENT_MAX elements which should be used instead of
        magical values in various loops where we iterate through all types of trigger
        action times or/and trigger event types.
    sql/lex.h:
      Added new symbol "TRIGGERS".
    sql/mysql_priv.h:
      Added declaration of constant holding extension for trigger name (.TRN) files.
    sql/mysqld.cc:
      Added statistical variable for SHOW TRIGGERS command.
    sql/share/errmsg.txt:
      Added error message saying that one attempts to create trigger in wrong schema.
    sql/sp.cc:
      Replaced magical values with TRG_EVENT_MAX/TRG_ACTION_MAX constants.
    sql/sql_base.cc:
      open_unireg_entry():
        Now Table_triggers_list::check_n_load() has one more argument which
        controls whether we should prepare Table_triggers_list with fully functional
        triggers or load only their names.
    sql/sql_lex.h:
      Added element for new SHOW TRIGGERS command to enum_sql_command enum.
    sql/sql_parse.cc:
      prepare_schema_table():
        Added support for SHOW TRIGGERS statement.
    sql/sql_show.cc:
      Added new INFORMATION_SCHEMA.TRIGGERS view and SHOW TRIGGERS command.
    sql/sql_table.cc:
      mysql_rm_table_part2():
        Replaced simple deletion of .TRG file with call to
        Table_triggers_list::drop_all_triggers which will also delete .TRN files
        for all triggers associated with table.
    sql/sql_trigger.cc:
      Now triggers have database wide namespace. To support it we create special .TRN
      file with same name as trigger for each trigger. This file contains name of
      trigger's table so one does not need to specify it explicitly in DROP TRIGGER.
      Moreover DROP TRIGGER treats first part of trigger identifier as database name
      now. Updated mysql_create_or_drop_trigger() routine and
      Table_triggers_list::create_trigger()/drop_trigger()/check_n_load() methods
      accordingly. Added add_table_for_trigger() routine and
      Table_triggers_list::drop_all_triggers() method.
      
      Added Table_triggers_list::get_trigger_info() for obtaining trigger metadata.
    sql/sql_trigger.h:
      Table_triggers_list:
        Use TRG_EVENT_MAX, TRG_ACTION_MAX instead of magic values.
        Added get_trigger_info() method for obtaining trigger's meta-data.
        Added drop_all_triggers() method which drops all triggers for table.
        Added declarations of trg_action_time_type_names/trg_event_type_names
        arrays which hold names of triggers action time types  and event types.
    sql/sql_yacc.yy:
      Changed grammar for CREATE/DROP TRIGGER to support database wide trigger
      namespace. Added new SHOW TRIGGERS statement.
    sql/table.h:
      enum enum_schema_tables:
        Added constant for new INFORMATION_SCHEMA.TRIGGERS view.
    a32bf7fb
rpl_sp.result 8.46 KB