Re: referential integrity violations - Mailing list pgsql-general

From Stephan Szabo
Subject Re: referential integrity violations
Date
Msg-id 20030610155633.X68889-100000@megazone23.bigpanda.com
Whole thread Raw
In response to referential integrity violations  ("Shaun W. Kruger" <shaun@linuxhost.cc>)
List pgsql-general
On Tue, 10 Jun 2003, Shaun W. Kruger wrote:

> I'm getting some pretty strange results when doing a mass
> create of my database structure.  I get the following when
> it goes to create the foreign keys.  I just can't figure out
> why it is that half of them complain and the other half don't.
>
> NOTICE:  ALTER TABLE will create implicit trigger(s) for
> FOREIGN KEY check(s)
> ALTER TABLE
> NOTICE:  ALTER TABLE will create implicit trigger(s) for
> FOREIGN KEY check(s)
> ERROR:  groupidfk referential integrity violation - key
> referenced from users not found in groups
> NOTICE:  ALTER TABLE will create implicit trigger(s) for
> FOREIGN KEY check(s)
> ALTER TABLE
> NOTICE:  ALTER TABLE will create implicit trigger(s) for
> FOREIGN KEY check(s)
> ERROR:  justispidfk referential integrity violation - key
> referenced from userinfo not found in ispusers
> NOTICE:  ALTER TABLE will create implicit trigger(s) for
> FOREIGN KEY check(s)
> ALTER TABLE
> NOTICE:  ALTER TABLE will create implicit trigger(s) for
> FOREIGN KEY check(s)
> ERROR:  uinfoidfk referential integrity violation - key
> referenced from payments not found in userinfo

The problem appears to be that you have invalid data in the tables and so
the constraints start off invalidated.

From 7.4:

NOTICE:  ALTER TABLE will create implicit trigger(s) for FOREIGN KEY
check(s)
ERROR:  groupidfk referential integrity violation - key (groupid)=(0)
referenced from users not found in groups
NOTICE:  ALTER TABLE will create implicit trigger(s) for FOREIGN KEY
check(s)
ALTER TABLE
NOTICE:  ALTER TABLE will create implicit trigger(s) for FOREIGN KEY
check(s)
ERROR:  justispidfk referential integrity violation - key (justispid)=(0)
referenced from userinfo not found in ispusers
NOTICE:  ALTER TABLE will create implicit trigger(s) for FOREIGN KEY
check(s)
ALTER TABLE
NOTICE:  ALTER TABLE will create implicit trigger(s) for FOREIGN KEY
check(s)
ERROR:  uinfoidfk referential integrity violation - key (uinfoid)=(0)
referenced from payments not found in userinfo



pgsql-general by date:

Previous
From: Dmitry Tkach
Date:
Subject: Re: referential integrity violations
Next
From: Tom Lane
Date:
Subject: Re: error restoring large objects during pg_restore