How to get the trigger(s) associated with a view or a table in PostgreSQL

前端 未结 5 765
萌比男神i
萌比男神i 2021-02-01 12:27

I have one requirement that I have to get the list of triggers associated to the given table/view.
Can anyone help me to find the triggers for a table in PostgreSQL?

5条回答
  •  一生所求
    2021-02-01 13:18

    I noticed that infoschema does NOT contain key relation table information about triggers (at least in postgres 10). pg_triggers does contain this info. Also noticed that datagrip will not script relation tables when you script the triggers, so i'm assuming that it uses infoschema to script them (and then your table would be missing the relation tables, and the trigger functions referencing them would fail). PG documentation says that columns in infoschema for action_reference_old_table applies to a feature not available in postgres(10), but i'm definitely using them, and they definitely show up in pg_triggers. FYI.

提交回复
热议问题