pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Pepe TD Vo <pepevo@yahoo.com>
To: pgsql-admin@postgresql.org, George Neuner <gneuner2@comcast.net>
Subject: Re: Merge statement
Date: Tue, 24 Sep 2019 16:41:51 +0000 (UTC)
Message-ID: <141967203.8168663.1569343311063@mail.yahoo.com> (raw)
In-Reply-To: <7a6db92e-0ddc-89e8-7f7e-dae04ddad6bd@comcast.net>
References: <7a6db92e-0ddc-89e8-7f7e-dae04ddad6bd@comcast.net>

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.  If you avoid people for their 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 to 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 

    On Tuesday, September 24, 2019, 12:32:20 PM EDT, George Neuner <gneuner2@comcast.net> wrote:  
 
   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   

view thread (13+ messages)

Message-ID: <141967203.8168663.1569343311063@mail.yahoo.com>
Permalink:  ../141967203.8168663.1569343311063@mail.yahoo.com/
Also on:    postgresql.org/message-id/141967203.8168663.1569343311063@mail.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: pepevo@yahoo.com, gneuner2@comcast.net
  Subject: Re: Merge statement
  In-Reply-To: <141967203.8168663.1569343311063@mail.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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