TheBestOfMe
Programmer
Hi, I want to make have a foreign key on a integer column ta a serial column (the same thing as we can do in Access).
When I execute my file, the following error occurs:
ERROR: UNIQUE constraint matching given keys for referenced table "auberges" not found.
Here is an example:
create table Auberges
(
no_proprio varchar(8),
no_auberge serial,
PRIMARY KEY (no_proprio, no_auberge),
FOREIGN KEY (no_proprio) REFERENCES Proprietaires(no_proprio)
);
create table Auberges_Images
(
no_auberge int,
no_image serial,
lien_image varchar(100),
PRIMARY KEY (no_auberge, no_image),
FOREIGN KEY (no_auberge) REFERENCES Auberges(no_auberge)
);
Thanks.
When I execute my file, the following error occurs:
ERROR: UNIQUE constraint matching given keys for referenced table "auberges" not found.
Here is an example:
create table Auberges
(
no_proprio varchar(8),
no_auberge serial,
PRIMARY KEY (no_proprio, no_auberge),
FOREIGN KEY (no_proprio) REFERENCES Proprietaires(no_proprio)
);
create table Auberges_Images
(
no_auberge int,
no_image serial,
lien_image varchar(100),
PRIMARY KEY (no_auberge, no_image),
FOREIGN KEY (no_auberge) REFERENCES Auberges(no_auberge)
);
Thanks.