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 6145052841 for ; Mon, 30 May 2005 12:16:15 -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 89812-06 for ; Mon, 30 May 2005 15:16:07 +0000 (GMT) Received: from web11.manitu.net (web11.manitu.net [217.11.48.111]) by svr1.postgresql.org (Postfix) with ESMTP id 97AA452894 for ; Mon, 30 May 2005 12:16:03 -0300 (ADT) Received: from dicaprio.akademie1.de (dicaprio.akademie1.de [62.165.4.166]) (authenticated) by web11.manitu.net (8.10.2-SOL3/8.10.2) with ESMTP id j4UFG0221717 for ; Mon, 30 May 2005 17:16:00 +0200 Subject: Impossible with pl/pgsql? From: Markus Bertheau =?UTF-8?Q?=E2=98=AD?= To: "'pgsql-sql@postgresql.org'" Content-Type: text/plain; charset=UTF-8 Date: Mon, 30 May 2005 17:15:55 +0200 Message-Id: <1117466155.20420.7.camel@dicaprio.akademie1.de> Mime-Version: 1.0 X-Mailer: Evolution 2.0.4 (2.0.4-4) Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.031 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200505/236 X-Sequence-Number: 21549 Hi, I have a function find() that returns a SETOF INT. I further have a function decorate as follows: CREATE TYPE decorate_type AS (id INT, name TEXT, author TEXT, last_change TIMESTAMP); CREATE FUNCTION decorate(INT) RETURNS decorate_type STABLE LANGUAGE 'plpgsql' AS ' -- BLACK BOX '; Now I can do SELECT decorate(4); (4,egg,john,2003-05-05) and I can do SELECT * FROM decorate(4); id | name | author | last_change -------------------------------- 4 | egg | john | 2003-05-05 SELECT * FROM decorate(5); id | name | author | last_change -------------------------------- 5 | ham | dave | 2004-03-01 Let's say find() gives me 4 and 5: SELECT * FROM find(); find ---- 4 5 Now how would a query look like that involves find() and decorate() and returns id | name | author | last_change -------------------------------- 4 | egg | john | 2003-05-05 5 | ham | dave | 2004-03-01 I can't figure this out for the life of me. I also have the impression that that's impossible to do without changing find() or decorate(). Markus -- Markus Bertheau ☭