Re: referential integrity violations

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: referential integrity violations
Дата
Msg-id 6176.1055285813@sss.pgh.pa.us
обсуждение исходный текст
Ответ на referential integrity violations  ("Shaun W. Kruger" <shaun@linuxhost.cc>)
Список pgsql-general
"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

В списке pgsql-general по дате отправления:

Предыдущее
От: Ron Snyder
Дата:
Сообщение: error restoring large objects during pg_restore
Следующее
От: Dmitry Tkach
Дата:
Сообщение: Re: referential integrity violations