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

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Hiroshi Saito <z-saito(at)guitar(dot)ocn(dot)ne(dot)jp>
Cc: Gregory Stark <stark(at)enterprisedb(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: "AS" by the syntax of table reference.(8.4 proposal)
Date: 2008-02-09 01:11:04
Message-ID: 47ACFDA8.9080902@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hiroshi Saito wrote:
> Sorry, I'm sleeping.
> Thanks Gregory-san. and, Tom-san.
>
>> 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.
>
> Ah yes, {a,b}_expr is very difficult.....Then, I am asking for
> compromise.
> at the "c_expr", case after the patch..
> postgres=# select a+b from n;
> ?column?
> ----------
> 5
> (1 row)
>
> postgres=# select a+b AS "FIELD" from n;
> FIELD
> -------
> 5
> (1 row)
>
> postgres=# select a+b "FIELD" from n;
> ERROR: syntax error at or near ""FIELD""
> LINE 1: select a+b "FIELD" from n;
> ^
> postgres=# select (a+b) "FIELD" from n;
> FIELD
> -------
> 5
> (1 row)
>
>

How the heck are we going to document this reasonably? It strikes me as
horribly complicated and puzzling for users. The current rule might be
an annoyance in porting applications, but it has the advantage of
simplicity. If we can somehow make AS optional across the board, then
well and good, otherwise I am very dubious about making any change.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hiroshi Saito 2008-02-09 01:21:11 Re: "AS" by the syntax of table reference.(8.4 proposal)
Previous Message Hiroshi Saito 2008-02-09 01:10:51 Re: "AS" by the syntax of table reference.(8.4 proposal)