Re: Rules and Views

From: Curt Sampson <cjs(at)cynic(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Zeugswetter Andreas SB SD <ZeugswetterA(at)spardat(dot)at>, Hannu Krosing <hannu(at)tm(dot)ee>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Rules and Views
Date: 2002-08-01 04:56:55
Message-ID: Pine.NEB.4.44.0208011353240.539-100000@angelic.cynic.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)cynic(dot)net> +81 90 7737 2974 http://www.netbsd.org
Don't you know, in this new Dark Age, we're all light. --XTC

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-08-01 05:20:00 Re: Another quick question...
Previous Message Christopher Kings-Lynne 2002-08-01 04:52:58 Re: Another quick question...