X-Original-To: pgsql-hackers@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 40B82475F1C for ; Mon, 14 Apr 2003 13:00:26 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id EFBCA475CE5 for ; Mon, 14 Apr 2003 13:00:24 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h3EH0t2L010850; Mon, 14 Apr 2003 13:00:56 -0400 (EDT) To: Peter Eisentraut Cc: milimeter@163.com, PostgreSQL Development Subject: Re: [GENERAL] Problem about pgsql's column alias In-reply-to: References: Comments: In-reply-to Peter Eisentraut message dated "Mon, 14 Apr 2003 18:40:01 +0200" Date: Mon, 14 Apr 2003 13:00:55 -0400 Message-ID: <10849.1050339655@sss.pgh.pa.us> From: Tom Lane X-Spam-Status: No, hits=-32.3 required=5.0 tests=BAYES_00,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/438 X-Sequence-Number: 37928 Peter Eisentraut 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