Re: [GENERAL] Merge - Insert Select - Mailing list pgsql-general

From Peter Geoghegan
Subject Re: [GENERAL] Merge - Insert Select
Date
Msg-id CAH2-WzmqT-5F8uqSL0YELdpN7vbVXygr8i5-j4jejuUn38fM5w@mail.gmail.com
Whole thread Raw
In response to [GENERAL] Merge - Insert Select  (Susan Hurst <susan.hurst@brookhurstdata.com>)
List pgsql-general
On Fri, Oct 13, 2017 at 9:39 AM, Susan Hurst
<susan.hurst@brookhurstdata.com> wrote:
> Does postgres have a MERGE statement ala Oracle?

No.

> I have found examples online for INSERT...ON CONFLICT DO NOTHING, but all of
> those examples use VALUES statements, which is not the scenario that I have.

You can use SELECT instead of VALUES with ON CONFLICT DO NOTHING/ON
CONFLICT DO UPDATE. They don't impose any restriction on the INSERT
statement at all, unlike MERGE, which is fussy about the use of
subqueries.

-- 
Peter Geoghegan


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

pgsql-general by date:

Previous
From: Susan Hurst
Date:
Subject: [GENERAL] Merge - Insert Select
Next
From: Seamus Abshere
Date:
Subject: Re: [GENERAL] "Shared strings"-style table