Indicate disabled triggers in \d

From: "Brendan Jurd" <direvus(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Indicate disabled triggers in \d
Date: 2006-11-06 03:44:42
Message-ID: 37ed240d0611051944q36dddf70xe8d60ccff422cddb@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

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 EXECUTE PROCEDURE 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 EXECUTE PROCEDURE 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-11-06 03:50:40 Re: Indicate disabled triggers in \d
Previous Message Neil Conway 2006-11-06 03:25:24 Re: adminpack and pg_catalog

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2006-11-06 03:50:40 Re: Indicate disabled triggers in \d
Previous Message Neil Conway 2006-11-06 01:50:47 Re: ldap: fix resource leak