From: | Rafal Pietrak <rafal(at)zorro(dot)isa-geek(dot)com> |
---|---|
To: | Richard Huxton <dev(at)archonet(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: sequences and RULEs |
Date: | 2009-06-05 13:52:02 |
Message-ID: | 1244209922.4500.83.camel@localhost.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, 2009-06-05 at 14:32 +0100, Richard Huxton wrote:
> Rafal Pietrak wrote:
> > The NEW tuple of the table EVENTLOG, in its ID field at the moment of
> > RULE execution has a value of 5! But after everything is finished, the
> > actual value deposited in that record is 4.
>
> A rule rewrites the query, so you can end up with parts being evaluated
> twice. For functions with side-effects like nextval() that causes
> problems. There are other issues too.
I'd sort of understood it, if nextval() looked like actually evaluated
twice ... which should show up as EVENTLOG getting gaps on SERIAL ID.
But there are no gaps in eventlog ID sequence.
Which is really puzzling.
> > So comes my questions:
> > 1. Is this a feature or a bug, that such inconsistent NEW tuple show up
> > during RULE execution?
>
> It's a (confusing) feature.
OK. If that's a feature I'd just have to learn it.
Thenx for the explanations,
-R
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2009-06-05 13:57:51 | Re: invalid byte sequence for encoding "UTF8": 0xab |
Previous Message | Richard Huxton | 2009-06-05 13:32:08 | Re: sequences and RULEs |