Re: conditional joins and views

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Cc: Jonathan Vanasco <postgres(at)2xlp(dot)com>
Subject: Re: conditional joins and views
Date: 2007-04-24 20:08:42
Message-ID: 200704242208.42839.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Am Dienstag, 24. April 2007 21:43 schrieb Jonathan Vanasco:
> Is it possible at all to use conditional joins in views?
>
> ie:
> select a.* , b.* from a inner join b ON ( (a.id = b.id) AND
> (a.otherfield <> ?) )
>
> I have a few 15-20 table joins that i'd like to push into views.
> i've never wanted to push something with a conditional join into a
> view before, so am at a loss on this being a possibility.

I think what you are looking for is a parametrized view, but that doesn't
exist.

One obvious solution is to put this into a function, but that might not have
the best performance, depending on what sort of contexts you want to use the
view in.

Another option would be using prepared statements.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ben 2007-04-24 20:40:35 reasonable limit to number of schemas in a database?
Previous Message William Garrison 2007-04-24 19:50:00 postgres on Windows: PAE and max memory