plpython and nrows() - Mailing list pgsql-general

From Joseph Barillari
Subject plpython and nrows()
Date
Msg-id m3sn5k9wp3.fsf@washer.barillari.org
Whole thread Raw
List pgsql-general
The archives indicate that someone asked this question back in
November, but there's no record of a reply. Here goes:

I'm writing a function in plpython, and have been unable to get the
nrows() call to work. For instance, running the function:

CREATE OR REPLACE FUNCTION py_test()
    RETURNS INTEGER
    AS '
result = plpy.execute("""SELECT * FROM events;""")
rows = result.nrows()
return 0
'
LANGUAGE 'plpython';

results in the following:

cal=> select py_test();
ERROR:  plpython: Call of function `__plpython_procedure_py_test_67236' failed.
exceptions.SystemError: error return without exception set

I know that the nrows() call is responsible for the error (removing
the call eliminates the error), but am at a loss to determine how to
fix it. The testsuite doesn't seem to test nrows() (or so I grepped),
which led me to believe (perhaps mistakenly) that the implementation
might be broken. Any suggestions as to what to try would be
appreciated.

Regards,

--Joe
Attachment

pgsql-general by date:

Previous
From: Gregory Seidman
Date:
Subject: Re: odd psql behaviour on OSX
Next
From: Oleg Bartunov
Date:
Subject: Re: Equivalent of FULLTEXT in mySQL