Thread: Last call for objections: SELECT alias without AS for IDENTs only?

Last call for objections: SELECT alias without AS for IDENTs only?

From
Tom Lane
Date:
Is anyone opposed to applying the patch shown here
http://archives.postgresql.org/pgsql-hackers/2008-02/msg00434.php
(plus appropriate docs changes etc)?  This allows AS to be omitted
in a SELECT output-column alias clause, but only if the desired
alias name lexes as an IDENT, that is, it's not any known keyword
(reserved or otherwise).  It would be nicer if it allowed any
unreserved keyword too; but per discussion, the only way that could
happen is if we made some currently unreserved keywords reserved,
which does not seem like a net improvement.

The documentation would probably have to say something like "You
can omit AS only if the desired alias name is not any known
keyword (see Appendix C).  For protection against possible future
keyword additions, it is recommended that you always either use AS
or double-quote the alias name."

On the whole this form of the patch seems like a reasonable compromise
--- it doesn't lose any existing functionality, it doesn't take much
work, and it should at least dampen complaints about our lack of spec
compliance on this point.
        regards, tom lane