Re: referential integrity violations
"Shaun W. Kruger" <shaun@linuxhost.cc> writes:
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.
ERROR: groupidfk referential integrity violation - key
referenced from users not found in groups
These are not syntax errors, they are complaints about your data --- ie,
there are rows in the tables that fail to meet the proposed foreign-key
constraint (there is no matching row in the referenced table).
I believe CVS tip has code in it to actually show the offending data
values, but right now you have to find the bad rows the hard way.
A SELECT ... WHERE NOT EXISTS ... kind of query should help.
regards, tom lane
Import Notes
Reply to msg id not found: 3EE6623A.2040400@linuxhost.ccReference msg id not found: 3EE6623A.2040400@linuxhost.cc