Re: SQL MERGE patches for PostgreSQL Versions

From: Kang Yuzhe <tiggreen87(at)gmail(dot)com>
To: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
Cc: Craig Ringer <craig(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, bxzhai2010(at)gmail(dot)com
Subject: Re: SQL MERGE patches for PostgreSQL Versions
Date: 2017-06-22 16:32:14
Message-ID: CAH=t1koHwCFhrLeytk1KoHpv7w_stoK=pjUsc0XWrm0OY7PZTQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 22, 2017 at 12:10 PM, Thomas Munro
<thomas(dot)munro(at)enterprisedb(dot)com> wrote:
> On Thu, Jun 22, 2017 at 9:00 PM, Kang Yuzhe <tiggreen87(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-06-22 16:43:16 Re: lseek/read/write overhead becomes visible at scale ..
Previous Message Masahiko Sawada 2017-06-22 16:22:21 Re: pg_stop_backup(wait_for_archive := true) on standby server