Search code examples
mysqlinformation-schema

Can triggers on the tables in schema INFORMATION_SCHEMA be created in mysql (5.5) ?


I'd like to be able to pause shortly before creating a table (for a few seconds or so), so that i can spot in my console which step in an installation process is running the "CREATE TABLE" statement.

If I'd be able to create a trigger on the tables in "INFORMATION_SCHEMA", I assume i'd be able to capture the exact moment when an table is attempting to be created, and i can see what step of the script that i am running in the began the creation of the file.

Currently the CREATE TRIGGER ... statement doesn't do anything when i am referencing tables inside the INFORMATION_SCHEMA.

Is there a way to bypass this?


Solution

  • You cannot set triggers on tables in the information_schema database.

    See manual.

     MySQL 5.1 Reference Manual
    
        Chapter 20. INFORMATION_SCHEMA Tables
    
    
        Usage Notes for the INFORMATION_SCHEMA Database
    
    
        INFORMATION_SCHEMA is a database within each MySQL instance, the place that stores 
    information about all the other databases that the MySQL server maintains. The 
    INFORMATION_SCHEMA database contains several read-only tables. They are actually views, not
    base tables, so there are no files associated with them, and you cannot set triggers on them.