Re: Rule trouble (looks to me exactly like the example)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Rule trouble (looks to me exactly like the example)
Дата
Msg-id 25306.1017948553@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Rule trouble (looks to me exactly like the example)  (Frank Joerdens <frank@joerdens.de>)
Ответы Re: Rule trouble (looks to me exactly like the example)  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Rule trouble (looks to me exactly like the example)  (Frank Joerdens <frank@joerdens.de>)
Список pgsql-sql
Frank Joerdens <frank@joerdens.de> writes:
> And here's the rule (it doesn't do anything real or interesting, I just
> simplified it to the point where it looked like the example):

> CREATE RULE insert_level AS
> ON INSERT TO tree
> WHERE new.id > 0 DO
> UPDATE tree SET leveling = 1
> WHERE tree.oid = new.oid;

What's happening is that "new.id" is effectively still NULL at the point
where the rule is processed, so the rule WHERE condition fails.  I'm not
sure why you're bothering with that WHERE condition anyway ... but this
seems to be another argument for moving INSERT's default-value-insertion
step to before the rule rewriter.  (There was some discussion of this
point just a few days ago, IIRC.)
        regards, tom lane


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

Предыдущее
От: "Josh Berkus"
Дата:
Сообщение: Re: 16 parameter limit
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: 16 parameter limit