mirror of
https://git.postgresql.org/git/postgresql.git
synced 2026-02-07 13:17:36 +08:00
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.
This commit is contained in:
52
src/pl/plpython/expected/plpython_global.out
Normal file
52
src/pl/plpython/expected/plpython_global.out
Normal file
@ -0,0 +1,52 @@
|
||||
--
|
||||
-- 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();
|
||||
static_test
|
||||
-------------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
SELECT static_test();
|
||||
static_test
|
||||
-------------
|
||||
2
|
||||
(1 row)
|
||||
|
||||
SELECT global_test_one();
|
||||
global_test_one
|
||||
--------------------------------------------------------
|
||||
SD: set by global_test_one, GD: set by global_test_one
|
||||
(1 row)
|
||||
|
||||
SELECT global_test_two();
|
||||
global_test_two
|
||||
--------------------------------------------------------
|
||||
SD: set by global_test_two, GD: set by global_test_one
|
||||
(1 row)
|
||||
|
||||
Reference in New Issue
Block a user