Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 1DDA063284B for ; Sun, 5 Sep 2010 17:49:45 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 11742-09 for ; Sun, 5 Sep 2010 20:49:36 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from fep12.mx.upcmail.net (fep12.mx.upcmail.net [62.179.121.32]) by mail.postgresql.org (Postfix) with ESMTP id 1656263283C for ; Sun, 5 Sep 2010 17:49:36 -0300 (ADT) Received: from edge05.upcmail.net ([192.168.13.212]) by viefep12-int.chello.at (InterMail vM.8.01.02.02 201-2260-120-106-20100312) with ESMTP id <20100905204934.WSZU8780.viefep12-int.chello.at@edge05.upcmail.net> for ; Sun, 5 Sep 2010 22:49:34 +0200 Received: from [127.0.0.1] ([80.108.59.233]) by edge05.upcmail.net with edge id 38pZ1f01i51vgU0058pafJ; Sun, 05 Sep 2010 22:49:34 +0200 X-SourceIP: 80.108.59.233 Message-ID: <4C84025C.1060606@chello.at> Date: Sun, 05 Sep 2010 22:49:32 +0200 From: Ljubomir Erdeljan User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.8) Gecko/20100802 Lightning/1.0b2 Thunderbird/3.1.2 ThunderBrowse/3.3.2 MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: Re: problem with foreign key References: <4C83FAD2.6050906@chello.at> In-Reply-To: Content-Type: multipart/alternative; boundary="------------090001080707010209000102" X-Cloudmark-Analysis: v=1.1 cv=Q5sYvte7CdFO72xZDcMRKl084a5I42uXcYDcqm+r+xQ= c=1 sm=0 a=b8wv9dMSGFEA:10 a=epTmVMiNAAAA:8 a=b367Ydf1NxnhItupz8AA:9 a=6YQMOZ_vJZKjH9oPAUYA:7 a=DILSZLUMP3FKELPIYPtkN2FJGdgA:4 a=QEXdDO2ut3YA:10 a=YObXiYvaVLwA:10 a=pGLkceISAAAA:8 a=-6uL1QNPtsVhFeLMIXQA:9 a=dWqvMqvy-rgc2AiX-3cA:7 a=_rPAN6taD-v5C-BEltcgXfS5OeQA:4 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=-10 required=5 tests=BAYES_40=-0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201009/47 X-Sequence-Number: 35591 This is a multi-part message in MIME format. --------------090001080707010209000102 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit This relate to different column names docuuserid is column in porder1 but relate to tradeid in trade. Thank you, On 05/09/2010 22:40, Bèrto ëd Sèra wrote: > 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 > > 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. --------------090001080707010209000102 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit This relate to different column names
docuuserid is column in porder1 but relate to tradeid in trade.

Thank you,

On 05/09/2010 22:40, Bèrto ëd Sèra wrote:
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.

--------------090001080707010209000102--