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

From Tom Lane
Subject Re: UNION in a VIEW?
Date
Msg-id 12713.986422401@sss.pgh.pa.us
Whole thread Raw
In response to UNION in a VIEW?  ("Gordon A. Runkle" <gar@integrated-dynamics.com>)
Responses Re: UNION in a VIEW?  ("Josh Berkus" <josh@agliodbs.com>)
List pgsql-sql
"Gordon A. Runkle" <gar@integrated-dynamics.com> writes:
> I have a number of views that I'm bringing over from DB2 which
> have UNIONs in them.  Some of the UNIONs have joins.

> The views are not working as expected (I'm running 7.1RC2).

> It appears that the where clause being applied to the view
> by the user is not being distributed properly to the selects.

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...
        regards, tom lane


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: max( bool )?
Next
From: Edipo Elder Fernandes de Melo
Date:
Subject: Re: Memory and performance