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 DD5CCD1B181 for ; Mon, 2 Aug 2004 19:14:23 -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 47498-04 for ; Mon, 2 Aug 2004 22:14:19 +0000 (GMT) Received: from mail63.csoft.net (leary3.csoft.net [63.111.22.74]) by svr1.postgresql.org (Postfix) with SMTP id 5EAD8D1B229 for ; Mon, 2 Aug 2004 19:13:53 -0300 (ADT) Received: (qmail 1707 invoked by uid 1112); 2 Aug 2004 22:13:56 -0000 Date: Mon, 2 Aug 2004 17:13:56 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Mike Martin Cc: pgsql-jdbc@postgresql.org Subject: Re: Wrong column names in ResultSetMetaData In-Reply-To: Message-ID: References: <41086EF8.7010101@opencloud.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.3 tagged_above=0.0 required=5.0 tests=UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200408/13 X-Sequence-Number: 10735 On Mon, 2 Aug 2004, Mike Martin wrote: > SELECT PRICE AS ORIG_PRICE, PRICE + 1.00 AS PRICE FROM T > > getColumnName(1) getColumnName(2) > DB/driver getColumnLabel(1) getColumnLabel(2) > > Cloudscape ORIG_PRICE ORIG_PRICE PRICE PRICE > Firebird ORIG_PRICE ORIG_PRICE PRICE PRICE > SQL Server (JTDS) ORIG_PRICE ORIG_PRICE PRICE PRICE > SQL Server (MS) ORIG_PRICE ORIG_PRICE PRICE PRICE > MySQL Connector/J ORIG_PRICE ORIG_PRICE PRICE PRICE > Oracle thin ORIG_PRICE ORIG_PRICE PRICE PRICE > PostgreSQL 7.4 orig_price orig_price price price > PostgreSQL 7.5 price orig_price price "" I think you have the name and column for 2 backwards. It should return "" for the column name because it is a derived column, so there is no underlying table column to return. This shows the results are different, but it doesn't indicate why. Is it simply because the other dbs can't implement getColumnName as we have? I certainly wouldn't expect this to be a common feature. Further it doesn't show that users can't write portable code using the ResultSetMetaData calls. It shows all drivers returning the same value for getColumnLabel that you would expect. Earlier you had speculated that other drivers would return something different for this, but you haven't shown that. Yes it may break existing code, but it doesn't show that they weren't simply using the wrong call. Kris Jurka