Skip site navigation (1) Skip section navigation (2)

Re: "AS" by the syntax of table reference.(8.4 proposal)

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Hiroshi Saito" <z-saito(at)guitar(dot)ocn(dot)ne(dot)jp>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: "AS" by the syntax of table reference.(8.4 proposal)
Date: 2008-02-09 11:13:09
Message-ID: 87hcgil6wq.fsf@oxford.xeocode.com (view raw or flat)
Thread:
Lists: pgsql-hackers
"Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> Gregory Stark <stark(at)enterprisedb(dot)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's PostgreSQL training!

In response to

Responses

pgsql-hackers by date

Next:From: Andrew DunstanDate: 2008-02-09 12:52:03
Subject: Re: PostgreSQL 8.4 development plan
Previous:From: Magnus HaganderDate: 2008-02-09 10:59:26
Subject: Re: PostgreSQL 8.4 development plan

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group