RE: [SQL] nextval - Mailing list pgsql-sql

From Jackson, DeJuan
Subject RE: [SQL] nextval
Date
Msg-id F10BB1FAF801D111829B0060971D839F2AAE70@cpsmail
Whole thread Raw
List pgsql-sql
> On Thu, 28 May 1998, Jerome ALET wrote:
>
> >
> > Yes, I already know that solution, but I wondered why mine was bad
> (the
> > forgotten '') and finally I think I've found a (maybe already known)
> bug
> > in CREATE RULE (look at the results in my previous message).
> >
>
> Who hasn't already found one? :)
>
> the man page for create_rule clearly says
>
> DESCRIPTION
>        The current rule system implementation is very brittle and
>        is unstable.  Users are discouraged from  using  rules  at
>        this time.
>
I wouldn't consider the results that Jerome is getting to be a bug.
What is happening is that the RULE is inserting the new value into every
row each time he inserts a new row.  A test to verify that would be to
insert two rows then a select and see if the behavior is consistent with
your previous assumptions.
Now with that said the solution would be to somehow limit your insert
rule to the currently inserted row.  I haven't played with rules enough
(read: at all), so I can't give you the sql, but I bet it looks like a
WHERE clause.

Hope this helps,
    -DEJ

pgsql-sql by date:

Previous
From: Marin D
Date:
Subject: Re: [SQL] nextval
Next
From: Jerome ALET
Date:
Subject: Re: [SQL] nextval