Re: Function returning SETOF using plpythonu

Поиск
Список
Период
Сортировка
От Luís Sousa
Тема Re: Function returning SETOF using plpythonu
Дата
Msg-id 45BE00CA.1060106@ualg.pt
обсуждение исходный текст
Ответ на Re: Function returning SETOF using plpythonu  (Marcin Stępnicki <mstepnicki@gmail.com>)
Ответы Re: Function returning SETOF using plpythonu
Список pgsql-sql
Thanks :-)
That worked fine.

>plpy.execute returns dictionary, and you need a list. You may try this:
>
>CREATE FUNCTION "test_python_setof"()
>RETURNS SETOF text AS '
>    records=plpy.execute("SELECT name FROM interface");
>    return  [ (r["name"]) for r in records]
>' LANGUAGE 'plpythonu';
>
>  
>
Then I tried to do some changes and try to return a SETOF type:
CREATE TYPE "test_python_t" AS (   name varchar(50)
);

CREATE FUNCTION "test_python_setof"()
RETURNS SETOF test_python_t AS '   records=plpy.execute("SELECT name FROM interface");   return  [ (r["name"]) for r in
records]
' LANGUAGE 'plpythonu';

And I'm getting ERROR:  tuple return types are not supported yet.

On my production database server I'm using PostgreSQL 7.4 and using
language plpgsql I'm returning some SETOF type without problems.
Is this a feature that's missing on this version or I'm I doing
something wrong on code? If is a feature missing, is already implemented
on some version afterwards?

Best regards,
Luís Sousa



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

Предыдущее
От: Andrew Sullivan
Дата:
Сообщение: Re: Very strange postgresql behaviour
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Function returning SETOF using plpythonu