Re: joining views

From: Tomasz Myrta <jasiek(at)klaster(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: joining views
Date: 2002-10-23 15:02:34
Message-ID: 3DB6BA0A.4060502@klaster.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Użytkownik Tom Lane napisał:

> I think this is the same issue that Stephan identified in his response
> to your other posting ("sub-select with aggregate"). When you write
> FROM x join y using (col) WHERE x.col = const
> the WHERE-restriction is only applied to x. I'm afraid you'll need
> to write
> FROM x join y using (col) WHERE x.col = const AND y.col = const
> Ideally you should be able to write just
> FROM x join y using (col) WHERE col = const
> but I think that will be taken the same as "x.col = const" :-(

I am sad, but you are right. Using views this way will look strange:

create view v3 as select
v1.id as id1,
v2.id as id2,
...
from some_view v1, another_view v2;

select * from v3 where
id1=1234 and id2=1234;

Is it possible to make it look better?

And how to pass param=const to subquery ("sub-select with aggregate") if
I want to create view with this query?
Tomasz Myrta

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Terry Yapt 2002-10-26 10:27:28 Basic question about indexes/explain
Previous Message Tom Lane 2002-10-23 14:31:18 Re: joining views