returning rows from a function

From: "Nikheel Dhekne" <ndhekne(at)netaid(dot)org>
To: <pgsql-general(at)postgresql(dot)org>
Subject: returning rows from a function
Date: 2002-02-20 23:01:44
Message-ID: 001701c1ba62$91b71260$6d0a69be@netaid.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I am new to Postgres and have a rather straightforward question. Is it
possible, and if so, what is the syntax for returning a recordset from a
function?

I have tried

CREATE FUNCTION selectUserProperties(text) RETURNS RECORD

and

CREATE FUNCTION selectUserProperties(text) RETURNS SETOF varchar

Neither of which seems to work. The rest of the function is.

CREATE FUNCTION selectUserProperties (text) RETURNS RECORD
AS '

BEGIN
SELECT key,
value
FROM user_properties
WHERE username = $1;

END;

' LANGUAGE 'plpgsql';

Both key and value in this example are varchar columns.

Thanks for your help.

__________________
Nikheel Dhekne
NetAid | Developer
http://www.netaid.org


Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Blood 2002-02-20 23:08:27 query optimization Anyone know a better way to run this query
Previous Message Rodney Broom 2002-02-20 22:57:21 Ping