Re: Re: [SQL] Rules with Conditions: Bug, or Misunderstanding - Mailing list pgsql-hackers

From Mark Hollomon
Subject Re: Re: [SQL] Rules with Conditions: Bug, or Misunderstanding
Date
Msg-id 00120121475101.09339@jupiter.hollomon.fam
Whole thread Raw
In response to Re: Re: [SQL] Rules with Conditions: Bug, or Misunderstanding  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Re: [SQL] Rules with Conditions: Bug, or Misunderstanding  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: Mark Hollomon
Date:
Subject: ALTER FUNCTION problem
Next
From: Tom Lane
Date:
Subject: Re: ALTER FUNCTION problem