Skip site navigation (1) Skip section navigation (2)

Re: Limiting with a left outer join

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Bill Moseley <moseley(at)hank(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Limiting with a left outer join
Date: 2006-02-14 05:38:49
Message-ID: 20060214053849.GA76710@winnie.fuhr.org (view raw or flat)
Thread:
Lists: pgsql-general
On Sun, Feb 12, 2006 at 08:03:07AM -0800, Bill Moseley wrote:
> BTW -- Is there a way to turn something like this into a view?  The
> 2 domain bind parameters will alway match, and the only other
> input parameters are the two review mode booleans.  That is, the
> input to the query is a domain id, and if "review_mode" must be false.

The usual way is to create a view that includes the columns you
might want to restrict on, define the view to select all rows, then
query the view with an appropriate WHERE clause.  Another possibility
is to create a set-returning function that accepts the relevant
values as arguments and plugs them into the query.

-- 
Michael Fuhr

In response to

pgsql-general by date

Next:From: NikDate: 2006-02-14 14:46:48
Subject: Postgres using 100% CPU
Previous:From: Russell SmithDate: 2006-02-14 02:55:54
Subject: Object ownership in a new database

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group