Foreign Key & Rule confusion RE: Lost Trigger(s)?

Поиск
Список
Период
Сортировка
От Rod Taylor
Тема Foreign Key & Rule confusion RE: Lost Trigger(s)?
Дата
Msg-id 022d01c0be97$d21933a0$2205010a@jester
обсуждение исходный текст
Список pgsql-hackers
Found the issue.  Try out the included SQL.

I had honestly expected the second delete to work properly as nothing
had to be removed that table.

The rule was added as a temporary measure to protect the data
currently in the table -- without the intent of otherwise impeding the
other information's use. I suppose I forgot that the table wouldn't be
looked at as the rule is checked quite early.



CREATE TABLE junk_parent ( col SERIAL PRIMARY KEY
);

INSERT INTO junk_parent DEFAULT VALUES;
INSERT INTO junk_parent DEFAULT VALUES;
INSERT INTO junk_parent DEFAULT VALUES;

CREATE TABLE junk ( col int4 NOT NULL REFERENCES junk_parent(col) ON UPDATE CASCADE ON
DELETE CASCADE
);

INSERT INTO junk VALUES ('1');

DELETE FROM junk_parent WHERE col = 1;
DELETE FROM junk_parent WHERE col = 2;

--
Rod Taylor

There are always four sides to every story: your side, their side, the
truth, and what really happened.

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

Предыдущее
От: Steven Vajdic
Дата:
Сообщение: Integer to float function
Следующее
От: "Rod Taylor"
Дата:
Сообщение: INSERT Issues