1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-13 14:22:43 +03:00
Files
postgres/src/pl/plpython/sql/plpython_global.sql
Peter Eisentraut 5dff93638c Make PL/Python tests more compatible with Python 3
This changes a bunch of incidentially used constructs in the PL/Python
regression tests to equivalent constructs in cases where Python 3 no longer
supports the old syntax.  Support for older Python versions is unchanged.
2009-08-24 20:25:25 +00:00

39 lines
901 B
SQL

--
-- check static and global data (SD and GD)
--
CREATE FUNCTION global_test_one() returns text
AS
'if "global_test" not in SD:
SD["global_test"] = "set by global_test_one"
if "global_test" not in GD:
GD["global_test"] = "set by global_test_one"
return "SD: " + SD["global_test"] + ", GD: " + GD["global_test"]'
LANGUAGE plpythonu;
CREATE FUNCTION global_test_two() returns text
AS
'if "global_test" not in SD:
SD["global_test"] = "set by global_test_two"
if "global_test" not in GD:
GD["global_test"] = "set by global_test_two"
return "SD: " + SD["global_test"] + ", GD: " + GD["global_test"]'
LANGUAGE plpythonu;
CREATE FUNCTION static_test() returns int4
AS
'if "call" in SD:
SD["call"] = SD["call"] + 1
else:
SD["call"] = 1
return SD["call"]
'
LANGUAGE plpythonu;
SELECT static_test();
SELECT static_test();
SELECT global_test_one();
SELECT global_test_two();