pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: raf <raf@raf.org>
Cc: pgsql-general@postgresql.org
Subject: Re: update returning order by syntax error question
Date: Thu, 12 Sep 2019 10:38:15 -0400
Message-ID: <19619.1568299095@sss.pgh.pa.us> (raw)
In-Reply-To: <94b68d28-9cab-b640-3693-477f029991ff@aklaver.com>
References: <20190912031743.jfbfj7e5ri5is36t@raf.org>
	<13632.1568295845@sss.pgh.pa.us>
	<94b68d28-9cab-b640-3693-477f029991ff@aklaver.com>

Adrian Klaver <adrian.klaver@aklaver.com> writes:
> On 9/12/19 6:44 AM, Tom Lane wrote:
>> No, it's *exactly* as if that.  UPDATE is an unreserved
>> keyword so it's fully legitimate as a table name.

> I am not following.

Sure, the WITH thing works too.  The point is that given
"SELECT ... FROM (UPDATE ...)", there is a workable parse
path where UPDATE is treated as a table name.  So if you
try to put an UPDATE command there, the syntax error
isn't thrown till a couple tokens later, where the
table-name syntax no longer matches.  The OP's question
was about why the error was thrown where it was, not about
how to do this correctly.

			regards, tom lane





view thread (5+ messages)

Message-ID: <19619.1568299095@sss.pgh.pa.us>
Permalink:  ../19619.1568299095@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/19619.1568299095@sss.pgh.pa.us

 · 

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-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, adrian.klaver@aklaver.com, raf@raf.org
  Subject: Re: update returning order by syntax error question
  In-Reply-To: <19619.1568299095@sss.pgh.pa.us>
  References: <20190912031743.jfbfj7e5ri5is36t@raf.org> <13632.1568295845@sss.pgh.pa.us> <94b68d28-9cab-b640-3693-477f029991ff@aklaver.com> <19619.1568299095@sss.pgh.pa.us>

* 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