Re: Merge statement

Поиск
Список
Период
Сортировка
От George Neuner
Тема Re: Merge statement
Дата
Msg-id 7a6db92e-0ddc-89e8-7f7e-dae04ddad6bd@comcast.net
обсуждение исходный текст
Ответ на Merge statement  (Pepe TD Vo <pepevo@yahoo.com>)
Ответы Re: Merge statement  (Pepe TD Vo <pepevo@yahoo.com>)
Список pgsql-admin
On Mon, 23 Sep 2019 15:48:06 +0000 (UTC), Pepe TD Vo <pepevo@yahoo.com> wrote:

>Yes, I heard  MERGE is not a command in Postgres but the others said
>merge statement added stored procedures in version 11
>
>I upgraded my postgresql from 10.6 to 11.1. in AWS, still not work.
>thank you,
>Bach-Nga

You misunderstood.

Postrgesql added stored procedures in version 11.  Unlike stored functions (which PG has had forever), stored procedures allow transactions within their code. This is similar to the stored procedures in Oracle and it helps with Oracle -> Postgresql conversions.

However, Postgresql does NOT and never did have a MERGE command.  The "documentation" page you discovered was just a proposal for an implementation that never happened.

Postgresql can detect conflicts on INSERT and perform an UPDATE instead (see  https://www.postgresql.org/docs/current/sql-insert.html).  This is not exactly the same as Oracle's MERGE so you'll have to study it carefully to make you understand the nuances and be sure it works as intended in your application ... but it is the closest you can get using Postgresql.

George

В списке pgsql-admin по дате отправления:

Предыдущее
От: Pepe TD Vo
Дата:
Сообщение: Re: Merge statement
Следующее
От: Pepe TD Vo
Дата:
Сообщение: Re: Merge statement