Re: Rule not invoked in 7.1 - Mailing list pgsql-sql

From Tom Lane
Subject Re: Rule not invoked in 7.1
Date
Msg-id 28329.980480146@sss.pgh.pa.us
Whole thread Raw
In response to Re: Rule not invoked in 7.1  (Kyle <kyle@actarg.com>)
Responses Re: Rule not invoked in 7.1  (Jan Wieck <janwieck@Yahoo.com>)
List pgsql-sql
Kyle <kyle@actarg.com> writes:
> If someone happens to know the primary key of a record they should not be
> able to access, and they try to update it, I would like the backend to
> ignore the query (or better yet, raise an exception but I haven't figured
> out how to do that).  If the status is correct, the update should proceed.

This might be better done with a trigger than a rule.  For one thing,
a trigger can easily raise an exception.  MHO is that rules are good
when you need to update multiple rows in other tables when certain
things happen.  If you just want to validate or twiddle an individual
tuple as it's inserted/updated, a trigger is a good bet.
        regards, tom lane


pgsql-sql by date:

Previous
From: Ron Peterson
Date:
Subject: Re: Is there anything like DESCRIBE?
Next
From: Tom Lane
Date:
Subject: Re: Cannot CREATE INDEX that contains a function