Re: psql should show disabled internal triggers - Mailing list pgsql-hackers
From | Fabrízio de Royes Mello |
---|---|
Subject | Re: psql should show disabled internal triggers |
Date | |
Msg-id | CAFcNs+qp9khOsON8tUDiOo7Je9xbsXKoS2u=+Ati7wbpZBEK0A@mail.gmail.com Whole thread Raw |
In response to | Re: psql should show disabled internal triggers (Bruce Momjian <bruce@momjian.us>) |
List | pgsql-hackers |
<div dir="ltr"><div class="gmail_extra"><br />On Thu, Feb 13, 2014 at 12:04 AM, Bruce Momjian <<a href="mailto:bruce@momjian.us">bruce@momjian.us</a>>wrote:<br />><br />> On Thu, Nov 21, 2013 at 11:59:51PM -0200,Fabrízio de Royes Mello wrote:<br /> > > On Fri, Oct 25, 2013 at 3:37 PM, fabriziomello <<a href="mailto:fabriziomello@gmail.com">fabriziomello@gmail.com</a>>wrote:<br />> > ><br />> > > On 2013-09-1815:15:55 +0200, Bernd Helmle wrote:<br /> > > > > On 2013-09-18 15:15:55 +0200, Bernd Helmle wrote:<br/>> > > > > --On 18. September 2013 13:52:29 +0200 Andres Freund<br />> > > > > <andres@>wrote:<br />> > > > ><br /> > > > > > >If you do ALTER TABLE ...DISABLE TRIGGER ALL; and then individually<br />> > > > > >re-enable the disabled triggers it's easyto miss internal triggers.<br />> > > > > >A \d+ tablename will not show anything out of the ordinaryfor that<br /> > > > > > >situation since we don't show internal triggers. But foreign key checks<br/>> > > > > >won't work.<br />> > > > > >So, how about displaying disabled internaltriggers in psql?<br /> > > > > ><br />> > > > > Hi had exactly the same concerns thismorning while starting to look at<br />> > > > the<br />> > > > > ENABLE/DISABLE constraintpatch. However, i wouldn't display them as<br /> > > > > > triggers, but maybe more generally as"disabled constraints" or such.<br />> > > ><br />> > > > Well, that will lead the user in thewrong direction, won't it? They<br /> > > > > haven't disabled the constraint but the trigger. Especiallyas we<br />> > > > already have NOT VALID and might grow DISABLED for constraint<br />> > >> themselves...<br />> > > ><br /> > > ><br />> > > Hi,<br />> > ><br />>> > The attached patch [1] enable PSQL to list internal disabled triggers in \d<br />> > > only in versions>= 9.0.<br />> > ><br />> > > [1] psql-display-all-triggers-v1.patch<br /> > > > <<a href="http://postgresql.1045698.n5.nabble.com/file/n5775954/">http://postgresql.1045698.n5.nabble.com/file/n5775954/</a><br />>> psql-display-all-triggers-v1.patch><br />><br />> As others, I am concerned about people being confusedwhen funny-looking<br /> > trigger names suddenly appearing when you disable all table triggers.<br />><br/>> What I ended up doing is to create a user and internal section when<br />> displaying disabled triggers:<br/>><br />> Disabled user triggers:<br /> > check_update BEFORE UPDATE ON ordersFOR EACH ROW EXECUTE PROCEDURE trigf()<br />> Disabled internal triggers:<br />> "RI_ConstraintTrigger_c_16409"AFTER INSERT ON orders FROM customer NOT DEF ...<br /> > "RI_ConstraintTrigger_c_16410"AFTER UPDATE ON orders FROM customer NOT DEF ...<br />><br />> I kept the "Triggers"section unchanged, showing only user triggers. I<br />> also updated the code to handle 8.3+ servers.<br />><br />> Patch attached.<br />><br /><br /></div><div class="gmail_extra">Makes more sense than my previous patch...<br/></div><div class="gmail_extra"><br /></div><div class="gmail_extra">The code looks fine to me!!<br /><br /></div><divclass="gmail_extra">Regards,<br /></div><div class="gmail_extra"><br />--<br />Fabrízio de Royes Mello<br />Consultoria/CoachingPostgreSQL<br />>> Timbira: <a href="http://www.timbira.com.br">http://www.timbira.com.br</a><br/> >> Blog sobre TI: <a href="http://fabriziomello.blogspot.com">http://fabriziomello.blogspot.com</a><br/>>> Perfil Linkedin: <a href="http://br.linkedin.com/in/fabriziomello">http://br.linkedin.com/in/fabriziomello</a><br/> >> Twitter: <a href="http://twitter.com/fabriziomello">http://twitter.com/fabriziomello</a></div></div>
pgsql-hackers by date: