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);