Home > Archive > PostgreSQL Discussion > March 2005 > Re: How to return a record and sets of record in plpython









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: How to return a record and sets of record in plpython
Sim Zacks

2005-03-30, 9:41 am

As far as I understand, though I hope someone will post that I'm wrong,
plpython cannot return recordsets.
In general, I use plpgsql when I want recordets and plpython when I want
functionality.
I have also called plpython functions from a plpgsql function when I wanted
a single value result.



"RL" <rlhsiao@gmail.com> wrote in message
news:qKa2e.5737$zl.2948@newssvr13.news.prodigy.com...
> Hi,
>
> I am trying to implement a few functions in Plpython (in Postgresql

8.0.1).
> However, I could find the solution in the documentation, so I would

appreciate
> your help. My question is how to return a record and sets of records in

Plpython
> if it's possible. For instance, if we have a table name EMP
>
> CREATE TABLE EMP ( name text, salary integer, age integer )
>
> according to the documentation, the following code will return a composite
> type:
>
> CREATE FUNCTION new_emp() RETURNS EMP AS '
> SELECT text "None" AS name,
> 1000 AS salary,
> 25 AS age;
> ' LANGUAGE SQL;
>
> and
>
> "RETURN NEXT" in Pl/pgsql allows us to return multiple rows
>
> How am I going to do the same thing in plpython?
> Thanks,
>
> Ruey-Lung Hsiao




Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com