Re: merge statement gives error

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: merge statement gives error
Date: 2018-02-26 15:22:09
Message-ID: a209d716-1699-8ab1-765d-3efc274a458e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Abhra Kar schrieb am 26.02.2018 um 16:02:
> Hi,
>
>        Trying to execute the following statement ---- 
>
>
> merge into ABC as n using dual on (n.id <http://n.id>=123)
>
> when matched update set aaa=222, bbb=333
>
>  when not matched insert (id, aaa) values (NEXTVAL(id),555);
>
>
>
> but gives syntax error.What should be the proper syntax[ Parameter values are properly passed based on data type].

There is no MERGE statement in Postgres (there might be in Postgres 11, but not currently).

You will need to use INSERT ON CONFLICT instead.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message geoff hoffman 2018-02-26 15:43:07 Re: Creating complex track changes database - challenge!
Previous Message Tom Kazimiers 2018-02-26 15:18:07 Re: Unexpected behavior with transition tables in update statement trigger