Re: Problem with FOREIGN KEY

From: "D'Arcy J(dot)M(dot) Cain" <darcy(at)druid(dot)net>
To: "????? ???????? |Vadim Zhernovoi|" <vadim(dot)zhernovoi(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Problem with FOREIGN KEY
Date: 2008-04-22 16:01:42
Message-ID: 20080422120142.c87d8f04.darcy@druid.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tue, 22 Apr 2008 18:26:19 +0300
"????? ???????? |Vadim Zhernovoi|" <vadim(dot)zhernovoi(at)gmail(dot)com> 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?

--
D'Arcy J.M. Cain <darcy(at)druid(dot)net> | 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.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tarlika Elisabeth Schmitz 2008-04-22 21:25:04 extracting words
Previous Message Erik Jones 2008-04-22 15:37:33 Re: Problem with FOREIGN KEY