Re: What about improving the rules system we have, was Re: Rules going away - Mailing list pgsql-general

From Merlin Moncure
Subject Re: What about improving the rules system we have, was Re: Rules going away
Date
Msg-id CAHyXU0yTv8nMa2fJ5-SzHAi-GVCeZCbYuXWNNnLA6Cd0oL3VhQ@mail.gmail.com
Whole thread Raw
In response to Re: What about improving the rules system we have, was Re: Rules going away  (Harald Fuchs <hari.fuchs@gmail.com>)
List pgsql-general
On Wed, Sep 28, 2011 at 11:46 AM, Harald Fuchs <hari.fuchs@gmail.com> wrote:
> In article <4116.1317226367@sss.pgh.pa.us>,
> Tom Lane <tgl@sss.pgh.pa.us> writes:
>
>> Not sure this specific proposal makes any sense at all.  IMO the only
>> real advantage that rules have over triggers is that they work on a
>> set-operation basis not a tuple-by-tuple basis.
>
> Isn't that what statement-level triggers are for, at least in other DB
> systems?  How about telling PostgreSQL's statement-level triggers
> something about the set of rows they affect?

in theory that would be nice, but they just don't work that way.  you
don't even have access to the SQL statement firing the trigger IIRC.
that said, with some thought you could work an 'after' trigger into a
set level operation, say, by rigging something around now().

now that we have view triggers (not that rules ever really worked for
updating views anyways), even notwithstanding the minor limitations of
triggers of rules vs triggers, I personally find the RULE feature to
be useless and dangerous.  I'd vote for immediately deprecating it
without hesitation.

merlin

pgsql-general by date:

Previous
From: Harald Fuchs
Date:
Subject: Re: What about improving the rules system we have, was Re: Rules going away
Next
From: Venkat Balaji
Date:
Subject: : Looking for a PostgreSQL book