| От | Tom Lane |
|---|---|
| Тема | Re: Rule appears not to fire on insert w/ "except" |
| Дата | |
| Msg-id | 3886.1132605347@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Rule appears not to fire on insert w/ "except" (Chris Kratz <chris.kratz@vistashare.com>) |
| Ответы |
Re: Rule appears not to fire on insert w/ "except"
|
| Список | pgsql-general |
Chris Kratz <chris.kratz@vistashare.com> writes:
> CREATE OR REPLACE RULE debug_rule AS
> ON INSERT TO test1
> do INSERT INTO test_que (row_id)
> VALUES (new.id);
You would be a whole lot better off doing this with a trigger.
> insert into test1
> select id,data from test2
> except select id,data from test1;
I believe the problem with this is that the rule re-evaluates the
command to generate the "new" results, and by that point the rows
have already been inserted into test1, thus disappear from the
result of the "except" ...
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера