can a function return a virtual table?

From: Kai Hessing <kai(dot)hessing(at)hobsons(dot)de>
To: pgsql-sql(at)postgresql(dot)org
Subject: can a function return a virtual table?
Date: 2005-04-13 13:44:25
Message-ID: 3c4m1vF6b6e6aU1@individual.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

This is the question i'm telling myself. It is because we don't really
delete table entries, just setting a status field to '-1'. So a valid
select would look like: SELECT xyz, abc FROM (SELECT * FROM tablex WHERE
status > -1);
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*).

--
GnuPG-PublicKey -> http://www.hobsons.de/pgp/kai_hessing.asc

Bei seinen Handlungen ist vorzubedenken besser als nachzubedenken.
(Demokrit, um 460 v. Chr.)

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Matt Fulford 2005-04-13 17:28:36 SQL subquery (count distinct) - Any Ideas?
Previous Message Bruno Wolff III 2005-04-13 13:20:19 Re: max question