Re: Rules and Views - Mailing list pgsql-hackers

From Curt Sampson
Subject Re: Rules and Views
Date
Msg-id Pine.NEB.4.44.0208011353240.539-100000@angelic.cynic.net
Whole thread Raw
In response to Re: Rules and Views  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Thu, 1 Aug 2002, Tom Lane wrote:

> But that isn't an "equivalent query".  You've manually transformed
>     SELECT * FROM (SELECT something UNION SELECT somethingelse) WHERE foo;
> into
>     (SELECT something WHERE foo) UNION (SELECT somethingelse WHERE foo);

Right.

> As has been pointed out repeatedly, it's not entirely obvious whether
> this is a valid transformation in the general case.

Right. And I agreed that it as soon as you first pointed it out.
And still do.

But the message I was replying to was a similar union query, and I was
thinking that that person might be having a similar initial intuitive
reaction, "well, it looks kinda the same." I just wanted to note that
you need to check this stuff with explain, rather than blindly assuming
you know what's going on.

> If you can provide a proof that it's always safe, or that it's safe
> under such-and-such conditions, I'll see what I can do about making it
> happen.

It's on my list of things to do, but not high enough that it's
likely I'll ever get to it. :-)

BTW, if anybody can think of a way to make a view that really does
represent my original query, I'd appreciate a hint.

cjs
-- 
Curt Sampson  <cjs@cynic.net>   +81 90 7737 2974   http://www.netbsd.org   Don't you know, in this new Dark Age, we're
alllight.  --XTC
 



pgsql-hackers by date:

Previous
From: "Christopher Kings-Lynne"
Date:
Subject: Re: Another quick question...
Next
From: Tom Lane
Date:
Subject: Re: Another quick question...