Re: insert on conflict postgres returning distinction - Mailing list pgsql-general

From Adrian Klaver
Subject Re: insert on conflict postgres returning distinction
Date
Msg-id 8723a4ce-ee04-a52a-1ac7-eb4226b52712@aklaver.com
Whole thread Raw
In response to insert on conflict postgres returning distinction  (pinker <pinker@onet.eu>)
Responses Re: insert on conflict postgres returning distinction  (pinker <pinker@onet.eu>)
Re: insert on conflict postgres returning distinction  (pinker <pinker@onet.eu>)
List 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.klaver@aklaver.com



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Postgres automatic minor version upgrade
Next
From: pinker
Date:
Subject: Re: insert on conflict postgres returning distinction