Re: Re: [COMMITTERS] pgsql: Add support for INSERT ... ON CONFLICT DO NOTHING/UPDATE.

From: Andres Freund <andres(at)anarazel(dot)de>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Geoghegan <pg(at)heroku(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Re: [COMMITTERS] pgsql: Add support for INSERT ... ON CONFLICT DO NOTHING/UPDATE.
Date: 2015-05-22 00:48:11
Message-ID: 20150522004811.GD2028@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On 2015-05-21 20:28:41 -0300, Alvaro Herrera wrote:
> That said, I'm not sure about having it be the same, either: first, I
> don't think we need to update the fe-exec.c code at all -- I mean, all
> the things I see there are very old compatibility stuff; reporting the
> OID of the just-inserted row? Seriously, who has OIDs in user tables
> anymore? Surely we wouldn't try to do that for INSERT ON CONFLICT DO
> UPDATE at all ... if anyone wants that functionality, they can use
> RETURNING, which is far saner.

The oid currently is reported for UPSERT... I agree it's not worth much,
but it seems pointless to break it for a single command.

> As for PQcmdTuples, what would a single number returned mean? Are we
> returning the sum of both inserted and updated tuples?

Yes.

> Isn't this a bit odd?

Imo it's pretty much in line with what's done with INSTEAD OF, FDWs and
such.

> If the number is useful, then perhaps we should distinguish the cases;
> and if it's not useful, why not just return zero?

There's libraries/frameworks checking if an insert succeeded by looking
at that number, and it seems like a bad idea to needlessly break those.

So I think we're good with ripping it out. Peter?

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Geoghegan 2015-05-22 00:51:57 Re: Re: [COMMITTERS] pgsql: Add support for INSERT ... ON CONFLICT DO NOTHING/UPDATE.
Previous Message Tom Lane 2015-05-22 00:42:16 pgsql: Back-patch libpq support for TLS versions beyond v1.

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Bilek 2015-05-22 00:49:39 Re: Postgres and TLSv1.2
Previous Message Tom Lane 2015-05-22 00:45:27 Re: Postgres and TLSv1.2