X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 768AF53540 for ; Wed, 13 Apr 2005 10:44:43 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 35334-05 for ; Wed, 13 Apr 2005 13:44:35 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id 090C35332E for ; Wed, 13 Apr 2005 10:44:34 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 6280430952; Wed, 13 Apr 2005 15:43:50 +0200 (MET DST) From: Kai Hessing X-Newsgroups: pgsql.sql Subject: can a function return a virtual table? Date: Wed, 13 Apr 2005 15:44:25 +0200 Lines: 17 Message-ID: <3c4m1vF6b6e6aU1@individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit User-Agent: Mozilla Thunderbird 1.0 (Macintosh/20041206) X-Accept-Language: de, en-us, en X-Enigmail-Version: 0.89.6.0 X-Enigmail-Supports: pgp-inline, pgp-mime To: pgsql-sql@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200504/268 X-Sequence-Number: 21161 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.)