returning rows from a function

Поиск
Список
Период
Сортировка
От Nikheel Dhekne
Тема returning rows from a function
Дата
Msg-id 001701c1ba62$91b71260$6d0a69be@netaid.org
обсуждение исходный текст
Список 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

 

 

В списке pgsql-general по дате отправления:

Предыдущее
От: "Rodney Broom"
Дата:
Сообщение: Ping
Следующее
От: Tom Lane
Дата:
Сообщение: Re: schema error upgrading from 7.1 to 7.2