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='INSERT' and 
then
with TG_OP='UPDATE'.
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

Reply via email to