pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Ted Toth <txtoth@gmail.com>
To: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: before insert for each row trigger on upsert
Date: Thu, 20 Feb 2020 12:32:09 -0800
Message-ID: <18def70d-c2c4-ff92-b488-243ed0287001@aklaver.com> (raw)
In-Reply-To: <CAFPpqQH+6_mbJV2f5Nzm21Bg-G9GU_b91irDg+==y=6aMKgjVw@mail.gmail.com>
References: <CAFPpqQH+6_mbJV2f5Nzm21Bg-G9GU_b91irDg+==y=6aMKgjVw@mail.gmail.com>

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.

> 
> Ted


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (5+ messages)  latest in thread

Message-ID: <18def70d-c2c4-ff92-b488-243ed0287001@aklaver.com>
Permalink:  ../18def70d-c2c4-ff92-b488-243ed0287001@aklaver.com/
Also on:    postgresql.org/message-id/18def70d-c2c4-ff92-b488-243ed0287001@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, txtoth@gmail.com
  Subject: Re: before insert for each row trigger on upsert
  In-Reply-To: <18def70d-c2c4-ff92-b488-243ed0287001@aklaver.com>
  References: <CAFPpqQH+6_mbJV2f5Nzm21Bg-G9GU_b91irDg+==y=6aMKgjVw@mail.gmail.com> <18def70d-c2c4-ff92-b488-243ed0287001@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