tracking down foreign key constraint violation error

Поиск
Список
Период
Сортировка
От Robert Fitzpatrick
Тема tracking down foreign key constraint violation error
Дата
Msg-id 1092002929.28620.61.camel@columbus.webtent.org
обсуждение исходный текст
Список pgsql-general
I have a function that does varous things, I can post it if necessary.
Basically, it deletes any related similar_group_id in tblhud74b, sets
sort_order field in tblhudunits to NULL and then proceeds to re-populate
tblhud74b based on certain calculations. The function runs fine through
all loops to the end. At the end, the following ERROR appears and the
transactions in the function all fail.

ERROR:  update or delete on "tblhudunits" violates foreign key
constraint "tblhudunitstblhud74b_fk" on "tblhud74b"
DETAIL:  Key (similar_group_id,sort_order)=(18,10) is still referenced
from table "tblhud74b".

I even tried running the script with tblhud74b empty. I can get a RAISE
NOTICE just before the END keyword in the function on the last line. No
triggers on tblhud74b, only a insert/delete after trigger on
tblhudunits, which is only updated with NULL sort_order's in the
function, inserts or deletes are being done to tblhudunits in the
function. All other edits in the function occur on tblhud74b. The only
thing I've been able to find related is the record with the Key
(similar_group_id,sort_order)=(18,10) is the first record in
tblhudunits.

Can anyone see something I am missing?
--
Robert


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

Предыдущее
От: Jiri Nemec
Дата:
Сообщение: CREATE FUNCTION
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: CREATE FUNCTION