Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iCnt2-00023p-1h for pgsql-admin@arkaria.postgresql.org; Tue, 24 Sep 2019 16:42:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iCnt0-0005Je-Ub for pgsql-admin@arkaria.postgresql.org; Tue, 24 Sep 2019 16:41:58 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iCnt0-0005JH-AQ for pgsql-admin@lists.postgresql.org; Tue, 24 Sep 2019 16:41:58 +0000 Received: from sonic308-2.consmr.mail.bf2.yahoo.com ([74.6.130.41]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iCnsw-0001U4-Tk for pgsql-admin@postgresql.org; Tue, 24 Sep 2019 16:41:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1569343312; bh=uTMsXBIyWqipPQr88NFTs+F/cRTV8w0+i/oquJLHzMw=; h=Date:From:Reply-To:To:In-Reply-To:References:Subject:From:Subject; b=GB6j7TnaVE17XiZN1cT8Tw16ScOSeYHOuapzYQKDBKWBbAQgwojE3V5kfsn/4Vb7u5cu4YdTj3sbh5iT0InEnamWXx5sWgcs7euRlhkOaI3QpLbi8bfcXIpDqiVbIUkcbbbZOAfBoytSWlUhEGtoLvs8NEhzzV34LJcFclnria6TAQ8RHfhlgw6mhbSsenuwiLG8zd9TbGySy1jaLEk+XAyPmQL2WNELDthqe6E5ceHdtRleqW1wFYanuW12RRfciyPd1FfpmiERaZkzPbEumCeL0mMNvoMVWpezDJaWhkLgX99supp6bMk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d6_NGbQWf4IZQGs8srJdj3s2 6fd1QC9GncYQbmyC_pmUDcAmW_rNAhO4g.DZDXyoC62TLLpHkaIXD_RamUs0V_.f9JzhA67bteMn GfmuX1UqqRBONTyKjk3_NR8F7dACAQtMkpqogP3KqHWkGcPKhXdSA_jXejtmBTRREdPXj6GRJuVQ K6pDrcHBsGyaEtZeGWJ10det.DnetXjM5nvy7ku34Rb62AWeHnk.yueaJycrDt8AfpTurdr2pSaK 54Fx0HZtdld1PIm8vNRY7K7.653X6qn04eF7wjx_Lb6SKkZ8L06hfaFBz.6We9A0lkQ-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic308.consmr.mail.bf2.yahoo.com with HTTP; Tue, 24 Sep 2019 16:41:52 +0000 Date: Tue, 24 Sep 2019 16:41:51 +0000 (UTC) From: Pepe TD Vo Reply-To: Pepe TD Vo To: pgsql-admin@postgresql.org, George Neuner Message-ID: <141967203.8168663.1569343311063@mail.yahoo.com> In-Reply-To: <7a6db92e-0ddc-89e8-7f7e-dae04ddad6bd@comcast.net> References: <7a6db92e-0ddc-89e8-7f7e-dae04ddad6bd@comcast.net> Subject: Re: Merge statement MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_8168662_801322028.1569343311061" X-Mailer: WebService/1.1.14303 YMailNorrin Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36 Content-Length: 7477 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------=_Part_8168662_801322028.1569343311061 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thank you for clarification. I perform "insert" a new row into a table is the union is not matched and "= update" the row when it matched, the script compilation fine. thank you all again. Bach-Nga No one in this world is pure and perfect.=C2=A0 If you avoid people for the= ir mistakes you will be alone. So judge less, love and forgive more.To call= him a dog hardly seems to do him justice though in as much as he had four = legs, a tail, and barked, I admit he was, to all outward appearances. But t= o those who knew him well, he was a perfect gentleman (Hermione Gingold) **Live simply **Love generously **Care deeply **Speak kindly.*** Genuinely = rich *** Faithful talent *** Sharing success=20 On Tuesday, September 24, 2019, 12:32:20 PM EDT, George Neuner wrote: =20 =20 On Mon, 23 Sep 2019 15:48:06 +0000 (UTC), Pepe TD Vo = wrote: =20 >Yes, I heard =C2=A0MERGE is not a command in Postgres=C2=A0but the others= said >merge statement=C2=A0added stored procedures in version 11 > >I upgraded my postgresql from 10.6 to 11.1. in AWS, still not work. >thank you, >Bach-Nga =20 You misunderstood. =20 Postrgesql added stored procedures in version 11.=C2=A0 Unlike stored func= tions (which PG has had forever), stored procedures allow transactions with= in their code. This is similar to the stored procedures in Oracle and it he= lps with Oracle -> Postgresql conversions. =20 However, Postgresql does NOT and never did have a MERGE command.=C2=A0 The= "documentation" page you discovered was just a proposal for an implementat= ion that never happened. =20 Postgresql can detect conflicts on INSERT and perform an UPDATE instead (s= ee=C2=A0 https://www.postgresql.org/docs/current/sql-insert.html).=C2=A0 Th= is is not exactly the same as Oracle's MERGE so you'll have to study it car= efully 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. =20 George =20 ------=_Part_8168662_801322028.1569343311061 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thank you for clarification.

I perform "insert" a new row into a table is the union is not matched = and "update" the row when it matched, the script compilation fine.

thank you all again.


<= /font>
Bach-Nga

No one in this world is pure and perfec= t.  If you avoid people for their mistakes you will be alone. So judge= less, love and forgive more.
To call hi= m a dog hardly seems to do him justice though in as much as he had four leg= s, a tail, and barked, I admit he was, to all outward appearances. But to t= hose who knew him well, he was a perfect gentleman (Hermione Gingold)

**Live simply *= *Love generously **Care deeply **Speak kindly.
*** Genuinely rich *** Faithful talent *** Sharing success


=20
=20
On Tuesday, September 24, 2019, 12:32:20 PM EDT, George= Neuner <gneuner2@comcast.net> wrote:


=20 =20 =20
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 <= i>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
------=_Part_8168662_801322028.1569343311061--