Re: what are rules for?

From: "Michael Shulman" <shulman(at)mathcamp(dot)org>
To: "Adam Rich" <adam(dot)r(at)sbcglobal(dot)net>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: what are rules for?
Date: 2008-06-24 15:28:00
Message-ID: c3f821000806240828w3dc84a8dk7d514b0af7e845ad@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Jun 23, 2008 at 11:54 PM, Adam Rich <adam(dot)r(at)sbcglobal(dot)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

In response to

Responses

Browse pgsql-general by date

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