Violation of non existing reference

Поиск
Список
Период
Сортировка
От js@deriva.de
Тема Violation of non existing reference
Дата
Msg-id acc97dc8-3d61-4f7d-9117-9a4d3c0fbf2f@v3g2000hsc.googlegroups.com
обсуждение исходный текст
Ответы Re: Violation of non existing reference
Список pgsql-general
Hi,

I encountered an odd behaviour when I tried to delete a record.
I have two tables "z_base" and "z_ul". z_base's primary key is "isin"
which is referenced by z_ul.

select count(*) from z_base where isin = 'DE000DB3BTR9';
 count
-------
     1

select count(*) from z_ul where isin = 'DE000DB3BTR9';
 count
-------
     0

So there is no record in z_ul that references z_base with isin
'DE000DB3BTR9', but when I do:

delete from z_base where isin = 'DE000DB3BTR9';
ERROR:  update or delete on table "z_base" violates foreign key
constraint "z_ul_isin_fkey" on table "z_ul"
DETAIL:  Key (isin)=(DE000DB3BTR9) is still referenced from table
"z_ul".

Has anyone an idea how this could happen?

Jan

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

Предыдущее
От: Thomas Kellerer
Дата:
Сообщение: Re: mssql to postgres problems with bytea help needed
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Violation of non existing reference