pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedPL/Python set returning functions
3+ messages / 3 participants
[nested] [flat]
* PL/Python set returning functions
@ 2005-12-01 18:59 Eugene Prokopiev <prokopiev@stc.donpac.ru>
0 siblings, 1 reply; 3+ messages in thread
From: Eugene Prokopiev @ 2005-12-01 18:59 UTC (permalink / raw)
To: pgsql-interfaces
Hi,
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
What's wrong?
--
Thanks,
Eugene Prokopiev
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: PL/Python set returning functions
@ 2005-12-01 19:02 Joshua D. Drake <jd@commandprompt.com>
parent: Eugene Prokopiev <prokopiev@stc.donpac.ru>
0 siblings, 1 reply; 3+ messages in thread
From: Joshua D. Drake @ 2005-12-01 19:02 UTC (permalink / raw)
To: Eugene Prokopiev <prokopiev@stc.donpac.ru>; +Cc: pgsql-interfaces
Eugene Prokopiev wrote:
> Hi,
>
> 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();
> What's wrong?
>
> --
> Thanks,
> Eugene Prokopiev
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
--
The PostgreSQL Company - Command Prompt, Inc. 1.503.667.4564
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: PLphp, PLperl - http://www.commandprompt.com/
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: PL/Python set returning functions
@ 2005-12-01 20:26 Michael Fuhr <mike@fuhr.org>
parent: Joshua D. Drake <jd@commandprompt.com>
0 siblings, 0 replies; 3+ messages in thread
From: Michael Fuhr @ 2005-12-01 20:26 UTC (permalink / raw)
To: Joshua D. Drake <jd@commandprompt.com>; +Cc: Eugene Prokopiev <prokopiev@stc.donpac.ru>; 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
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2005-12-01 20:26 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-12-01 18:59 PL/Python set returning functions Eugene Prokopiev <prokopiev@stc.donpac.ru>
2005-12-01 19:02 ` Joshua D. Drake <jd@commandprompt.com>
2005-12-01 20:26 ` Michael Fuhr <mike@fuhr.org>
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