From: | Peter Geoghegan <pg(at)heroku(dot)com> |
---|---|
To: | Anssi Kääriäinen <anssi(dot)kaariainen(at)thl(dot)fi> |
Cc: | Simon Riggs <simon(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, 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-11-20 21:42:15 |
Message-ID: | CAM3SWZSXcppN2DqvZu5517-J82UqtYc+tsD3JBa7K_4=kkWgnQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Nov 19, 2014 at 10:37 PM, Anssi Kääriäinen
<anssi(dot)kaariainen(at)thl(dot)fi> wrote:
> I think the biggest problem with the current approach is that there is
> no way to know if a row was skipped by the where clause when using
> INSERT ON CONFLICT UPDATE ... WHERE.
Well, there could have always been an UPDATE in a trigger or something
like that.
> I am a developer of the Django ORM. Django reports to the user whether a
> row was inserted or updated. It is possible to know which rows were
> inserted by returning the primary key value. If something is returned,
> then it was an insert. If Django implements updated vs inserted checking
> this way, then if PostgreSQL adds RETURNING for update case later on,
> that would be a breaking change for Django.
How does that actually work at the moment? Do you use RETURNING, or
look at the command tag? Would you be happy to just know that certain
rows were either inserted or updated in the context of an UPSERT (and
not cancelled by a BEFORE ROW INSERT or UPDATE trigger returning
NULL), or do you want to specifically know if there was an insert or
an update in respect of each row/slot processed?
--
Peter Geoghegan
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2014-11-20 21:45:52 | Re: group locking: incomplete patch, just for discussion |
Previous Message | Josh Berkus | 2014-11-20 21:21:28 | Re: pg_multixact not getting truncated |