From 4609caf3645ae975724af1f7f57f831e516cf220 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Fri, 21 Jan 2011 23:46:56 +0200 Subject: Correctly add exceptions to the plpy module for Python 3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/pl/plpython/sql/plpython_test.sql | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/pl/plpython/sql/plpython_test.sql') diff --git a/src/pl/plpython/sql/plpython_test.sql b/src/pl/plpython/sql/plpython_test.sql index 7cae124d98..915189847a 100644 --- a/src/pl/plpython/sql/plpython_test.sql +++ b/src/pl/plpython/sql/plpython_test.sql @@ -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') -- cgit v1.2.1