Re: [GENERAL] plpython return setof and yield

2009-08-17 Thread Nuno Mota
Ok, now I think I understand since I already have a result set from the query I cannot use yield. The other example works because I am generating only one result set. On Mon, Aug 17, 2009 at 7:55 PM, Nuno Mota wrote: > I have fixed the problem populating a list and returning it. > > Well I gues

Re: [GENERAL] plpython return setof and yield

2009-08-17 Thread Nuno Mota
I have fixed the problem populating a list and returning it. Well I guess I have to learn a litte bit more of python to understand how to use yield when using multiple result sets. Thank you anyway On Mon, Aug 17, 2009 at 7:23 PM, Adrian Klaver wrote: > > > - "Nuno Mota" wrote: > > > Tha

Re: [GENERAL] plpython return setof and yield

2009-08-17 Thread Adrian Klaver
- "Nuno Mota" wrote: > Thank you very much, > > Can i ask one more question ? > > How do I declare the correct result set to return, this in first > example code, is it possible ? > > Thank you again, > Nuno Mota > > >From here: http://www.postgresql.org/docs/8.3/interactive/plpython-

Re: [GENERAL] plpython return setof and yield

2009-08-17 Thread Nuno Mota
Thank you very much, Can i ask one more question ? How do I declare the correct result set to return, this in first example code, is it possible ? Thank you again, Nuno Mota On Mon, Aug 17, 2009 at 3:21 PM, Adrian Klaver wrote: > On Sunday 16 August 2009 5:13:51 pm Nuno Mota wrote: > > Hi, >

Re: [GENERAL] plpython return setof and yield

2009-08-17 Thread Adrian Klaver
On Sunday 16 August 2009 5:13:51 pm Nuno Mota wrote: > Hi, > > I am kind of new into python, and I have been trying to port some plperl > functions into plpython, but I've run up into a problem. > > Imagine the following plpython code. > > CREATE OR REPLACE FUNCTION greet (how text) > RETURNS SET

[GENERAL] plpython return setof and yield

2009-08-16 Thread Nuno Mota
Hi, I am kind of new into python, and I have been trying to port some plperl functions into plpython, but I've run up into a problem. Imagine the following plpython code. CREATE OR REPLACE FUNCTION greet (how text) RETURNS SETOF greeting AS $$ rv = plpy.execute("SELECT 1") for article in