Re: problem with foreign key - Mailing list pgsql-admin

From Bèrto ëd Sèra
Subject Re: problem with foreign key
Date
Msg-id AANLkTimWR_6BOw8yN7f71chEm86QrVDfvPeQT_RCsH=0@mail.gmail.com
Whole thread Raw
In response to problem with foreign key  (Ljubomir Erdeljan <ljubomir.erdeljan@chello.at>)
Responses Re: problem with foreign key
List pgsql-admin
An immediate question: did you check that Key (docuuserid)=(8415) is actually present in table "trade"?

Bèrto

On 5 September 2010 23:17, Ljubomir Erdeljan <ljubomir.erdeljan@chello.at> wrote:
 hi group,

trying to create foreign key:

ALTER TABLE porder1 ADD CONSTRAINT order_exist
FOREIGN KEY (docuuserid) REFERENCES trade(tradeid) ON DELETE RESTRICT;

column docuuserid is integer in porder1
column tradeid    is serial  in trade and belong to primary key (single column)

getting In EMS PostgreSQL
ERROR:  insert or update on table "porder1" violates foreign key constraint "order_exist"
DETAIL: Key (docuuserid)=(8415) is not present in table "trade".

In PostgreSQL  Code Factory
SQL Error: ERROR:  insert or update on table "porder1" violates foreign key constraint "order_exist"
DETAIL:    Key (docuuserid)=(8415) is not present in table "trade".

postgresql 8.4.4-1 on windows 7 ultimate 64 bit standard installation

I'm not able to figure out what should be a problem.



kindly regards

ljubomir erdeljan

--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



--
==============================
Constitution du 24 juin 1793 - Article 35. - Quand le gouvernement viole les droits du peuple, l'insurrection est, pour le peuple et pour chaque portion du peuple, le plus sacré des droits et le plus indispensable des devoirs.

pgsql-admin by date:

Previous
From: Szymon Guz
Date:
Subject: Re: problem with foreign key
Next
From: Ljubomir Erdeljan
Date:
Subject: Re: problem with foreign key