Re: Rules and Views
От | Tom Lane |
---|---|
Тема | Re: Rules and Views |
Дата | |
Msg-id | 4508.1028177056@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: Rules and Views (Curt Sampson <cjs@cynic.net>) |
Ответы |
Re: Rules and Views
|
Список | pgsql-hackers |
Curt Sampson <cjs@cynic.net> writes: > On Thu, 1 Aug 2002, Tom Lane wrote: >> Curt Sampson <cjs@cynic.net> 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
В списке pgsql-hackers по дате отправления: