Received: from localhost (unknown [200.46.204.184]) by developer.postgresql.org (Postfix) with ESMTP id A4EC42E00B9 for ; Tue, 22 Apr 2008 13:01:49 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 77006-07-2 for ; Tue, 22 Apr 2008 13:01:44 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from smaug.vex.net (smaug.vex.net [208.76.104.132]) by developer.postgresql.org (Postfix) with ESMTP id E6FAF2E00B7 for ; Tue, 22 Apr 2008 13:01:44 -0300 (ADT) Received: from dilbert (dilbert.druid.net [207.35.13.14]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smaug.vex.net (Postfix) with ESMTP id C71CC17BA3; Tue, 22 Apr 2008 12:01:41 -0400 (EDT) Date: Tue, 22 Apr 2008 12:01:42 -0400 From: "D'Arcy J.M. Cain" To: =?ISO-8859-1?Q?"=3F=3F=3F=3F=3F_=3F=3F=3F=3F=3F=3F=3F=3F_|Vadim_Zherno?= =?ISO-8859-1?Q?voi|"?= Cc: pgsql-sql@postgresql.org Subject: Re: Problem with FOREIGN KEY Message-Id: <20080422120142.c87d8f04.darcy@druid.net> In-Reply-To: <509ab3740804220826l685baaa3x1bd9cc4bd2a08f1@mail.gmail.com> References: <509ab3740804220826l685baaa3x1bd9cc4bd2a08f1@mail.gmail.com> X-Mailer: Sylpheed 2.4.8 (GTK+ 2.12.9; i386--netbsdelf) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200804/144 X-Sequence-Number: 30683 On Tue, 22 Apr 2008 18:26:19 +0300 "????? ???????? |Vadim Zhernovoi|" wrote: > I have a Problem with Foreign key query...i've posted the code on > http://pgsl.privatepaste.com/e44p3Orqiq, so it have syntax higlight. > Please, need help! That message is not telling you the the referenced table doesn't have the field. It is saying that the referenced table does not have a matching row for one or more rows in the table being checked. In other words it is checking your existing data exactly the same as it will check new data that you insert. Your database is already violating the rule that you are trying to enforce with the new constraint. Also, I am pretty sure that you do not want the constraint FK1_SecurityRolePermission that you created on SecurityRole. What do you think that will accomplish? --=20 D'Arcy J.M. Cain | Democracy is three wolves http://www.druid.net/darcy/ | and a sheep voting on +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.