pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: sergey@melekhin.me
To: pgsql-docs@postgresql.org
Subject: Notice on BEFORE triggers and INSERT .. ON CONFLICT
Date: Fri, 23 Sep 2016 04:47:15 +0000
Message-ID: <20160923044715.1507.29275@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-docs>

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/9.5/static/plpgsql-trigger.html
Description:

Before insert on update or insert trigger will fire twice when insert .. on
conflict do update does the update part. First with TG_OP=&#39;INSERT&#39; and then
with TG_OP=&#39;UPDATE&#39;.
It is not very obvious behaviour, and I think it deserves a notice in
documentation.

Here is an example:
https://gist.github.com/C-Pro/ff0000aaeee469e8f57f232de422bba0

-- 
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs


Message-ID: <20160923044715.1507.29275@wrigleys.postgresql.org>
Permalink:  ../20160923044715.1507.29275@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20160923044715.1507.29275@wrigleys.postgresql.org

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: sergey@melekhin.me
  Subject: Re: Notice on BEFORE triggers and INSERT .. ON CONFLICT
  In-Reply-To: <20160923044715.1507.29275@wrigleys.postgresql.org>

* 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