alvherre=# select tgname, tgrelid::regclass, tgisinternal from pg_trigger; tgname │ tgrelid │ tgisinternal ────────┼─────────┼────────────── trig_p │ parent │ f trig_p │ child │ t trig_c │ child │ f (3 filas)
So there is a trigger in table child, but it's hidden because tgisinternal. Of course, you can see it if you look at the parent's definition:
alvherre=# \d parent Tabla «public.parent» Columna │ Tipo │ Collation │ Nullable │ Default ─────────┼─────────┼───────────┼──────────┼───────── a │ integer │ │ │ Partition key: RANGE (a) Triggers: trig_p AFTER INSERT ON parent FOR EACH ROW EXECUTE PROCEDURE noise() Number of partitions: 1 (Use \d+ to list them.)
I think it'd be useful to have a list of triggers that have been inherited from ancestors, or maybe simply a list of internal triggers
Or maybe this is not something to worry about?
For the main internal trigger, foreign key, we don't show the trigger on the relevant table but we do indicate its effect by showing the presence of the foreign key. We likewise need to show the effect of the inherited trigger on the child table. When viewing the output the display order of invocation should be retained (is it that way now?) as a primary goal - with the directed or inherited nature presentation dependent upon that. i.e., I would like to see "Parent Triggers:" and "Triggers:" sections if possible but if trig_c is going to be invoked before trig_p that won't work and having a single "Triggers:" section with "(parent)" somewhere in the trigger info printout would be preferred.