Re: [GENERAL] Problem about pgsql's column alias

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: milimeter(at)163(dot)com, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [GENERAL] Problem about pgsql's column alias
Date: 2003-04-14 17:00:55
Message-ID: 10849.1050339655@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-interfaces pgsql-jdbc

Peter Eisentraut <peter_e(at)gmx(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jay O'Connor 2003-04-14 17:36:39 Inserting a needed record before a select
Previous Message Peter Eisentraut 2003-04-14 16:40:01 Re: [GENERAL] Problem about pgsql's column alias

Browse pgsql-hackers by date

  From Date Subject
Next Message justin 2003-04-14 17:20:00 internal time format
Previous Message cbbrowne 2003-04-14 16:52:57 Re: No merge sort?

Browse pgsql-interfaces by date

  From Date Subject
Next Message Michiel Lange 2003-04-14 17:11:52 Re: [INTERFACES] Problem in installing the PgAdminII in Window
Previous Message Peter Eisentraut 2003-04-14 16:40:01 Re: [GENERAL] Problem about pgsql's column alias

Browse pgsql-jdbc by date

  From Date Subject
Next Message Pedro Igor Craveiro e Silva 2003-04-14 17:30:53 JDBC x accent queries
Previous Message Peter Eisentraut 2003-04-14 16:40:01 Re: [GENERAL] Problem about pgsql's column alias