pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Shaozhong SHI <shishaozhong@gmail.com>
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: Merge into does not work
Date: Fri, 26 Nov 2021 12:51:00 -0800
Message-ID: <33716356-dcf4-41fa-d053-058997bb652b@aklaver.com> (raw)
In-Reply-To: <202111262010.ceg5ebzus4f5@alvherre.pgsql>
References: <202111262010.ceg5ebzus4f5@alvherre.pgsql>

On 11/26/21 12:10, Alvaro Herrera wrote:
> On 2021-Nov-26, Adrian Klaver wrote:
> 
>> On 11/26/21 11:44, Alvaro Herrera wrote:
>>> On 2021-Nov-26, Shaozhong SHI wrote:
>>>
>>> I am using the MERGE patch I posted here[1], on top of Postgres 15.
>>>
>>> https://postgr.es/m/202111152245.byerxxac444d@alvherre.pgsql
>>
>> A patch that as AFAIK is not even committed to what is at best an alpha
>> version would in my opinion not qualify as ready much less supported. I look
>> forward to seeing it make it in, but I would hardly recommend it for general
>> use.
> 
> All true.  I'm recruiting testers.

Which is great, that was not how it was presented though:

'It does work for me ...'

The issue being there are already folks that come across:

https://wiki.postgresql.org/wiki/SQL_MERGE

https://wiki.postgresql.org/wiki/SQL_MERGE_Patch_Status

and do a partial read on the pages and leap to the conclusion the MERGE 
exists in Postgres.

I fully expect people to see:

"
It does work for me:

55479 15devel 680346=# MERGE INTO Stock USING Buy ON Stock.item_id = 
Buy.item_id
  WHEN MATCHED THEN UPDATE SET balance = balance + Buy.volume
  WHEN NOT MATCHED THEN INSERT VALUES (Buy.item_id, Buy.volume);
MERGE 2
Duración: 3,879 ms
55479 15devel 680346=# select * from stock;
  item_id │ balance
─────────┼─────────
       20 │    1900
       10 │    3200
       30 │     300
(3 filas)
"

quit reading and then ask why MERGE does not exist in their instance?

My two cents worth.




-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (7+ messages)

Message-ID: <33716356-dcf4-41fa-d053-058997bb652b@aklaver.com>
Permalink:  ../33716356-dcf4-41fa-d053-058997bb652b@aklaver.com/
Also on:    postgresql.org/message-id/33716356-dcf4-41fa-d053-058997bb652b@aklaver.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, alvherre@alvh.no-ip.org, shishaozhong@gmail.com
  Subject: Re: Merge into does not work
  In-Reply-To: <33716356-dcf4-41fa-d053-058997bb652b@aklaver.com>
  References: <202111262010.ceg5ebzus4f5@alvherre.pgsql> <33716356-dcf4-41fa-d053-058997bb652b@aklaver.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