ordering of results returned from DatabaseMetaData.getImportedKeys() - Mailing list pgsql-jdbc

From peter royal
Subject ordering of results returned from DatabaseMetaData.getImportedKeys()
Date
Msg-id 8FDC583A-3BD4-11D8-B3DF-000393B61B56@pace2020.com
Whole thread Raw
Responses Re: ordering of results returned from DatabaseMetaData.getImportedKeys()
List pgsql-jdbc
Here's the situation:

I have a table that has multiple foreign keys to another table, and the
key is a composite key (ie multiple fields).

The results returned from DatabaseMetaData.getImportedKeys() seem
"wrong" in that all the KEY_SEQ 1's are returned first and then all the
2's

The results are:

FK_TABLE_NAME FK_COLUMN_NAME PK_TABLE_NAME  PK_COLUMM_NAME KEY_SEQ
------------------------------------------------------------------
  glsetup      acct1loc        glaccount      gllocnum       1
  glsetup      acct2loc        glaccount      gllocnum       1
  glsetup      acct3loc        glaccount      gllocnum       1
  glsetup      acct1num        glaccount      glmasterid     2
  glsetup      acct2num        glaccount      glmasterid     2
  glsetup      acct3num        glaccount      glmasterid     2

but i would expect something more like:

FK_TABLE_NAME FK_COLUMN_NAME PK_TABLE_NAME  PK_COLUMM_NAME KEY_SEQ
------------------------------------------------------------------
  glsetup      acct1loc        glaccount      gllocnum       1
  glsetup      acct1num        glaccount      glmasterid     2
  glsetup      acct2loc        glaccount      gllocnum       1
  glsetup      acct2num        glaccount      glmasterid     2
  glsetup      acct3loc        glaccount      gllocnum       1
  glsetup      acct3num        glaccount      glmasterid     2

its a simple fix in AbstractJdbc1DatabaseMetaData, I'm just unsure of
whether or not its a valid fix according to the JDBC3 documentation.

This is *ONLY* an issue when you have more than one multi-column FK to
the same table.

So my question is, should the JDBC driver be patched to return what I
expect, or should I modify my code to accommodate what the driver is
returning?
-pete


pgsql-jdbc by date:

Previous
From: Dave Cramer
Date:
Subject: Re: odd jdbc driver synchronization issue
Next
From: "George Lessmann"
Date:
Subject: Re: odd jdbc driver synchronization issue