trigger(s) associated with a view or a table in PostgreSQL

This will return all the details you want to know

select * from information_schema.triggers

or if you want to sort the results of a specific table then you can try

SELECT event_object_table
      ,trigger_name
      ,event_manipulation
      ,action_statement
      ,action_timing
FROM  information_schema.triggers
WHERE event_object_table = 'tableName'
ORDER BY event_object_table
     ,event_manipulation

the following will return table name that has a trigger

select relname as table_with_trigger
from pg_class
where pg_class.oid in (
        select tgrelid
        from pg_trigger
        )
Facebook Comments