Re: Unions and where optimisation - Mailing list pgsql-performance

From Tomasz Myrta
Subject Re: Unions and where optimisation
Date
Msg-id 3E1C366B.5080406@klaster.net
Whole thread Raw
In response to Unions and where optimisation  (Boris Klug <boris.klug@control.de>)
Responses Re: Unions and where optimisation  (Boris Klug <boris.klug@control.de>)
Re: Unions and where optimisation  (Hannu Krosing <hannu@tm.ee>)
List pgsql-performance
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


pgsql-performance by date:

Previous
From: Hannu Krosing
Date:
Subject: Re: Unions and where optimisation
Next
From: Tomasz Myrta
Date:
Subject: Re: Unions and where optimisation