Received: from smtp10.atl.mindspring.net (smtp10.atl.mindspring.net [207.69.200.246]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eB21lqF39708 for ; Fri, 1 Dec 2000 20:47:52 -0500 (EST) (envelope-from mhh@mindspring.com) Received: from jupiter.hollomon.fam (user-2inikps.dialup.mindspring.com [165.121.83.60]) by smtp10.atl.mindspring.net (8.9.3/8.8.5) with SMTP id UAA29269; Fri, 1 Dec 2000 20:47:55 -0500 (EST) From: Mark Hollomon Reply-To: mhh@mindspring.com Date: Fri, 1 Dec 2000 21:47:51 -0500 X-Mailer: KMail [version 1.1.99] Content-Type: text/plain; charset="iso-8859-1" Cc: "Joel Burton" , pgsql-hackers@postgresql.org To: Tom Lane References: <3A255246.21430.688927F3@localhost> <00113022072200.00743@jupiter.hollomon.fam> <1984.975648802@sss.pgh.pa.us> In-Reply-To: <1984.975648802@sss.pgh.pa.us> Subject: Re: Re: [SQL] Rules with Conditions: Bug, or Misunderstanding MIME-Version: 1.0 Message-Id: <00120121475101.09339@jupiter.hollomon.fam> Content-Transfer-Encoding: 8bit X-Archive-Number: 200012/37 X-Sequence-Number: 1503 On Friday 01 December 2000 00:33, Tom Lane wrote: > The rewriting is done, all right, but what's left afterward still has > references to the view, because each rule is conditional. Essentially, > the rewriter output looks like > > -- rule 1 > if (rule1 condition holds) > -- rule 2 applied to rule1 success case > if (rule2 condition holds) > apply rule 2's query > else > apply rule 1's query > else > -- rule 2 applied to rule1 failure case > if (rule2 condition holds) > apply rule 2's query > else > apply original query > > If the system were capable of determining that either rule1 or rule2 > condition will always hold, perhaps it could deduce that the original > query on the view will never be applied. However, I doubt that we > really want to let loose an automated theorem prover on the results > of every rewrite ... I think it would be better to move the test further down, to just before we actually try to do the update/insert. Maybe into the heap access routines as suggested by Andreas. -- Mark Hollomon