Re: [GENERAL] Problem about pgsql's column alias - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [GENERAL] Problem about pgsql's column alias
Date
Msg-id 10849.1050339655@sss.pgh.pa.us
Whole thread Raw
In response to Re: [GENERAL] Problem about pgsql's column alias  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: [GENERAL] Problem about pgsql's column alias
Re: [GENERAL] Problem about pgsql's column alias
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> Tom Lane writes:
>> AS is not optional in Postgres, and will never be so unless we choose to
>> drop support for postfix operators, which I consider an unlikely choice.

> Well, we could drop the support for postfix operators in aliasing clauses
> that omit the AS.

I think it would be a bad idea in any case; it would mask errors too
easily.  For example, you meant to say "SELECT a + b, ..." but wrote
"SELECT a b, ...".  Or how about this:SELECT 'foo'::character varying
Is "varying" an alias or part of the type name?

We've recently seen at least one comparable case where someone
unintentionally wrote what looked to the parser like a FROM-clause
alias, and was mystified at the behavior (I forget the details, but it
was just a week or two back).  Omitting AS in FROM-clauses is tolerable
because the possible syntax in that area is fairly restricted, but I
think the spec authors were just plain foolish to allow it in the SELECT
targetlist.
        regards, tom lane



pgsql-hackers by date:

Previous
From: "John Gray"
Date:
Subject: Re: How do you execute a postgresql function from perl?
Next
From: Joe Conway
Date:
Subject: undefined reference to `is_absolute_path'