Re: UNION in a VIEW? - Mailing list pgsql-sql

From Gordon A. Runkle
Subject Re: UNION in a VIEW?
Date
Msg-id 9agb3b$v1a$1@news.tht.net
Whole thread Raw
In response to Re: UNION in a VIEW?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
In article <12713.986422401@sss.pgh.pa.us>, "Tom Lane" <tgl@sss.pgh.pa.us>
wrote:
> You're correct, an outer WHERE clause will not be pushed down into the
> member selects of a UNION.  (This hasn't really got anything to do with
> whether a VIEW is involved.)  I haven't gotten round to convincing
> myself about whether that transformation is always valid, or what
> conditions it needs to be valid.  A TODO item for some future release...

Thanks, Tom.  Not the answer I was hoping for...

This seems to really reduce the utility of UNIONs, especially
within VIEWS.

What DB2 and SQL Server appear to be doing is binding the WHERE
clause to the colums in the positions corresponding to the column
labels in the first select.  So long as that is communicated to
the user, I would think that it would be valid.  At the very least,
it would be consistent with the other major RDBMSs.

I suppose it's to late to put this in for 7.1...  ;-)

Gordon.
-- 
It doesn't get any easier, you just go faster.  -- Greg LeMond


pgsql-sql by date:

Previous
From: "Josh Berkus"
Date:
Subject: Re: UNION in a VIEW?
Next
From: "Gerald Gutierrez"
Date:
Subject: RE: RE: serial type; race conditions