Foreign Key - Mailing list pgsql-general

From Bob Pawley
Subject Foreign Key
Date
Msg-id DD4E2D20E9D14B95B31A8EA933686FC3@desktop
Whole thread Raw
Responses Re: Foreign Key
List pgsql-general
Hi
 
I don't understand what the following error means.
 
I am trying to add a foreign key to table image, that holds column device_id. This is to be controlled by column devices_id in table devices.
 
ALTER TABLE distributors ADD CONSTRAINT distfk FOREIGN KEY (address) REFERENCES addresses (address) MATCH FULL;
 
ERROR:  insert or update on table "image" violates foreign key constraint "deviceidfk"
DETAIL:  Key (device_id)=(4022) is not present in table "devices".
 
Help appreciated.
 
Bob

pgsql-general by date:

Previous
From: Greg Smith
Date:
Subject: Re: Creating indexes?
Next
From: Tom Lane
Date:
Subject: Re: PSQL segmentation fault after setting host