Re: before insert for each row trigger on upsert - Mailing list pgsql-general

From Tom Lane
Subject Re: before insert for each row trigger on upsert
Date
Msg-id 27384.1582236718@sss.pgh.pa.us
Whole thread Raw
In response to Re: before insert for each row trigger on upsert  (Ted Toth <txtoth@gmail.com>)
List pgsql-general
Ted Toth <txtoth@gmail.com> writes:
> I think you are right in that the trigger doesn't change the row being
> updated (which is good) but it also updates another table and that's what
> I'd actually like to avoid on update.

Probably need to put that in an AFTER trigger, then.  By definition,
BEFORE triggers don't really know whether the insert is going to
happen.  This doesn't even require use of upsert to cause a problem:
a later BEFORE trigger could prevent the insertion, or change what
gets inserted.

            regards, tom lane



pgsql-general by date:

Previous
From: Roberto Della Pasqua
Date:
Subject: spectrogram index?
Next
From: "Andrus"
Date:
Subject: Re: How to fix 0xC0000005 exception in Postgres 9.0