Received: from smtp1.mail.yahoo.com (smtp1.mail.yahoo.com [128.11.69.60]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f0PDBXq56343 for ; Thu, 25 Jan 2001 08:11:33 -0500 (EST) (envelope-from janwieck@yahoo.com) Received: from j13.us.greatbridge.com (HELO jupiter.greatbridge.com) (216.54.52.153) by smtp.mail.vip.suc.yahoo.com with SMTP; 25 Jan 2001 13:11:29 -0000 X-Apparently-From: Received: (from janwieck@localhost) by jupiter.greatbridge.com (8.9.3/8.9.3) id IAA02253; Thu, 25 Jan 2001 08:21:09 -0500 From: Jan Wieck Message-Id: <200101251321.IAA02253@jupiter.greatbridge.com> Subject: Re: Rule not invoked in 7.1 In-Reply-To: <26488.980398409@sss.pgh.pa.us> from Tom Lane at "Jan 24, 2001 11:53:29 pm" To: Tom Lane Date: Thu, 25 Jan 2001 08:21:09 -0500 (EST) CC: Kyle , pgsql-sql@postgresql.org X-Mailer: ELM [version 2.4ME+ PL68 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Archive-Number: 200101/355 X-Sequence-Number: 1028 Tom Lane wrote: > Kyle writes: > > ERROR: Cannot update a view without an appropriate rule. > > 7.1 insists that you provide an *unconditional* DO INSTEAD rule > for a view. What do you think was happening on your old database > when the "where old.status = 'appr'" clause wasn't satisfied? > Nothing good I'm afraid. No harm in the UPDATE case, because so far there aren't any tuples in the view that could be affected by the still executed original query. But in an INSERT case, it would let tuples through into the views heap file. > If you really do need conditional rules, you can satisfy the check > by writing one unconditional DO INSTEAD NOTHING rule and then one > or more conditional non-INSTEAD rules. But you should think carefully > about what you expect to happen when you use a conditional rule. Alternatively he should be able to move the condition down into the query itself. In that case, it's an unconditional INSTEAD rule, causing the rewriter not to fork off another query but replace the initial one completely. But the condition is still there and affects the effects. Jan -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck@Yahoo.com # _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com