From dd4cd55c15886c46378dc27f44f59a6de8c4d45b Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 15 Dec 2009 22:59:55 +0000 Subject: Python 3 support in PL/Python Behaves more or less unchanged compared to Python 2, but the new language variant is called plpython3u. Documentation describing the naming scheme is included. --- src/pl/plpython/sql/plpython_test.sql | 5 +++++ src/pl/plpython/sql/plpython_trigger.sql | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src/pl/plpython/sql') diff --git a/src/pl/plpython/sql/plpython_test.sql b/src/pl/plpython/sql/plpython_test.sql index 161399f2ec..7cae124d98 100644 --- a/src/pl/plpython/sql/plpython_test.sql +++ b/src/pl/plpython/sql/plpython_test.sql @@ -1,10 +1,15 @@ -- first some tests of basic functionality +CREATE LANGUAGE plpython2u; -- really stupid function just to get the module loaded CREATE FUNCTION stupid() RETURNS text AS 'return "zarkon"' LANGUAGE plpythonu; select stupid(); +-- check 2/3 versioning +CREATE FUNCTION stupidn() RETURNS text AS 'return "zarkon"' LANGUAGE plpython2u; + +select stupidn(); -- test multiple arguments CREATE FUNCTION argument_test_one(u users, a1 text, a2 text) RETURNS text diff --git a/src/pl/plpython/sql/plpython_trigger.sql b/src/pl/plpython/sql/plpython_trigger.sql index d6f441f827..c60a673780 100644 --- a/src/pl/plpython/sql/plpython_trigger.sql +++ b/src/pl/plpython/sql/plpython_trigger.sql @@ -67,7 +67,7 @@ SELECT * FROM users; CREATE TABLE trigger_test (i int, v text ); -CREATE FUNCTION trigger_data() returns trigger language plpythonu as $$ +CREATE FUNCTION trigger_data() RETURNS trigger LANGUAGE plpythonu AS $$ if 'relid' in TD: TD['relid'] = "bogus:12345" -- cgit v1.2.1