pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Problem with FOREIGN KEY
3+ messages / 3 participants
[nested] [flat]

* Problem with FOREIGN KEY
@ 2008-04-22 15:26 Вадим Жерновой |Vadim Zhernovoi| <vadim.zhernovoi@gmail.com>
  2008-04-22 15:37 ` Re: Problem with FOREIGN KEY Erik Jones <erik@myemma.com>
  2008-04-22 16:01 ` Re: Problem with FOREIGN KEY D'Arcy J.M. Cain <darcy@druid.net>
  0 siblings, 2 replies; 3+ messages in thread

From: Вадим Жерновой |Vadim Zhernovoi| @ 2008-04-22 15:26 UTC (permalink / raw)
  To: pgsql-sql

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!

Thank you!
-- 
Vadim Zhernovoi
--



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Problem with FOREIGN KEY
  2008-04-22 15:26 Problem with FOREIGN KEY Вадим Жерновой |Vadim Zhernovoi| <vadim.zhernovoi@gmail.com>
@ 2008-04-22 15:37 ` Erik Jones <erik@myemma.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Erik Jones @ 2008-04-22 15:37 UTC (permalink / raw)
  To: Вадим Жерновой |Vadim Zhernovoi| <vadim.zhernovoi@gmail.com>; +Cc: pgsql-sql


On Apr 22, 2008, at 10:26 AM, Вадим Жерновой |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!

What that's telling you is that there is data in your Users table that  
doesn't satisfy the foreign key constraint, i.e. there is a Users row  
with SecurityRoleId=0 and no row in SecurityRole with ID=0.

Erik Jones

DBA | Emma®
erik@myemma.com
800.595.4401 or 615.292.5888
615.292.0777 (fax)

Emma helps organizations everywhere communicate & market in style.
Visit us online at http://www.myemma.com






^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Problem with FOREIGN KEY
  2008-04-22 15:26 Problem with FOREIGN KEY Вадим Жерновой |Vadim Zhernovoi| <vadim.zhernovoi@gmail.com>
@ 2008-04-22 16:01 ` D'Arcy J.M. Cain <darcy@druid.net>
  1 sibling, 0 replies; 3+ messages in thread

From: D'Arcy J.M. Cain @ 2008-04-22 16:01 UTC (permalink / raw)
  To: "????? ???????? |Vadim Zhernovoi|" <vadim.zhernovoi@gmail.com>; +Cc: pgsql-sql

On Tue, 22 Apr 2008 18:26:19 +0300
"????? ???????? |Vadim Zhernovoi|" <vadim.zhernovoi@gmail.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@druid.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.



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2008-04-22 16:01 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-04-22 15:26 Problem with FOREIGN KEY Вадим Жерновой |Vadim Zhernovoi| <vadim.zhernovoi@gmail.com>
2008-04-22 15:37 ` Erik Jones <erik@myemma.com>
2008-04-22 16:01 ` D'Arcy J.M. Cain <darcy@druid.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox