Re: Correct Syntax for alter table ..add constraint

From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: Najm Hashmi <najm(at)mondo-live(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Correct Syntax for alter table ..add constraint
Date: 2001-01-19 19:30:12
Message-ID: web-1179538@davinci.ethosmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Jussi Vainionpää 2001-01-19 23:18:44 Re: Trouble with subqueries
Previous Message Najm Hashmi 2001-01-19 19:29:30 Re: Selecting Current value from a sequence