Re: "AS" by the syntax of table reference.(8.4 proposal) - Mailing list pgsql-hackers

From Gregory Stark
Subject Re: "AS" by the syntax of table reference.(8.4 proposal)
Date
Msg-id 87hcgil6wq.fsf@oxford.xeocode.com
Whole thread Raw
In response to Re: "AS" by the syntax of table reference.(8.4 proposal)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: "AS" by the syntax of table reference.(8.4 proposal)
List pgsql-hackers
"Tom Lane" <tgl@sss.pgh.pa.us> writes:

> Gregory Stark <stark@enterprisedb.com> writes:
>> But yeah, c_expr isn't enough. We really need {a,b}_expr sans postfix
>> expressions.
>
> How's that going to help?  As long as postfix operators exist at all,
>
>     SELECT a + b, ...
>
> is going to be ambiguous, and no amount of grammar magic changes that.
> We could force the parser into using one interpretation or the other,
> but it would still be wrong for some folks.

Sure, just like a + + b is ambiguous. We define an arbitrary choice and tell
people to put parentheses if they want the other. It's not too hard to write

SELECT (a +) b, ...

if you want an alias. Besides, nobody uses postfix expressions anyways. It
would be a pain if it worked the other way and you had to write (a + b) all
the time.

--  Gregory Stark EnterpriseDB          http://www.enterprisedb.com Get trained by Bruce Momjian - ask me about
EnterpriseDB'sPostgreSQL training!
 


pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: PostgreSQL 8.4 development plan
Next
From: Andrew Dunstan
Date:
Subject: Re: PostgreSQL 8.4 development plan