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