Re: INSERT ... ON CONFLICT {UPDATE | IGNORE}

From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: Peter Geoghegan <pg(at)heroku(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Josh Berkus <josh(at)agliodbs(dot)com>, Kevin Grittner <kgrittn(at)ymail(dot)com>, Andres Freund <andres(at)2ndquadrant(dot)com>, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Craig Ringer <craig(at)2ndquadrant(dot)com>
Subject: Re: INSERT ... ON CONFLICT {UPDATE | IGNORE}
Date: 2014-10-09 07:38:01
Message-ID: CA+U5nMK8VbiSoxw6YQ14XLvF1e9YMkj0m2FM2Gy_P-h8DjCwfw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 9 October 2014 07:27, Peter Geoghegan <pg(at)heroku(dot)com> wrote:

> Please be more specific.

Do not use CONFLICTING() which looks like it is a function.

Instead, use a row qualifier, such as NEW, OLD etc to reference values
from the incoming data
e.g. CONFLICTING.value rather than CONFLICTING(value)

Do not use the word CONFLICTING since it isn't clear whether you are
referring to the row in the table or the value in the incoming data. I
suggest the use of two separately named row qualifiers to allow us to
use either of those when desired. I don't have suggestions as to what
you should call those qualifiers, though Postgres already uses NEW and
OLD in similar circumstances in triggers. (This has nothing at all to
do with the MERGE command in the SQL standard, so please don't mention
that here.)

You may also wish to support the AS keyword, as MERGE does to make the
above even more clear.

e.g. SET col = EXISTING.col + NEW.col

Thank you.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2014-10-09 08:09:28 Re: BUG: *FF WALs under 9.2 (WAS: .ready files appearing on slaves)
Previous Message Connor Wolf 2014-10-09 07:09:58 Understanding and implementing a GiST Index