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@xxxxxxxxx> http://svana.org/kleptog/ > From each according to his ability. To each according to his ability to litigate.
Attachment:
signature.asc
Description: Digital signature