MetaData Bug - Mailing list pgsql-jdbc

From Aslak Hellesøy
Subject MetaData Bug
Date
Msg-id KNECLDLIKOKKLBMMPCDICENMCAAA.aslak.hellesoy@netcom.no
Whole thread Raw
In response to Re: Error!  (Dave Cramer <Dave@micro-automation.net>)
List pgsql-jdbc
Hi!

I finally got PostgreSQL running on my box to verify this metadata bug
myself. (It was mentioned yesterday).

My environment:

Win2k
Cygwin Setup.exe Version 2.249.2.5
PostgreSQL 7.2.1 on i686-pc-cygwin, compiled by GCC 2.95.3-5
PostgreSQL JDBC 7.3dev (built 2002-06-23) (devpgjdbc2.jar from
http://jdbc.postgresql.org/download.html).
j2sdk1.4.0_01

The bug appears for relationships involving more than one column. See the
definition of the VV and WW tables:
http://cvs.middlegen.sourceforge.net/cgi-bin/viewcvs.cgi/middlegen/middlegen
/src/sql/relations.sql?rev=1.1&content-type=text/vnd.viewcvs-markup

A call to DatabaseMetaData.getCrossReference(...) using these two tables
returns a resultset with one row. When I ask for the PKCOLUMN_NAME column of
that resultset I get "a,b". This is obviously wrong. The correct behaviour
would be to return a resultset with two rows, returning "a" the first time
and "b" the second time.

This can be observed by following these 11 steps:

--- GET AND BUILD MIDDLEGEN ---
0) Download Jakarta Ant 1.5.
1) Download Middlegen CVS version:
http://sourceforge.net/cvs/?group_id=36044
2) cd middlegen
3) ant

--- RUN THE MIDDLEGEN SAMPLE WITH POSTGRESQL ---
4) Edit line 17 in middlegen/samples/build.xml and replace hsqldb with
postgresql (don't worry about weblogic even if you don't have it).
5) Uncomment line 11 in middlegen/samples/build.properties.
6) Edit user/password info in
middlegen/samples/config/database/postgresql.xml at lines 25 and 26.
7) Edit line 31 in middlegen/samples/log4j.properties and set the debug
level to debug in stead of warn.
8) createdb airline (create a test database).
9) ant create-database (inserts test tables VV and WW and others in the
airline test database).
10) ant

This will fire up Middlegen which will connect to the database and read the
metadata - and throw an exception because of the bug described above.

I hope this is enough info for you to fix this little bug.

Cheers,
Aslak




pgsql-jdbc by date:

Previous
From: Aslak Hellesøy
Date:
Subject: Re: MetaData Bug
Next
From: "Simon Kitching"
Date:
Subject: Re: Managing database with PostgreSQL