From: Kris Jurka <books@ejurka.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: j.random.programmer <javadesigner@yahoo.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Bug in metadata.getColumns()/ORDINAL_POSITION
Date: Tue, 8 Dec 2009 20:12:08 -0500 (EST)
Message-ID: <alpine.BSO.2.00.0912082008230.5801@leary.csoft.net> (raw)
In-Reply-To: <23750.1171742505@sss.pgh.pa.us>
References: <616596.40210.qm@web32005.mail.mud.yahoo.com>
<23750.1171742505@sss.pgh.pa.us>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: books@ejurka.com, tgl@sss.pgh.pa.us, javadesigner@yahoo.com
Subject: Re: Bug in metadata.getColumns()/ORDINAL_POSITION
In-Reply-To: <alpine.BSO.2.00.0912082008230.5801@leary.csoft.net>
References: <616596.40210.qm@web32005.mail.mud.yahoo.com> <23750.1171742505@sss.pgh.pa.us> <alpine.BSO.2.00.0912082008230.5801@leary.csoft.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox