Re: insert on conflict postgres returning distinction

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: pinker <pinker(at)onet(dot)eu>, pgsql-general(at)postgresql(dot)org
Subject: Re: insert on conflict postgres returning distinction
Date: 2020-08-12 16:01:06
Message-ID: 8723a4ce-ee04-a52a-1ac7-eb4226b52712@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 8/12/20 7:23 AM, pinker wrote:
> is there any way to distinct between updated and inserted rows in RETURNING
> clause when ON CONFLICT UPDATE was used?

Do you want to use that information immediately in the query or store it
somewhere? If the first case I don't think that is possible. For the
second then, I haven't tried it but, maybe a trigger using transition
tables per example here:

https://www.postgresql.org/docs/12/plpgsql-trigger.html

Example 42.7. Auditing with Transition Tables

>
>
>
> --
> Sent from: https://www.postgresql-archive.org/PostgreSQL-general-f1843780.html
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message pinker 2020-08-12 16:24:44 Re: insert on conflict postgres returning distinction
Previous Message Adrian Klaver 2020-08-12 14:26:07 Re: Postgres automatic minor version upgrade