Hello hackers,
I noticed that the table description given by \d <tablename> in psql
does not indicate whether a trigger is enabled or disabled.
In my opinion, if a trigger is disabled, that fact is essential
information that a person looking at the output of \d would want to
know. I would like to add this feature (and am happy to provide a
patch), and I'd like your input on how it should be displayed.
My first impulse was to just append a " (disabled)" after each
disabled trigger, but perhaps that is not visually obvious enough,
especially if the table has many triggers on it.
Triggers: y AFTER DELETE ON x FOR EACH ROW EXECUTE PROCEDURE do_something() z BEFORE INSERT ON x FOR EACH ROW
EXECUTEPROCEDURE input_stuff() (disabled)
You could make it more clear by putting the disabled notice on a
separate line with another level of indentation, but could look very
messy with lots of triggers on the table:
Triggers: y AFTER DELETE ON x FOR EACH ROW EXECUTE PROCEDURE do_something() z BEFORE INSERT ON x FOR EACH ROW
EXECUTEPROCEDURE input_stuff() - disabled
At the moment my preference is for disabled triggers to be shown as a
separate footer section, like so:
Triggers: y AFTER DELETE ON x FOR EACH ROW EXECUTE PROCEDURE do_something()
Disabled triggers: z BEFORE INSERT ON x FOR EACH ROW EXECUTE PROCEDURE input_stuff()
I think this provides the best clarity, and has the added bonus of
leaving the trigger definition intact.
Thanks for your time,
BJ