pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedCaused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "merge".
2+ messages / 2 participants
[nested] [flat]
* Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "merge".
@ 2018-03-07 09:26 Vinodh NV <linktovinodh@gmail.com>
0 siblings, 1 reply; 2+ messages in thread
From: Vinodh NV @ 2018-03-07 09:26 UTC (permalink / raw)
To: pgsql-general
Sir,
I am facing the error Caused by: org.postgresql.util.PSQLException: ERROR:
syntax error at or near "merge". when I execute the below query in
postgres database. The same works fine in Oracle.
merge into net n using dual on (n.id=:id) when matched then update set
Status=:status, lastStatusDate=:lastStatusDate, errorMessage=:errorMessage,
errorDetails=:errorDetails when not matched then insert (id,Status,
lastStatusDate, errorMessage, errorDetails) values
(:id,:status,:lastStatusDate,:errorMessage,:errorDetails)";
Can you please let me know how to resolve it?
Thanks,
Vinodh.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "merge".
@ 2018-03-07 09:34 Alvaro Herrera <alvherre@2ndquadrant.com>
parent: Vinodh NV <linktovinodh@gmail.com>
0 siblings, 0 replies; 2+ messages in thread
From: Alvaro Herrera @ 2018-03-07 09:34 UTC (permalink / raw)
To: Vinodh NV <linktovinodh@gmail.com>; +Cc: pgsql-general
Vinodh NV wrote:
> Sir,
>
> I am facing the error Caused by: org.postgresql.util.PSQLException: ERROR:
> syntax error at or near "merge". when I execute the below query in
> postgres database. The same works fine in Oracle.
>
> merge into net n using dual on (n.id=:id) when matched then update set
> Status=:status, lastStatusDate=:lastStatusDate, errorMessage=:errorMessage,
> errorDetails=:errorDetails when not matched then insert (id,Status,
> lastStatusDate, errorMessage, errorDetails) values
> (:id,:status,:lastStatusDate,:errorMessage,:errorDetails)";
>
>
> Can you please let me know how to resolve it?
Easy -- just don't use merge with Postgres, as it doesn't support MERGE
yet. There's work ongoing to support it, but it will appear in Postgres
11 at the earliest.
There exists a nonstandard command INSERT ON CONFLICT DO UPDATE which
would probably be useful.
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2018-03-07 09:34 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-03-07 09:26 Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "merge". Vinodh NV <linktovinodh@gmail.com>
2018-03-07 09:34 ` Alvaro Herrera <alvherre@2ndquadrant.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox