Hi All,
What is the correct syntax for adding a foreign key constraint from the
command line.
I am using v7.1 beta3..... I  am doing the follwoing:
                            alter table users
                            add constraint age_fk foreign key(age)
references age_list(id);
And I get the following error:
flipr=# alter table users
flipr-# add constraint age_fk foreign key(age) references age_list(id);
NOTICE:  ALTER TABLE ... ADD CONSTRAINT will create implicit trigger(s)
for FOREIGN KEY check(s)
ERROR:  <unnamed> referential integrity violation - key referenced from
users not found in age_list

I have define  attribute id as primary key of the table.......
Thanks for your help. Regards,Najm.

Reply via email to