From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com> |
Cc: | Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>, Andres Freund <andres(at)2ndquadrant(dot)com>, mailings(at)oopsware(dot)de |
Subject: | Re: psql should show disabled internal triggers |
Date: | 2014-02-13 02:04:45 |
Message-ID: | 20140213020445.GC4831@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Nov 21, 2013 at 11:59:51PM -0200, Fabrízio de Royes Mello wrote:
> On Fri, Oct 25, 2013 at 3:37 PM, fabriziomello <fabriziomello(at)gmail(dot)com> wrote:
> >
> > On 2013-09-18 15:15:55 +0200, Bernd Helmle wrote:
> > > On 2013-09-18 15:15:55 +0200, Bernd Helmle wrote:
> > > > --On 18. September 2013 13:52:29 +0200 Andres Freund
> > > > <andres@> wrote:
> > > >
> > > > >If you do ALTER TABLE ... DISABLE TRIGGER ALL; and then individually
> > > > >re-enable the disabled triggers it's easy to miss internal triggers.
> > > > >A \d+ tablename will not show anything out of the ordinary for that
> > > > >situation since we don't show internal triggers. But foreign key checks
> > > > >won't work.
> > > > >So, how about displaying disabled internal triggers in psql?
> > > >
> > > > Hi had exactly the same concerns this morning while starting to look at
> > > the
> > > > ENABLE/DISABLE constraint patch. However, i wouldn't display them as
> > > > triggers, but maybe more generally as "disabled constraints" or such.
> > >
> > > Well, that will lead the user in the wrong direction, won't it? They
> > > haven't disabled the constraint but the trigger. Especially as we
> > > already have NOT VALID and might grow DISABLED for constraint
> > > themselves...
> > >
> >
> > Hi,
> >
> > The attached patch [1] enable PSQL to list internal disabled triggers in \d
> > only in versions >= 9.0.
> >
> > [1] psql-display-all-triggers-v1.patch
> > <http://postgresql.1045698.n5.nabble.com/file/n5775954/
> psql-display-all-triggers-v1.patch>
As others, I am concerned about people being confused when funny-looking
trigger names suddenly appearing when you disable all table triggers.
What I ended up doing is to create a user and internal section when
displaying disabled triggers:
Disabled user triggers:
check_update BEFORE UPDATE ON orders FOR EACH ROW EXECUTE PROCEDURE trigf()
Disabled internal triggers:
"RI_ConstraintTrigger_c_16409" AFTER INSERT ON orders FROM customer NOT DEF ...
"RI_ConstraintTrigger_c_16410" AFTER UPDATE ON orders FROM customer NOT DEF ...
I kept the "Triggers" section unchanged, showing only user triggers. I
also updated the code to handle 8.3+ servers.
Patch attached.
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ Everyone has their own god. +
Attachment | Content-Type | Size |
---|---|---|
trigger.diff | text/x-diff | 4.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2014-02-13 02:08:19 | Re: Dead code or buggy code? |
Previous Message | Hiroshi Inoue | 2014-02-13 00:51:30 | Re: narwhal and PGDLLIMPORT |