Re: Correct Syntax for alter table ..add constraint

From: Najm Hashmi <najm(at)mondo-live(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Correct Syntax for alter table ..add constraint
Date: 2001-01-20 19:50:00
Message-ID: 3A69EBE8.D309714D@mondo-live.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Josh Berkus wrote:

> 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

HI Josh,
All values in age column of are null..... I have no value there......
and I have specified to accetp nulls i.e. I dont have constraint not
null on this particular column...
Najm

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Jan Wieck 2001-01-20 22:13:27 Re: unreferenced primary keys: garbage collection
Previous Message Najm Hashmi 2001-01-20 18:49:04 Correct Syntax for alter table ..add constraint