pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Marko Tiikkaja <marko@joh.to>
To: Peter Geoghegan <pg@heroku.com>
Cc: rwestlun@gmail.com, pgsql-bugs <pgsql-bugs@postgresql.org>
Subject: Re: BUG #13886: When INSERT ON CONFLICT DO UPDATE updates, it returns INSERT rather than UPDATE
Date: Mon, 25 Jan 2016 20:46:47 +0100
Message-ID: <56A67BA7.7020201@joh.to> (raw)
In-Reply-To: <CAM3SWZRs2yeYX6SFuDveUKTLZWQFm4j0ViwZRLtYvRyUvMrDNw@mail.gmail.com>
References: <20160125074806.2555.44482@wrigleys.postgresql.org>
	<56A5F246.3070300@joh.to>
	<CAM3SWZRs2yeYX6SFuDveUKTLZWQFm4j0ViwZRLtYvRyUvMrDNw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

On 2016-01-25 8:35 PM, Peter Geoghegan wrote:
> On Mon, Jan 25, 2016 at 2:00 AM, Marko Tiikkaja <marko@joh.to> wrote:
>> FWIW, I would've expected to be able to do  RETURNING excluded.foo which
>> would have been NULL in case of INSERT, and the value from the updated tuple
>> otherwise.  But that doesn't seem to work.
>
> The problem with that approach is that it makes both the target table
> and the excluded pseudo table visible from within RETURNING. If we
> were to do that, virtually every use of INSERT with both an ON
> CONFLICT DO UPDATE clause and a RETURNING clause breaks. That's
> because any unqualified column reference becomes ambiguous ("Did you
> mean target.foo or excluded.foo?").

Surely there's a way to make this work so that EXCLUDED is a special 
tuple whose fields are normally not in scope, but can be accessed 
explicitly.

But this discussion belongs to -HACKERS, as you said upthread.


.m


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (7+ messages)  latest in thread

Message-ID: <56A67BA7.7020201@joh.to>
Permalink:  ../56A67BA7.7020201@joh.to/
Also on:    postgresql.org/message-id/56A67BA7.7020201@joh.to

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: marko@joh.to, pg@heroku.com
  Subject: Re: BUG #13886: When INSERT ON CONFLICT DO UPDATE updates, it returns INSERT rather than UPDATE
  In-Reply-To: <56A67BA7.7020201@joh.to>
  References: <20160125074806.2555.44482@wrigleys.postgresql.org> <56A5F246.3070300@joh.to> <CAM3SWZRs2yeYX6SFuDveUKTLZWQFm4j0ViwZRLtYvRyUvMrDNw@mail.gmail.com> <56A67BA7.7020201@joh.to>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox