pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Judy Loomis <hoodie.judy@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Cascade Trigger Not Firing
Date: Sat, 14 Sep 2019 07:27:12 -0700
Message-ID: <583b352c-f22a-e5b6-3ddc-40e298267b4d@aklaver.com> (raw)
In-Reply-To: <CADoG1K2hvHUQZzkfFSWnVzLOnnn0fcj9Woy7J=U0ZeJ9HuRjGg@mail.gmail.com>
References: <CADoG1K1zHEQJh8xgpy3kYMXLc8X8W6md2WafJkFPcp-CsWYsng@mail.gmail.com>
	<21219.1568401729@sss.pgh.pa.us>
	<CADoG1K1=ZsK-NoYxrWiHwhPv1uMiynLzN1x1Hb8CUb6CeZ_idw@mail.gmail.com>
	<20933.1568408581@sss.pgh.pa.us>
	<CADoG1K2hvHUQZzkfFSWnVzLOnnn0fcj9Woy7J=U0ZeJ9HuRjGg@mail.gmail.com>

On 9/13/19 8:07 PM, Judy Loomis wrote:
> At the very least that note about this behavior should be highlighted, 
> probably on the Trigger Behavior page and not buried in a bunch of notes 
> on the Create Trigger page.

I know this after the fact. Still, as a general rule the best place to 
start when learning about a command is on it's respective page under here:

https://www.postgresql.org/docs/11/sql-commands.html

Further I usually go to the Notes after reading the synopsis, as Notes 
is where the exceptions to the rules and gotchas are called out.

> 
> 
> 
> On Fri, Sep 13, 2019 at 4:03 PM Tom Lane <tgl@sss.pgh.pa.us 
> <mailto:tgl@sss.pgh.pa.us>> wrote:
> 
>     Judy Loomis <hoodie.judy@gmail.com <mailto:hoodie.judy@gmail.com>>
>     writes:
>      > I'm going to have to really look at all my BEFORE UPDATE triggers
>     and make
>      > sure we're not missing any more.
>      > And I have to stop telling management that a trigger means we
>     always know
>      > when a value changes.
> 
>     Well, you can rely on that, just not like this.  Use an AFTER trigger
>     (else, you can't be sure it fires after all the BEFORE triggers)
>     and instead of triggering it with a column parameter, have it do
>     something like "if old.col is distinct from new.col".
> 
>     Yeah, it's a bit slower that way, but there's no free lunch,
>     especially if you don't trust your other triggers.  (Although,
>     if you have so many triggers that that's a problem, I think you
>     might have some other design issues.)
> 
>                              regards, tom lane
> 
> 
> 
> -- 
> 
> ----------------------------------------------------------
> *Judy Loomis*
> 469.235.5839


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (9+ messages)  latest in thread

Message-ID: <583b352c-f22a-e5b6-3ddc-40e298267b4d@aklaver.com>
Permalink:  ../583b352c-f22a-e5b6-3ddc-40e298267b4d@aklaver.com/
Also on:    postgresql.org/message-id/583b352c-f22a-e5b6-3ddc-40e298267b4d@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, hoodie.judy@gmail.com, tgl@sss.pgh.pa.us
  Subject: Re: Cascade Trigger Not Firing
  In-Reply-To: <583b352c-f22a-e5b6-3ddc-40e298267b4d@aklaver.com>
  References: <CADoG1K1zHEQJh8xgpy3kYMXLc8X8W6md2WafJkFPcp-CsWYsng@mail.gmail.com> <21219.1568401729@sss.pgh.pa.us> <CADoG1K1=ZsK-NoYxrWiHwhPv1uMiynLzN1x1Hb8CUb6CeZ_idw@mail.gmail.com> <20933.1568408581@sss.pgh.pa.us> <CADoG1K2hvHUQZzkfFSWnVzLOnnn0fcj9Woy7J=U0ZeJ9HuRjGg@mail.gmail.com> <583b352c-f22a-e5b6-3ddc-40e298267b4d@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox