Re: Bug in metadata.getColumns()/ORDINAL_POSITION - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: Bug in metadata.getColumns()/ORDINAL_POSITION
Date
Msg-id alpine.BSO.2.00.0912082008230.5801@leary.csoft.net
Whole thread Raw
In response to Re: Bug in metadata.getColumns()/ORDINAL_POSITION  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-jdbc

On Sat, 17 Feb 2007, Tom Lane wrote:

> "j.random.programmer" <javadesigner@yahoo.com> writes:
>> This is a quick followup to my earlier post. Upon
>> further
>> testing, this bug reliably and reproducably happens
>> when an "alter table" command is used on the database.
>
> So the problem is that it's returning pg_attribute.attnum without any
> consideration for earlier dropped columns.  Not sure how expensive it'd
> be to get the current logical column number, though --- at a minimum one
> would have to select all the table's pg_attribute rows :-(
>

I've fixed this in CVS when running against 8.4 and later servers by using
the row_number window function as was suggested elsewhere:

http://archives.postgresql.org/pgsql-general/2009-11/msg01067.php

Kris Jurka


pgsql-jdbc by date:

Previous
From: Thomas Kellerer
Date:
Subject: Re: Version information inside the driver's jar file
Next
From: Craig Ringer
Date:
Subject: Anyone want a couple of listen/notify helper classes?