Find the number of user defined triggers by action orientation (ROW, STATEMENT), action timing (BEFORE, AFTER, INSTEAD OF), and event type (INSERT, UPDATE, DELETE) and their combinations.
Type
Sofware measure (Numeric values (software measures) about the database)
SELECT action_orientation, action_timing, event_manipulation, Count(DISTINCT trigger_schema ||'.'||event_object_table ||'.'|| trigger_name) AS nr_of_different_triggers
FROM information_schema.triggers AS Tr
INNER JOIN information_schema.schemata S
ON Tr.trigger_schema=S.schema_name
WHERE (Tr.trigger_schema = 'public'
OR S.schema_owner<>'postgres')
GROUP BY ROLLUP (action_orientation, action_timing, event_manipulation)
ORDER BY action_orientation, action_timing, event_manipulation, nr_of_different_triggers DESC;
Collections
This query belongs to the following collections:
Name
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 .
Find quick numeric overview of the database
Queries that return numeric values showing mostly the number of different types of database objects in the database
Categories
This query is classified under the following categories:
Name
Description
Triggers and rules
Queries of this category provide information about triggers and rules in a database.