Re: CREATE RULE ignored, what did I do wrong

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: CREATE RULE ignored, what did I do wrong
Дата
Msg-id 7805.1094884943@sss.pgh.pa.us
обсуждение исходный текст
Ответ на CREATE RULE ignored, what did I do wrong  (andrew@pillette.com)
Список pgsql-sql
andrew@pillette.com writes:
> Foreign-key constraints:
>     "$1" FOREIGN KEY (smoothing_id) REFERENCES smoothing_algorithm(smoothing_id) ON UPDATE CASCADE ON DELETE CASCADE
> Rules:
>     del_smoothed_rank_episode AS ON DELETE TO smoothed_rank_episode
> WHERE (NOT old.is_deleted) DO INSTEAD ...

The DELETE commands generated by the foreign key ON DELETE CASCADE will
get rewritten by your ON DELETE rule.  You probably do not want to do
this; or at least not make it an INSTEAD rule.

There has been some debate in the past about whether rules should be
able to break foreign-key constraints, but I tend to class it as a
"you should know what you're doing" feature.  Preventing this kind
of error would inevitably result in a serious reduction of the power
of the rule feature.
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Using UPDATE FROM
Следующее
От: Michael Glaesemann
Дата:
Сообщение: Re: HOW TO HANDLE ZEROS IN DATE FIELD?