Re: [HACKERS] MERGE SQL Statement for PG11 - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: [HACKERS] MERGE SQL Statement for PG11
Date
Msg-id CANP8+jK3e=bHM0sWwcHKCaMOyubt3nMv9Mgxxgvkff1smOp7ZA@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] MERGE SQL Statement for PG11  (Peter Geoghegan <pg@bowt.ie>)
List pgsql-hackers
On 1 February 2018 at 19:39, Peter Geoghegan <pg@bowt.ie> wrote:

> Finally, I noticed a problem with your new EXPLAIN ANALYZE instrumentation:
>
> Is it 4 rows inserted, or 0 inserted?
>
> postgres=# merge into testoids a using (select i "key", 'foo' "data"
> from generate_series(0,3) i) b on a.key = b.key when matched and 1=0
> then update set data = b.data when not matched then insert (key, data)
> values (b.key, 'foo');
> MERGE 0

Got it. I'm reporting the number of rows processed instead of the
number of rows inserted. My test happened to have those values set
equal.

Minor bug, thanks for spotting.

-- 
Simon Riggs                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: [HACKERS] MERGE SQL Statement for PG11
Next
From: Peter Geoghegan
Date:
Subject: Re: [HACKERS] MERGE SQL Statement for PG11