Re: [HACKERS] SQL MERGE patches for PostgreSQL Versions - Mailing list pgsql-hackers

From Kang Yuzhe
Subject Re: [HACKERS] SQL MERGE patches for PostgreSQL Versions
Date
Msg-id CAH=t1koHwCFhrLeytk1KoHpv7w_stoK=pjUsc0XWrm0OY7PZTQ@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] SQL MERGE patches for PostgreSQL Versions  (Thomas Munro <thomas.munro@enterprisedb.com>)
Responses Re: [HACKERS] SQL MERGE patches for PostgreSQL Versions  (Jan de Visser <jan@de-visser.net>)
List pgsql-hackers
On Thu, Jun 22, 2017 at 12:10 PM, Thomas Munro
<thomas.munro@enterprisedb.com> wrote:
> On Thu, Jun 22, 2017 at 9:00 PM, Kang Yuzhe <tiggreen87@gmail.com> wrote:
>> I just downloaded the patch from GSoC site.
>
> I just looked at
> https://wiki.postgresql.org/wiki/Add_MERGE_command_GSoC_2010 and saw
> that the file https://wiki.postgresql.org/wiki/File:Merge_v201.tar was
> uploaded on 24 Aug 2010.  So I picked a random commit from that date,
> git checkout 005e427a22e3bb7fa01a84a7b476a3d6359a0344, and then I was
> able to apply that patch with patch -p1 < merge_v201.patch without any
> failures.

Thanks so much Thomas! I have managed to apply without any failures by
following your approach.
Here is a sample what I did after applying the patch.

testdb=# BEGIN;
BEGIN
testdb=#
testdb=# MERGE INTO Stock USING Buy ON Stock.item_id = Buy.item_id
testdb-#  WHEN MATCHED THEN UPDATE SET balance = balance + Buy.volume
testdb-#  WHEN NOT MATCHED THEN DO NOTHING;
MERGE 1
testdb=# SELECT * FROM Stock;item_id | balance
---------+---------     20 |    1900     10 |    3200
(2 rows)

testdb=# ROLLBACK;
ROLLBACK

I think and believe that though it may be tedious to do so, it is the
style Thomas followed to help me that hackers should do to help
newbies so that they can pursue their ambition.

I am humbled to say that I didn't know how to search git commits by a
specific day like what Thomas did.

Regards,
Zeray



pgsql-hackers by date:

Previous
From: Masahiko Sawada
Date:
Subject: Re: [HACKERS] pg_stop_backup(wait_for_archive := true) on standby server
Next
From: Robert Haas
Date:
Subject: Re: [HACKERS] lseek/read/write overhead becomes visible at scale ..