X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6B703D1B1DC for ; Mon, 2 Aug 2004 20:18:14 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 70374-07 for ; Mon, 2 Aug 2004 23:18:15 +0000 (GMT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id ECCDBD1B1C8 for ; Mon, 2 Aug 2004 20:18:12 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i72NICqb077833 for ; Mon, 2 Aug 2004 23:18:12 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i72NHD7G077798 for pgsql-jdbc@postgresql.org; Mon, 2 Aug 2004 23:17:13 GMT From: "Mike Martin" X-Newsgroups: comp.databases.postgresql.interfaces.jdbc Subject: Re: Wrong column names in ResultSetMetaData Date: Mon, 2 Aug 2004 18:16:46 -0500 Organization: Vieo, Inc. Lines: 28 Message-ID: References: <41086EF8.7010101@opencloud.com> <410EC364.8090004@opencloud.com> X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 To: pgsql-jdbc@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.8 tagged_above=0.0 required=5.0 tests=PRIORITY_NO_NAME X-Spam-Level: X-Archive-Number: 200408/16 X-Sequence-Number: 10738 Oliver Jowett wrote: > > The only way to "name" a SQL query column is with AS. There's > > corroboration in DatabaseMetaData: > > > > public boolean supportsColumnAliasing() throws SQLException > > > > Retrieves whether this database supports column aliasing. > > If so, the SQL AS clause can be used to provide names for > > computed columns or to provide alias names for columns as > > required. > > > > In both cases, "names" and not "labels". > > Is an "alias name" the same as a "column name"? In SQL, yes. A result column has a name, and the AS clause is the way to reassign that name. Try this on your favorite DBMS: SELECT COL FROM (SELECT COL AS FOO FROM T) T1 It fails because the parenthesized query result has no column named COL. Mike