Received: from sss.pgh.pa.us ([216.151.103.158]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f34MDR806044 for ; Wed, 4 Apr 2001 18:13:27 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.3/8.11.3) with ESMTP id f34MDMw12716; Wed, 4 Apr 2001 18:13:22 -0400 (EDT) To: "Gordon A. Runkle" cc: pgsql-sql@postgresql.org Subject: Re: UNION in a VIEW? In-reply-to: <9ag0u5$svd$1@news.tht.net> References: <9ag0u5$svd$1@news.tht.net> Comments: In-reply-to "Gordon A. Runkle" message dated "Wed, 04 Apr 2001 16:47:59 -0400" Date: Wed, 04 Apr 2001 18:13:21 -0400 Message-ID: <12713.986422401@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200104/63 X-Sequence-Number: 2402 "Gordon A. Runkle" 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