Re: rules: evaluate inputs in advance

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: rules: evaluate inputs in advance
Дата
Msg-id 20060512135705.GF12955@svana.org
обсуждение исходный текст
Ответ на rules: evaluate inputs in advance  (Markus Schiltknecht <markus@bluegap.ch>)
Ответы Re: rules: evaluate inputs in advance  (Markus Schiltknecht <markus@bluegap.ch>)
Список pgsql-general
On Fri, May 12, 2006 at 03:51:18PM +0200, Markus Schiltknecht wrote:
> Hi,
>
> I was trying to create an updateable view. Suddenly I got foreign key
> violations when using nextval('myseq').
>
> As I understand, the rewriter does something similar to a simple text
> replacement (I guess copying the plan tree nodes?) so that nextval gets
> evaluated again for every rule that applies.
>
> Is this desirable? Are there applications which need every rule to
> reevaluate the input expressions? Or could that behaviour be changed so
> that the input values for the rules get evaluated only once?

It's a known problem. It's also one of the reasons why triggers are
recommended over rules. And it's not desirable behaviour.

There have been discussions about the problems with the rule system and
how it seems to fail on simple ideas. Yet no-one has come up with an
alternative that covers the current uses...

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Вложения

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

Предыдущее
От: Markus Schiltknecht
Дата:
Сообщение: rules: evaluate inputs in advance
Следующее
От: Markus Schiltknecht
Дата:
Сообщение: Re: rules: evaluate inputs in advance