Bug in plpython's Python Generators
От | Jean-Baptiste Quenot |
---|---|
Тема | Bug in plpython's Python Generators |
Дата | |
Msg-id | AANLkTimLMr-u89f7vf4AckB6xH=V3uf+PxraOg4XB4=o@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: Bug in plpython's Python Generators
|
Список | pgsql-hackers |
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 when calling the function: test=# select foobar(); ERROR: error fetching next item from iterator CONTEXT: PL/Python function "foobar" When I remove the dummy plpy.execute() call, it works: CREATE OR REPLACE FUNCTION foobar() RETURNS SETOF text AS $$ for s in ('Hello', 'World'): yield s $$ LANGUAGE 'plpythonu'; test=# select foobar();foobar --------HelloWorld (2 rows) Seems like calls to plpy.execute() conflict with generators. This is the case both on versions 8.4.4 and 9.0.1. All the best, -- Jean-Baptiste Quenot
В списке pgsql-hackers по дате отправления: