From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Ted Toth <txtoth@gmail.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: before insert for each row trigger on upsert
Date: Thu, 20 Feb 2020 13:43:09 -0800
Message-ID: <d5c16b2d-1e84-249b-d9e5-e4e2221020a1@aklaver.com> (raw)
In-Reply-To: <CAFPpqQHvynSRr4HX_a5tkqOBDat4zEk0a_fS+WPiJBLk8Uc_3A@mail.gmail.com>
References: <CAFPpqQH+6_mbJV2f5Nzm21Bg-G9GU_b91irDg+==y=6aMKgjVw@mail.gmail.com>
<18def70d-c2c4-ff92-b488-243ed0287001@aklaver.com>
<CAFPpqQHvynSRr4HX_a5tkqOBDat4zEk0a_fS+WPiJBLk8Uc_3A@mail.gmail.com>
On 2/20/20 1:03 PM, Ted Toth wrote:
>
>
> On Thu, Feb 20, 2020 at 2:32 PM Adrian Klaver <adrian.klaver@aklaver.com
> <mailto:adrian.klaver@aklaver.com>> wrote:
>
> On 2/20/20 12:17 PM, Ted Toth wrote:
> > I'm a little confused why the before insert trigger fires al all but
> > since it does isĀ there a way to know that an update will occur?
>
> Because ON CONFLICT DO UPDATE is part of an INSERT command.
>
> > Basically I don't want the trigger affect the row on update.
>
> Not sure that a BEFORE trigger will work for that anyway as it will not
> have submitted the data yet for ON CONFLICT resolution.
>
>
> 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.
Hard to say what to do without knowing what the trigger function
actually does?
>
>
> >
> > Ted
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
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, txtoth@gmail.com
Subject: Re: before insert for each row trigger on upsert
In-Reply-To: <d5c16b2d-1e84-249b-d9e5-e4e2221020a1@aklaver.com>
References: <CAFPpqQH+6_mbJV2f5Nzm21Bg-G9GU_b91irDg+==y=6aMKgjVw@mail.gmail.com> <18def70d-c2c4-ff92-b488-243ed0287001@aklaver.com> <CAFPpqQHvynSRr4HX_a5tkqOBDat4zEk0a_fS+WPiJBLk8Uc_3A@mail.gmail.com> <d5c16b2d-1e84-249b-d9e5-e4e2221020a1@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