Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 1E61163284B for ; Sun, 5 Sep 2010 17:34:09 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 50259-01 for ; Sun, 5 Sep 2010 20:34:02 +0000 (UTC) X-Greylist: delayed 00:16:34.067878 by SQLgrey-1.7.6 Received: from fep32.mx.upcmail.net (fep32.mx.upcmail.net [62.179.121.50]) by mail.postgresql.org (Postfix) with ESMTP id 68ED0631153 for ; Sun, 5 Sep 2010 17:34:00 -0300 (ADT) Received: from edge01.upcmail.net ([192.168.13.236]) by viefep19-int.chello.at (InterMail vM.8.01.02.02 201-2260-120-106-20100312) with ESMTP id <20100905201724.JGON17503.viefep19-int.chello.at@edge01.upcmail.net> for ; Sun, 5 Sep 2010 22:17:24 +0200 Received: from [127.0.0.1] ([80.108.59.233]) by edge01.upcmail.net with edge id 38HP1f00451vgU0018HQup; Sun, 05 Sep 2010 22:17:24 +0200 X-SourceIP: 80.108.59.233 Message-ID: <4C83FAD2.6050906@chello.at> Date: Sun, 05 Sep 2010 22:17:22 +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: problem with foreign key Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Cloudmark-Analysis: v=1.1 cv=V15LrGZDFsIOLQGhFSBQucROxfiwgIeIJ7AmZ+xKGd4= c=1 sm=0 a=8nJEP1OIZ-IA:10 a=eQ4iKXiFSUjRhYlE6jEA:9 a=lqzjZ4L0kXSphbaXuLUA:7 a=tdd4dcwYL7-fHccNR-1S9GyGJxcA:4 a=wPNLvfGTeEIA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.001 tagged_above=-10 required=5 tests=BAYES_20=-0.001, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201009/44 X-Sequence-Number: 35588 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