Query goal: | Find trigger functions that are used in case of more than one table. Although it is legal, one must be careful when changing the functions in order to avoid unwanted consequences. |
Query type: | General (Overview of some aspect of the database.) |
Query license: | MIT License |
Data source: | INFORMATION_SCHEMA only |
SQL query: | Click on query to copy it
SELECT action_statement, string_agg(DISTINCT event_object_schema || '.' || event_object_table, ';<br>' ORDER BY event_object_schema || '.' || event_object_table) AS tables, Count(DISTINCT event_object_schema || '.' || event_object_table) AS nr_of_different_tables, Count(*) AS nr_of_different_triggers FROM INFORMATION_SCHEMA.triggers GROUP BY action_statement HAVING Count(DISTINCT event_object_schema || '.' || event_object_table)>1 ORDER BY Count(DISTINCT event_object_schema || '.' || event_object_table) DESC; |
Collection name | Collection description |
---|---|
Find problems by overview | Queries that results point to different aspects of database that might have problems. A human reviewer has to decide based on the results as to whether there are problems or not . |
Category name | Category description |
---|---|
Comfortability of database evolution | Queries of this category provide information about the means that influence database evolution. |
Triggers and rules | Queries of this category provide information about triggers and rules in a database. |