pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: j.random.programmer <javadesigner@yahoo.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: Bug in metadata.getColumns()/ORDINAL_POSITION
Date: Sat, 17 Feb 2007 11:17:41 -0800 (PST)
Message-ID: <616596.40210.qm@web32005.mail.mud.yahoo.com> (raw)

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.

For for example:

test=# create table foo(x int, y varchar(5));

At this point, the jdbc metadata (md) method:

md.getColumns(
 catalogname, schemaname, tablename, "%");

returns the correct ORDINAL_POSITION for x and y.

x -- >1
y ---> 2

Now, let's do this:

test=# alter table foo add z text;
ALTER TABLE
test=# alter table foo drop z;
ALTER TABLE
test=# alter table foo drop y;
ALTER TABLE
test=# alter table foo add a varchar(10);


md.getColumns(
 catalogname, schemaname, tablename, "%");

now returns
x --> 1
a --> 4

and that's the bug right there. 

Should be

a  ---> 2  (NOT 4)

since there are only 2 columsn in the database 
at this point.


Maybe the database is not updating the system tables
properly when columns are altered/dropped ? Or is
this something in the driver ?

Either way, this totally breaks any O/R mapping tool.

Best regards,

-j




 
____________________________________________________________________________________
TV dinner still cooling? 
Check out "Tonight's Picks" on Yahoo! TV.
http://tv.yahoo.com/



view thread (5+ messages)  latest in thread

Message-ID: <616596.40210.qm@web32005.mail.mud.yahoo.com>
Permalink:  ../616596.40210.qm@web32005.mail.mud.yahoo.com/
Also on:    postgresql.org/message-id/616596.40210.qm@web32005.mail.mud.yahoo.com

 · 

reply

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: javadesigner@yahoo.com
  Subject: Re: Bug in metadata.getColumns()/ORDINAL_POSITION
  In-Reply-To: <616596.40210.qm@web32005.mail.mud.yahoo.com>
  References: <616596.40210.qm@web32005.mail.mud.yahoo.com>

* 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