From: | TPCCUVA <TPCCUVA(at)terra(dot)es> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Embedded SQL: foreign keys. |
Date: | 2002-02-25 08:48:53 |
Message-ID: | 63f1a619fb.619fb63f1a@teleline.es |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
We have a problem with the next table declarations:
EXEC SQL CREATE TABLE table1(
p1 int4,
p2 varchar(10),
p3 varchar(20),
CONSTRAINT table1_1 PRIMARY KEY (p1)
);
EXEC SQL COMMIT;
EXEC SQL CREATE TABLE table2(
s1 int4,
s2 int4,
s3 varchar(10),
s4 varchar(20),
CONSTRAINT table2_1 PRIMARY KEY (s2, s1),
CONSTRAINT table2_2 FOREIGN KEY (S2) REFERENCES table1 (p1) DEFERRABLE
);
EXEC SQL COMMIT;
EXEC SQL CREATE TABLE table3 (
x1 int4,
x2 int4,
x3 int4,
x4 varchar(16),
CONSTRAINT table3_1 PRIMARY KEY (x3, x2, x1),
CONSTRAINT table3_2 FOREIGN KEY (x3) REFERENCES table2 (s1) DEFERRABLE
);
EXEC SQL COMMIT;
After compile, when we run the program, we obtain the next error in the
third "COMMIT";
Err code: -400
ERROR: UNIQUE constraint matching given keys for referenced table
"table2" not found.
We are using postgres 7.1.3, could you help us?
Thanks.
From | Date | Subject | |
---|---|---|---|
Next Message | Devrim GUNDUZ | 2002-02-25 08:51:18 | Re: About functions |
Previous Message | mohan ananthiah | 2002-02-25 08:31:10 | Urgnt. - problem starting postgres |