Received: from sss.pgh.pa.us (sss.pgh.pa.us [209.114.132.154]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f0Q3Zrq48822 for ; Thu, 25 Jan 2001 22:35:53 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.1/8.11.1) with ESMTP id f0Q3Zl928332; Thu, 25 Jan 2001 22:35:47 -0500 (EST) To: Kyle cc: Jan Wieck , pgsql-sql@postgresql.org Subject: Re: Rule not invoked in 7.1 In-reply-to: <3A706208.AD6AB9@actarg.com> References: <200101251321.IAA02253@jupiter.greatbridge.com> <3A706208.AD6AB9@actarg.com> Comments: In-reply-to Kyle message dated "Thu, 25 Jan 2001 10:27:36 -0700" Date: Thu, 25 Jan 2001 22:35:46 -0500 Message-ID: <28329.980480146@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200101/374 X-Sequence-Number: 1047 Kyle 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