Re: PL/Python set returning functions - Mailing list pgsql-interfaces

From Michael Fuhr
Subject Re: PL/Python set returning functions
Date
Msg-id 20051201202646.GA66766@winnie.fuhr.org
Whole thread Raw
In response to Re: PL/Python set returning functions  ("Joshua D. Drake" <jd@commandprompt.com>)
List pgsql-interfaces
On Thu, Dec 01, 2005 at 11:02:38AM -0800, Joshua D. Drake wrote:
> Eugene Prokopiev wrote:
> >How can I return some rows from my PL/Python function?
> >
> >I wrote:
> >
> >dbmail=# create type composite as (id bigint, name text);
> >CREATE TYPE
> >dbmail=# create or replace function csrf() returns setof composite as $$
> >dbmail$# return ((1, "james"), (2, "bob"), (3, "fargus"))
> >dbmail$# $$ language plpythonu;
> >CREATE FUNCTION
> >dbmail=# select csrf();
> >ERROR:  plpython functions cannot return tuples yet
> >
> select * from csrf();

Not in this case:

test=# select * from csrf();
ERROR:  plpython functions cannot return tuples yet

As far as I can tell from the source code, PL/Python doesn't support
returning composite types or sets (somebody please correct me if I'm
mistaken).

You might want to investigate PostgresPy.  I haven't used it myself
and I think it's still in development, but it's probably worth a look
if you're using Python.  I'm sure the developer would appreciate any
feedback.

http://python.projects.postgresql.org/

-- 
Michael Fuhr


pgsql-interfaces by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: PL/Python set returning functions
Next
From: Ludek Finstrle
Date:
Subject: Re: [ODBC] BLOB handling compatibility with PostgreSQL > 7.4