From: Hannu Krosing <hannu@tm.ee>
To: Tomasz Myrta <jasiek@klaster.net>
Cc: Boris Klug <boris.klug@control.de>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: Unions and where optimisation
Date: 08 Jan 2003 16:49:20 +0000
Message-ID: <1042044560.3237.7.camel@huli> (raw)
In-Reply-To: <3E1C366B.5080406@klaster.net>
References: <200301081425.48597.boris.klug@control.de>
<1042041735.3237.1.camel@huli>
<3E1C366B.5080406@klaster.net>
On Wed, 2003-01-08 at 14:32, Tomasz Myrta wrote:
> 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?
Nope! Sorry.
SQL spec clearly states that subqueries in FROM clause must not see each
other ;(
It would work in WITH part of the query, which will hopefully be
implemented in some future PG version, perhaps even 7.4 as WITH is the
prerequisite for implementing SQL99 recursive queries, and RedHat has
shown an strongish interest in implementing these.
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
--
Hannu Krosing <hannu@tm.ee>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-performance@postgresql.org
Cc: hannu@tm.ee, jasiek@klaster.net, boris.klug@control.de
Subject: Re: Unions and where optimisation
In-Reply-To: <1042044560.3237.7.camel@huli>
References: <200301081425.48597.boris.klug@control.de> <1042041735.3237.1.camel@huli> <3E1C366B.5080406@klaster.net> <1042044560.3237.7.camel@huli>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox