Thread: Problems with DatabaseMetaData.getImportedKeys

Problems with DatabaseMetaData.getImportedKeys

From
Carlos Correia
Date:
Hi,

When I try to run the program DatabaseTest.java (see attach) with the
db-test database (see attach: db-test.sql) I get duplicated tuples for
each foreign key:

<Database.getKeyInfo> for table: table_1
>>> Imported keys

>>> Exported keys:


  1: c2
  from table_1  to   table_2.t2_f2

  1: c1
  from table_1  to   table_2.t2_f1

  1: c2
  from table_1  to   table_2.t2_f2

  1: c1
  from table_1  to   table_2.t2_f1

<Database.getKeyInfo> for table: table_2
>>> Imported keys


  1: c2
  from table_1  to   table_2.t2_f2

  1: c1
  from table_1  to   table_2.t2_f1

  1: c2
  from table_1  to   table_2.t2_f2

  1: c1
  from table_1  to   table_2.t2_f1
>>> Exported keys:

Is there any way of avoiding these duplicated tuples?

I'm running PostgreSQL version 7.3.2 (Mandrake 9.1) with pg73jdbc3.jar
driver.

Thanks,

carlos
CREATE TABLE table_1 (
    t1_f1 integer NOT NULL,
    t1_f2 character(20) NOT NULL
);


CREATE TABLE table_2 (
    t2_f1 integer NOT NULL,
    t2_f2 integer NOT NULL
);

ALTER TABLE table_1
        ADD CONSTRAINT pk1 PRIMARY KEY (t1_f1);

ALTER TABLE table_2
        ADD CONSTRAINT pk2 PRIMARY KEY (t2_f1);

ALTER TABLE table_2
    ADD CONSTRAINT c1
        FOREIGN KEY (t2_f1)
        REFERENCES table_1(t1_f1);

ALTER TABLE ONLY table_2
    ADD CONSTRAINT c2
        FOREIGN KEY (t2_f2)
        REFERENCES table_1(t1_f1);


Attachment

Re: Problems with DatabaseMetaData.getImportedKeys

From
Kris Jurka
Date:

On 6 Feb 2004, Carlos Correia wrote:

> Hi,
>
> When I try to run the program DatabaseTest.java (see attach) with the
> db-test database (see attach: db-test.sql) I get duplicated tuples for
> each foreign key:
>
> I'm running PostgreSQL version 7.3.2 (Mandrake 9.1) with pg73jdbc3.jar
> driver.
>

This was fixed at some point.  I think this was fixed somewhere is in the
7.3 series, but your jar file name is not enough to tell us the build
number you are using.  Try upgrading to the latest 7.3 or 7.4 jar file
available here: http://jdbc.postgresql.org/download.html

Kris Jurka


Re: Problems with DatabaseMetaData.getImportedKeys

From
Carlos Correia
Date:
A Sex, 2004-02-06 às 14:07, Kris Jurka escreveu:
> On 6 Feb 2004, Carlos Correia wrote:
>
> > Hi,
> >
> > When I try to run the program DatabaseTest.java (see attach) with the
> > db-test database (see attach: db-test.sql) I get duplicated tuples for
> > each foreign key:
> >
> > I'm running PostgreSQL version 7.3.2 (Mandrake 9.1) with pg73jdbc3.jar
> > driver.
> >
>
> This was fixed at some point.  I think this was fixed somewhere is in the
> 7.3 series, but your jar file name is not enough to tell us the build
> number you are using.  Try upgrading to the latest 7.3 or 7.4 jar file
> available here: http://jdbc.postgresql.org/download.html
>
> Kris Jurka
>

Thank you sooo much! It fixed the problem ;-)

carlos