Re: what are rules for? - Mailing list pgsql-general

From Michael Shulman
Subject Re: what are rules for?
Date
Msg-id c3f821000806240828w3dc84a8dk7d514b0af7e845ad@mail.gmail.com
Whole thread Raw
In response to what are rules for?  ("Michael Shulman" <shulman@mathcamp.org>)
Responses Re: what are rules for?
List pgsql-general
On Mon, Jun 23, 2008 at 11:54 PM, Adam Rich <adam.r@sbcglobal.net> wrote:
>> Can you describe, or point me to somewhere which describes, all the
>> things you can do with a rule that you can't do with a trigger?  The
>> only examples of rules in the manual are (1) logging, which I've just
>> been told is much better done with a trigger, and (2) making update,
>> insert, and delete work for a view, which is the only way to do it
>> because views are not allowed to have update, insert, or delete
>> triggers.  However, as I have learned in several recent threads, this
>> use of rules is fraught with difficulties, especially when the view
>> has more than one table, and it seems that it would be much easier if
>> triggers were just allowed on views.  What is the real purpose of the
>> rule system?
>
> You can read more about rules here:
>
> http://www.postgresql.org/docs/8.3/interactive/rules.html

I have read the manual.  As I pointed out, the only examples of rules
in the manual are (1) something which may be better done with a
trigger, and certainly *can* be done with a trigger, whatever the
speed considerations may be, and (2) something which doesn't seem to
work very well, and seemingly (from my PoV) *would* be done better
with triggers if triggers were allowed in that situation.

My question was, what else *can* you do with a rule that you *can't*
do with a trigger?  Are rules only a way to speed up things that could
also be done with triggers?

Thanks!
Mike

pgsql-general by date:

Previous
From: "JEAN-PIERRE PELLETIER"
Date:
Subject: could not select a suitable default timezone on Initdb, 8.3.3, Windows 2008 x64
Next
From: Martijn van Oosterhout
Date:
Subject: Re: what are rules for?