diff options
| author | Peter Eisentraut <peter_e@gmx.net> | 2009-08-12 16:37:26 +0000 |
|---|---|---|
| committer | Peter Eisentraut <peter_e@gmx.net> | 2009-08-12 16:37:26 +0000 |
| commit | 9d9848668fd868a4e51f3a3f22c2807ff0e46582 (patch) | |
| tree | 22b0152fb889ca42d3e4c6ce888d2024b8b8c98b /src/pl/plpython/sql/plpython_global.sql | |
| parent | ef7574eb014b66d99a5e68cc254e7a2282e69a00 (diff) | |
| download | postgresql-9d9848668fd868a4e51f3a3f22c2807ff0e46582.tar.gz | |
Split the plpython regression test into test cases arranged by topic, instead
of the previous monolithic setup-create-run sequence, that was apparently
inherited from a previous test infrastructure, but makes working with the
tests and adding new ones weird.
Diffstat (limited to 'src/pl/plpython/sql/plpython_global.sql')
| -rw-r--r-- | src/pl/plpython/sql/plpython_global.sql | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/pl/plpython/sql/plpython_global.sql b/src/pl/plpython/sql/plpython_global.sql new file mode 100644 index 0000000000..e676ad6f43 --- /dev/null +++ b/src/pl/plpython/sql/plpython_global.sql @@ -0,0 +1,38 @@ +-- +-- check static and global data (SD and GD) +-- + +CREATE FUNCTION global_test_one() returns text + AS +'if not SD.has_key("global_test"): + SD["global_test"] = "set by global_test_one" +if not GD.has_key("global_test"): + 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 not SD.has_key("global_test"): + SD["global_test"] = "set by global_test_two" +if not GD.has_key("global_test"): + 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 SD.has_key("call"): + 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(); |
