Re: "reverse" (?) UPSERT -- how to ?

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: "reverse" (?) UPSERT -- how to ?
Date: 2024-02-17 16:55:57
Message-ID: 1afec5a0-6a5c-428e-b84f-96b0b8777a8d@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adam Fletcher 2024-02-17 17:06:45 Re: Accessing parameters of a prepared query inside an FDW
Previous Message Greg Sabino Mullane 2024-02-17 16:54:05 Re: "reverse" (?) UPSERT -- how to ?