Re: INSERT ... ON CONFLICT UPDATE/IGNORE 4.0

From: Andres Freund <andres(at)anarazel(dot)de>
To: Peter Geoghegan <pg(at)heroku(dot)com>
Cc: hlinnaka <hlinnaka(at)iki(dot)fi>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: INSERT ... ON CONFLICT UPDATE/IGNORE 4.0
Date: 2015-05-01 13:58:00
Message-ID: 20150501135800.GC22649@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-hackers

On 2015-04-26 18:02:06 -0700, Peter Geoghegan wrote:
> Remaining challenges
> =================

So I did the executor changes I'd mentioned downthread, and Peter agreed
that it'd quite workable.

Right now this, besides cleanup, docs and syntax leaves only one real
issue I know of. Which is the question what EXCLUDED actually refers to.

Consider a table
blarg(key int primary key, data text); with a BEFORE INSERT
trigger that modifies 'data'. For the statement

INSERT INTO blarg(key, data) VALUES(1, 'whatever')
ON CONFLICT (key) DO UPDATE SET data = EXCLUDED.data;

would you rather have EXCLUDED.data refer to the tuple version from
VALUES (or a SELECT or ...) or to version from the BEFORE trigger?

To me it seems better to have it refer to version *not* affected by the
trigger (which will be called either way). I think it'd be slightly
easier to understand and more flexible. But I could live with either
decision.

This isn't a technical problem, we just have to decide what we want to
do.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Robert Haas 2015-05-01 14:06:42 Re: INSERT ... ON CONFLICT UPDATE/IGNORE 4.0
Previous Message Peter Geoghegan 2015-05-01 06:09:04 Re: INSERT ... ON CONFLICT UPDATE/IGNORE 4.0

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2015-05-01 14:01:45 Re: procost for to_tsvector
Previous Message Robert Haas 2015-05-01 13:57:28 Re: initdb -S and tablespaces