pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Fuhr <mike@fuhr.org>
To: Joshua D. Drake <jd@commandprompt.com>
Cc: Eugene Prokopiev <prokopiev@stc.donpac.ru>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: PL/Python set returning functions
Date: Thu, 1 Dec 2005 13:26:47 -0700
Message-ID: <20051201202646.GA66766@winnie.fuhr.org> (raw)
In-Reply-To: <438F48CE.7030008@commandprompt.com>
References: <438F47F7.2040109@stc.donpac.ru>
	<438F48CE.7030008@commandprompt.com>

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



view thread (3+ messages)

Message-ID: <20051201202646.GA66766@winnie.fuhr.org>
Permalink:  ../20051201202646.GA66766@winnie.fuhr.org/
Also on:    postgresql.org/message-id/20051201202646.GA66766@winnie.fuhr.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: mike@fuhr.org, jd@commandprompt.com, prokopiev@stc.donpac.ru
  Subject: Re: PL/Python set returning functions
  In-Reply-To: <20051201202646.GA66766@winnie.fuhr.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox