| From: | Peter Royal <proyal(at)pace2020(dot)com> | 
|---|---|
| To: | pgsql-jdbc(at)postgresql(dot)org | 
| Subject: | DatabaseMetaData.getImportedKeys returning duplicate rows | 
| Date: | 2003-03-04 02:27:09 | 
| Message-ID: | CCE26486-4DE8-11D7-A64B-000393B61B56@pace2020.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-jdbc | 
I am having a problem with the DatabaseMetaData.getImportedKeys() 
function. I am asking for the keys with respect to a specific table. 
All is fine, except when I have two columns in a table that are both 
foreign keys to another table, ie:
Table A            Table B
-------            -------
   col1  -----------pk
   col2  -----------/
The ResultSet returned from getImportedKeys is structured:
col1
col2
col1
col2
If I execute the query that is generated behind the scenes in the psql 
command-line program, adding the DISTINCT keyword to the query causes 
it to return the proper number of rows. Is that a valid fix, or will 
that break something else? Should the duplicate-reduction be done 
inside the java code that creates the ResultSet? I have no problem 
making the fix, I just don't know enough about the jdbc internals (nor 
postgres itself, I'm a new user) to be confident enough to know exactly 
*what* to fix.
Anyways great work thus far, I look forward to helping improve the 
driver!
-pete
-- 
peter royal -> proyal(at)pace2020(dot)com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Daniel Bruce Lynes | 2003-03-04 06:53:00 | Re: I can't insert the chinese words. | 
| Previous Message | Dirk Bromberg | 2003-03-03 21:24:39 | Postgres PooledConnection... |