1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-12 02:37:31 +03:00

Correctly add exceptions to the plpy module for Python 3

The way the exception types where added to the module was wrong for
Python 3.  Exception classes were not actually available from plpy.
Fix that by factoring out code that is responsible for defining new
Python exceptions and make it work with Python 3.  New regression test
makes sure the plpy module has the expected contents.

Jan Urbanśki, slightly revised by me
This commit is contained in:
Peter Eisentraut
2011-01-21 23:46:56 +02:00
parent d3b372e92d
commit 4609caf364
3 changed files with 54 additions and 11 deletions

View File

@@ -26,6 +26,17 @@ return words'
select argument_test_one(users, fname, lname) from users where lname = 'doe' order by 1;
-- check module contents
CREATE FUNCTION module_contents() RETURNS text AS
$$
contents = list(filter(lambda x: not x.startswith("__"), dir(plpy)))
contents.sort()
return ", ".join(contents)
$$ LANGUAGE plpythonu;
select module_contents();
CREATE FUNCTION elog_test() RETURNS void
AS $$
plpy.debug('debug')