Re: INSERT ... ON CONFLICT syntax issues

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Geoghegan <pg(at)heroku(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Subject: Re: INSERT ... ON CONFLICT syntax issues
Date: 2015-05-07 13:15:18
Message-ID: 554B6566.70206@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 05/07/2015 12:01 AM, Andres Freund wrote:
> 6. The tablename and EXCLUDED? Possibility with the ability to specify
> an AS for INSERT INTO foo AS whatever?

If we don't allow "AS whatever", and you create a table called
"excluded", you're stuck with the ambiguity in the DO UPDATE statement
as you can't alias either one. So we have to add support for "INSERT
INTO foo AS whatever", if we go with <tablename> and EXCLUDED.

Does anyone see a problem with "INSERT INTO foo AS whatever"? It seems
pretty straightforward to implement.

If we don't use <tablename> and go back to TARGET/EXCLUDED or whatever
we call them, they must only be visible to the UPDATE statement, not
RETURNING. Otherwise we're back to square one.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2015-05-07 13:19:52 Re: Re: [BUGS] BUG #11805: Missing SetServiceStatus call during service shutdown in pg_ctl (Windows only)
Previous Message Sawada Masahiko 2015-05-07 12:05:55 Proposal : REINDEX xxx VERBOSE