Re: "reverse" (?) UPSERT -- how to ? - Mailing list pgsql-general

From Adrian Klaver
Subject Re: "reverse" (?) UPSERT -- how to ?
Date
Msg-id 1afec5a0-6a5c-428e-b84f-96b0b8777a8d@aklaver.com
Whole thread Raw
In response to "reverse" (?) UPSERT -- how to ?  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
Responses Re: "reverse" (?) UPSERT -- how to ?
List pgsql-general
On 2/17/24 07:24, Karsten Hilbert wrote:
> Dear list members,
> 

> So, is this doable within one SQL statement (short of
> creating and running the abovementioned function in
> one go ;-) ?

Don't know what version of Postgres you are on, assuming 15+ then maybe?:

MERGE

https://www.postgresql.org/docs/current/sql-merge.html


> 
> (the real story is about medication and intake regimens /
> schedules thereof involving a whole lot more columns, of
> course, which should not be relevant to the problem though)
> 
> Thanks for taking the time to read,
> Karsten
> --
> GPG  40BE 5B0E C98E 1713 AFA6  5BC0 3BEA AC80 7D4F C89B
> 
> 

-- 
Adrian Klaver
adrian.klaver@aklaver.com




pgsql-general by date:

Previous
From: Greg Sabino Mullane
Date:
Subject: Re: "reverse" (?) UPSERT -- how to ?
Next
From: Adam Fletcher
Date:
Subject: Re: Accessing parameters of a prepared query inside an FDW