Re: finding data violating constraint

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: finding data violating constraint
Дата
Msg-id 15853.1098197861@sss.pgh.pa.us
обсуждение исходный текст
Ответ на finding data violating constraint  ("Keith Worthington" <keithw@narrowpathinc.com>)
Список pgsql-novice
"Keith Worthington" <keithw@narrowpathinc.com> writes:
> I am trying to build a foreign key constraint.  The objective is to prevent
> parts from being entered that do not have a valid sales account.  When I try
> to build the constraint it fails telling me that there is a violation.  I have
> looked at the data and just can't seem to find the problem.  Is there a way to
> find the data that is causing the problem?

Use a more recent version of Postgres?

In 7.4 I get something like

regression=# alter table bar add foreign key (f1) references foo;
ERROR:  insert or update on table "bar" violates foreign key constraint "$1"
DETAIL:  Key (f1)=(2) is not present in table "foo".

            regards, tom lane

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

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: finding data violating constraint
Следующее
От: "Keith Worthington"
Дата:
Сообщение: Re: finding data violating constraint