CREATE RULE ignored, what did I do wrong
От | andrew@pillette.com |
---|---|
Тема | CREATE RULE ignored, what did I do wrong |
Дата | |
Msg-id | 200409102136.i8ALajP19402@pillette.com обсуждение исходный текст |
Ответы |
Re: CREATE RULE ignored, what did I do wrong
|
Список | pgsql-sql |
OK, below is the dump of the table definition. Several other tables reference this and have ON DELETE CASCADE. In this tablethere is a rule for ON DELETE. The WHERE clause (NOT old.is_deleted) should always be the case, as the field is FALSEfor all existing entries (checked). The cascading deletes are all performed when I delete from this table. The rule is not. The record is NOT retained with is_deletednow TRUE. I turned on log_statement, and saw only the queries corresponding to the cascading delete, not my DOINSTEAD queries. Does the cascade happen first?? If so, how do I get in ahead of it? Thanks. ******* smoothed_rank_episode_id | integer | not null default nextval('base_rank_episode_base_rank_episode_id_seq'::text)base_rank_episode_id | integer | not nullsmoothing_id | integer | not null default 0smoothing_parameters | double precision[] | notnull default '{}'::double precision[]is_deleted | boolean | default false Indexes: "smoothed_rank_episode_pkey" primary key, btree (smoothed_rank_episode_id) "smoothed_rank_episode_ak1" unique,btree (base_rank_episode_id, smoothing_id, smoothing_parameters) Foreign-key constraints: "$1" FOREIGN KEY (smoothing_id) REFERENCES smoothing_algorithm(smoothing_id) ON UPDATE CASCADEON DELETE CASCADE Rules: del_smoothed_rank_episode AS ON DELETE TO smoothed_rank_episode WHERE (NOT old.is_deleted) DO INSTEAD (DELETE FROMhistorical_rank WHERE (historical_rank.smoothed_rank_episode_id = old.smoothed_rank_episode_id); DELETE FROM signal WHERE(signal.signal_episode_id IN (SELECT signal_episode.signal_episode_id FROM signal_episode WHERE (signal_episode.smoothed_rank_episode_id= old.smoothed_rank_episode_id))); UPDATE smoothed_rank_episode SET is_deleted =true WHERE (smoothed_rank_episode.smoothed_rank_episode_id = old.smoothed_rank_episode_id); )
В списке pgsql-sql по дате отправления: