Re: ResultsetMetaData.getColumnName bug?

From: Kris Jurka <books(at)ejurka(dot)com>
To: Roy Smith <roy(dot)smith(at)primetext(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: ResultsetMetaData.getColumnName bug?
Date: 2007-12-08 16:05:15
Message-ID: Pine.BSO.4.64.0712081100390.36@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Sat, 8 Dec 2007, Roy Smith wrote:

> It looks like getColumnName() is incorrectly returning the column label.
> They are normally the same, but I have a query "select add as Address" and
> resultsetmetadata.getColumnName(1) is retuning "Address" instead of "add".
>

This has been discussed before (see archives), but the simplest
explanation is that rs.getXXX(rsmd.getColumnName(1)) should work and
won't if we return the base column name. To get the result you want use
((PGResultSetMetaData)rsmd).getBaseColumnName().

Kris Jurka

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message sulfinu 2007-12-08 18:27:17 Re: JDBC driver patch for non-ASCII users
Previous Message Roy Smith 2007-12-08 14:36:00 ResultsetMetaData.getColumnName bug?