Re: Bug in metadata.getColumns()/ORDINAL_POSITION

From: Kris Jurka <books(at)ejurka(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "j(dot)random(dot)programmer" <javadesigner(at)yahoo(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Bug in metadata.getColumns()/ORDINAL_POSITION
Date: 2009-12-09 01:12:08
Message-ID: alpine.BSO.2.00.0912082008230.5801@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Sat, 17 Feb 2007, Tom Lane wrote:

> "j.random.programmer" <javadesigner(at)yahoo(dot)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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Craig Ringer 2009-12-10 04:53:10 Anyone want a couple of listen/notify helper classes?
Previous Message Thomas Kellerer 2009-12-08 09:15:22 Re: Version information inside the driver's jar file