From: | Markus Bertheau ☭ <twanger(at)bluetwanger(dot)de> |
---|---|
To: | "'pgsql-sql(at)postgresql(dot)org'" <pgsql-sql(at)postgresql(dot)org> |
Subject: | Impossible with pl/pgsql? |
Date: | 2005-05-30 15:15:55 |
Message-ID: | 1117466155.20420.7.camel@dicaprio.akademie1.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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 ☭ <twanger(at)bluetwanger(dot)de>
From | Date | Subject | |
---|---|---|---|
Next Message | IBM COMPUTER EMAIL LOTTERY INTERNATIONAL PROMOTIONS | 2005-05-30 15:52:37 | WINNING NOTIFICATION |
Previous Message | KÖPFERL Robert | 2005-05-30 14:14:11 | Re: Generic Join on Arrays |