Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i8POO-0002aH-DN for pgsql-general@arkaria.postgresql.org; Thu, 12 Sep 2019 13:44:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i8PON-0001go-1i for pgsql-general@arkaria.postgresql.org; Thu, 12 Sep 2019 13:44:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i8POM-0001gd-OL for pgsql-general@lists.postgresql.org; Thu, 12 Sep 2019 13:44:10 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i8POK-0005QW-Jl for pgsql-general@postgresql.org; Thu, 12 Sep 2019 13:44:10 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x8CDi5K2013633; Thu, 12 Sep 2019 09:44:05 -0400 From: Tom Lane To: raf cc: pgsql-general@postgresql.org Subject: Re: update returning order by syntax error question In-reply-to: <20190912031743.jfbfj7e5ri5is36t@raf.org> References: <20190912031743.jfbfj7e5ri5is36t@raf.org> Comments: In-reply-to raf message dated "Thu, 12 Sep 2019 13:17:43 +1000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <13631.1568295845.1@sss.pgh.pa.us> Date: Thu, 12 Sep 2019 09:44:05 -0400 Message-ID: <13632.1568295845@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk raf writes: > It's almost as if the parser sees "update" as a possible > table name (rather than a reserved word) and "tblname" > as the alias for that table and it's expecting a comma > or left/right/full etc. when it seess the "t". No, it's *exactly* as if that. UPDATE is an unreserved keyword so it's fully legitimate as a table name. If you made the syntax be what the grammar is expecting: regression=# select * from (update t cross join update t2); ERROR: relation "update" does not exist LINE 1: select * from (update t cross join update t2); ^ regards, tom lane