Re: bug or not? Trigger preventing delete causes circumvention of FK

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: bug or not? Trigger preventing delete causes circumvention of FK
Дата
Msg-id 5965.1134094667@sss.pgh.pa.us
обсуждение исходный текст
Ответ на bug or not? Trigger preventing delete causes circumvention of FK  (Luca Pireddu <luca@cs.ualberta.ca>)
Список pgsql-general
Luca Pireddu <luca@cs.ualberta.ca> writes:
> I wrote a trigger function with the intent of preventing the deletion of a
> parent record when a referencing record would not allow it.  However, the
> result is that the referencing record stays, but the referenced one is gone,
> so that my foreign key constraint is not respected.

[ shrug... ] So don't do that.  Triggers can break FK constraints in any
number of ways beside this one (eg, changing the data in the record).
If we tried to prevent that I think we'd either waste a lot of cycles or
cripple the trigger feature ... quite possibly both.

            regards, tom lane

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

Предыдущее
От: Luca Pireddu
Дата:
Сообщение: bug or not? Trigger preventing delete causes circumvention of FK
Следующее
От: Kathy Lo
Дата:
Сообщение: Re: memory leak under heavy load?