Re: Correct Syntax for alter table ..add constraint - Mailing list pgsql-sql

From Josh Berkus
Subject Re: Correct Syntax for alter table ..add constraint
Date
Msg-id web-1179538@davinci.ethosmedia.com
Whole thread Raw
In response to Correct Syntax for alter table ..add constraint  (Najm Hashmi <najm@mondo-live.com>)
List pgsql-sql
Najm,

> 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

Simple ... you have values in the AGE column that are not in
the age_list table.  Thus you're in violation of the foriegn
key you're trying to establish.

-Josh Berkus


pgsql-sql by date:

Previous
From: Najm Hashmi
Date:
Subject: Correct Syntax for alter table ..add constraint
Next
From: Najm Hashmi
Date:
Subject: Re: Correct Syntax for alter table ..add constraint