Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D980E475AAC for ; Wed, 8 Jan 2003 09:28:27 -0500 (EST) Received: from serwer.skawsoft.com.pl (serwer.skawsoft.com.pl [213.25.37.66]) by postgresql.org (Postfix) with ESMTP id 3966E4758F1 for ; Wed, 8 Jan 2003 09:28:27 -0500 (EST) Received: from klaster.net (pa168.krakow.cvx.ppp.tpnet.pl [213.76.36.168]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id 618902B21C; Wed, 8 Jan 2003 15:26:34 +0100 (CET) Message-ID: <3E1C366B.5080406@klaster.net> Date: Wed, 08 Jan 2003 15:32:11 +0100 From: Tomasz Myrta User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.2b) Gecko/20021016 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Hannu Krosing Cc: Boris Klug , "pgsql-performance@postgresql.org" Subject: Re: Unions and where optimisation References: <200301081425.48597.boris.klug@control.de> <1042041735.3237.1.camel@huli> In-Reply-To: <200301081425.48597.boris.klug@control.de> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/55 X-Sequence-Number: 702 Hannu Krosing wrote: > > try making the orderevents view like this: > > create view orderevents as > select rk.aufnr, sub.ts > from rk150 rk, > ( select ts from rk150 where aufnr = rk.aufr > union > select ts from rk151 where aufnr = rk.aufr > union > select ts from rk152 where aufnr = rk.aufr > ) as sub > ; > > this could/should force your desired behavior. > Hannu, does it work? Few months ago I lost some time trying to create this kind of query and I always got error, that subselect doesn't knows anything about upper (outer?) table. In this query you should get error: "relation rk does not exist". What version of postgres do you have? Tomasz Myrta