Re: [HACKERS] Bug in plpython's Python Generators

2010-11-15 Thread Tom Lane
=?UTF-8?B?SmFuIFVyYmHFhHNraQ==?= writes: > On 24/10/10 00:32, Jan Urbański wrote: >> On 21/10/10 20:48, Alvaro Herrera wrote: >>> ... and presumably somebody can fix the real bug that Jean-Baptiste hit, >>> too. >> AFAICS the error comes from PLy_function_handler disconnecting from SPI >> after

Re: [HACKERS] Bug in plpython's Python Generators

2010-11-14 Thread Oleg Bartunov
Thanks, Jan. I tested the patch and it looks fine. Oleg On Sun, 14 Nov 2010, Jan Urbaski wrote: On 24/10/10 00:32, Jan UrbaЪЪski wrote: On 21/10/10 20:48, Alvaro Herrera wrote: ... and presumably somebody can fix the real bug that Jean-Baptiste hit, too. AFAICS the error comes from PLy_fun

Re: [HACKERS] Bug in plpython's Python Generators

2010-11-14 Thread Marti Raudsepp
On Sun, Oct 24, 2010 at 01:32, Jan Urbański wrote: > The error handling in plpython is well-known to be a mess, hence the > confusing error message that OP got. Another annoying thing is that SPI > calls are not done in a subtransaction, which means you can't trap > errors with a try/catch Python

Re: [HACKERS] Bug in plpython's Python Generators

2010-11-14 Thread Jan Urbański
On 24/10/10 00:32, Jan Urbański wrote: > On 21/10/10 20:48, Alvaro Herrera wrote: >> ... and presumably somebody can fix the real bug that Jean-Baptiste hit, >> too. > > AFAICS the error comes from PLy_function_handler disconnecting from SPI > after calling into the Python code and then going ahea

Re: [HACKERS] Bug in plpython's Python Generators

2010-10-23 Thread Jan Urbański
On 21/10/10 20:48, Alvaro Herrera wrote: > Excerpts from Alvaro Herrera's message of jue oct 21 15:32:53 -0300 2010: >> Excerpts from Jean-Baptiste Quenot's message of jue oct 21 09:20:16 -0300 >> 2010: >> >>> I get this error when calling the function: >>> >>> test=# select foobar(); >>> ERROR:

Re: [HACKERS] Bug in plpython's Python Generators

2010-10-21 Thread Alvaro Herrera
Excerpts from Alvaro Herrera's message of jue oct 21 15:32:53 -0300 2010: > Excerpts from Jean-Baptiste Quenot's message of jue oct 21 09:20:16 -0300 > 2010: > > > I get this error when calling the function: > > > > test=# select foobar(); > > ERROR: error fetching next item from iterator > >

Re: [HACKERS] Bug in plpython's Python Generators

2010-10-21 Thread Alvaro Herrera
Excerpts from Jean-Baptiste Quenot's message of jue oct 21 09:20:16 -0300 2010: > I get this error when calling the function: > > test=# select foobar(); > ERROR: error fetching next item from iterator I can reproduce this here. The first bug to solve is, I think, getting a more meaningful err

[HACKERS] Bug in plpython's Python Generators

2010-10-21 Thread Jean-Baptiste Quenot
Hi there, I can't make Python Generators to work reliably. According to the documentation, this should work: CREATE OR REPLACE FUNCTION foobar() RETURNS SETOF text AS $$ for s in ('Hello', 'World'): plpy.execute('select 1') yield s $$ LANGUAGE 'plpythonu'; I get this error w