pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: Kai Hessing <kai.hessing@hobsons.de>
Cc: pgsql-sql@postgresql.org
Subject: Re: can a function return a virtual table?
Date: Sat, 23 Apr 2005 11:00:56 -0700
Message-ID: <200504231100.56375.josh@agliodbs.com> (raw)
In-Reply-To: <3c4m1vF6b6e6aU1@individual.net>
References: <3c4m1vF6b6e6aU1@individual.net>

Kai,

> It would be much nicer to have to write something like: SELECT xyz, abc
> FROM active(tablex); where the function 'active(x)' returns a virtual
> table with all entries from table x where status is > -1. But sadly I
> have no idea how write such a function. Good old O'reilly can't help (or
> i'm to dumb *g*).

http://techdocs.postgresql.org/guides/SetReturningFunctions

Beware, though, that query plan estimation for SRFs is less accurate than for 
regular subqueries, so you could end up with unnecessarily slow query 
execution.  Test!

-- 
Josh Berkus
Aglio Database Solutions
San Francisco



view thread (6+ messages)

Message-ID: <200504231100.56375.josh@agliodbs.com>
Permalink:  ../200504231100.56375.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200504231100.56375.josh@agliodbs.com

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: josh@agliodbs.com, kai.hessing@hobsons.de
  Subject: Re: can a function return a virtual table?
  In-Reply-To: <200504231100.56375.josh@agliodbs.com>

* 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