Received: from lin.local.lan ([216.221.221.2]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f0JJiT046540 for ; Fri, 19 Jan 2001 14:44:29 -0500 (EST) (envelope-from najm@mondo-live.com) Received: from mondo-live.com (IDENT:najm@ll20.local2.lan [192.168.2.20]) by lin.local.lan (8.9.3/8.8.7) with ESMTP id SAA09554; Fri, 19 Jan 2001 18:38:39 GMT Message-ID: <3A69EBE8.D309714D@mondo-live.com> Date: Sat, 20 Jan 2001 14:50:00 -0500 From: Najm Hashmi X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.2.14-5.0 i686) X-Accept-Language: en MIME-Version: 1.0 To: Josh Berkus CC: pgsql-sql@postgresql.org Subject: Re: Correct Syntax for alter table ..add constraint References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200101/266 X-Sequence-Number: 935 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: 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