Skip site navigation (1) Skip section navigation (2)

Re: Re: [SQL] Rules with Conditions: Bug, or Misunderstanding

From: Mark Hollomon <mhh(at)mindspring(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Joel Burton" <jburton(at)scw(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Re: [SQL] Rules with Conditions: Bug, or Misunderstanding
Date: 2000-12-02 02:47:51
Message-ID: 00120121475101.09339@jupiter.hollomon.fam (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-sql
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

In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2000-12-02 05:11:23
Subject: Re: ALTER FUNCTION problem
Previous:From: Mark HollomonDate: 2000-12-02 02:38:01
Subject: ALTER FUNCTION problem

pgsql-sql by date

Next:From: Ross J. ReedstromDate: 2000-12-02 03:27:06
Subject: Re: I can be a BUG?
Previous:From: Edipo E. F. MeloDate: 2000-12-01 23:48:44
Subject: I can be a BUG?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group