Re: Wrong column names in ResultSetMetaData

From: Kris Jurka <books(at)ejurka(dot)com>
To: Mike Martin <mmartin(at)vieo(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Wrong column names in ResultSetMetaData
Date: 2004-08-02 22:13:56
Message-ID: Pine.BSO.4.56.0408021705100.21355@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2004-08-02 22:42:44 Re: Wrong column names in ResultSetMetaData
Previous Message Mike Martin 2004-08-02 21:24:08 Re: Wrong column names in ResultSetMetaData