Curt Sampson <[EMAIL PROTECTED]> writes: > On Thu, 1 Aug 2002, Tom Lane wrote: >> Curt Sampson <[EMAIL PROTECTED]> writes: > You want to be careful with this sort of stuff, since the query planner > sometimes won't do the view as efficiently as it would do the fully > specified equivalant query. I've posted about this here before. >> >> Please provide an example. AFAIK a view is a query macro, and nothing >> else.
> I already did provide an example, and you even replied to it. :-) 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); As has been pointed out repeatedly, it's not entirely obvious whether this is a valid transformation in the general case. (The knee-jerk reaction that it's obviously right should be held in check, since SQL's three-valued notion of boolean logic tends to trip up the intuition.) 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. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]