exceptions not present in plpy with Python 3
Jan Urbański <wulczer@wulczer.org>
From: Jan Urbański <wulczer@wulczer.org>
To: Postgres - Hackers <pgsql-hackers@postgresql.org>
Date: 2010-12-18T17:56:29Z
Lists: pgsql-hackers
Attachments
- plpython3-exceptions.diff (text/x-patch) patch
Hi, there seems to be a problem in the way we add exceptions to the plpy module in PL/Python compiled with Python 3k. Try this: DO $$ plpy.SPIError $$ language plpython3u; I'm not a Python 3 expert, but I nicked some code from the Internet and came up with this patch (passes regression tests on both Python 2 and 3). The funny thing is that it never blew up earlier, because we only used plpy.SPIError in except: blocks that weren't even executed, as errors in plpy.execute just terminate the function. With my changes they turn into catchable exceptions, and so accessing plpy.SPIError in Python 3 becomes essential. BTW: do we have any buildfarm animal that uses Python 3? Cheers, Jan