From 309dc4526de5ca4cb871fae80a1470feb0fad231 Mon Sep 17 00:00:00 2001 From: Richard Guo Date: Mon, 29 Jun 2026 14:21:15 +0900 Subject: [PATCH] Use plpythonu in plpython tests added by commit 0b7719f74 Commit 0b7719f74 added regression tests that spell the language name as plpython3u. That works on the master branch, but on v14 the plpython tests must use the unversioned name plpythonu: the plpython3u extension is built only in Python 3 builds, and for those builds regress-python3-mangle.mk rewrites plpythonu to plpython3u in the test files. In a Python 2 build the new tests instead failed with "language \"plpython3u\" does not exist". Spell the language as plpythonu in the new tests, matching every other plpython test in this branch, so they work in both Python 2 and Python 3 builds. This is needed only in v14; later branches no longer support Python 2 and have dropped the mangling step. Per buildfarm member hippopotamus. --- contrib/hstore_plpython/expected/hstore_plpython.out | 8 ++++---- contrib/hstore_plpython/sql/hstore_plpython.sql | 8 ++++---- contrib/jsonb_plpython/expected/jsonb_plpython.out | 10 +++++----- contrib/jsonb_plpython/sql/jsonb_plpython.sql | 10 +++++----- src/pl/plpython/expected/plpython_composite.out | 2 +- src/pl/plpython/expected/plpython_spi.out | 6 +++--- src/pl/plpython/expected/plpython_types.out | 2 +- src/pl/plpython/sql/plpython_composite.sql | 2 +- src/pl/plpython/sql/plpython_spi.sql | 6 +++--- src/pl/plpython/sql/plpython_types.sql | 2 +- 10 files changed, 28 insertions(+), 28 deletions(-) diff --git a/contrib/hstore_plpython/expected/hstore_plpython.out b/contrib/hstore_plpython/expected/hstore_plpython.out index b1837715ce5..121d0248d4c 100644 --- a/contrib/hstore_plpython/expected/hstore_plpython.out +++ b/contrib/hstore_plpython/expected/hstore_plpython.out @@ -46,7 +46,7 @@ PL/Python function "test1bad" -- A mapping whose items() raises should be reported as an error, not crash -- the backend CREATE FUNCTION test1broken() RETURNS hstore -LANGUAGE plpython3u +LANGUAGE plpythonu TRANSFORM FOR TYPE hstore AS $$ class C(dict): @@ -62,7 +62,7 @@ CONTEXT: while creating return value PL/Python function "test1broken" -- Likewise for a mapping whose items() does not return key/value pairs CREATE FUNCTION test1malformed() RETURNS hstore -LANGUAGE plpython3u +LANGUAGE plpythonu TRANSFORM FOR TYPE hstore AS $$ class C(dict): @@ -78,7 +78,7 @@ CONTEXT: while creating return value PL/Python function "test1malformed" -- Likewise for a mapping whose items() yields fewer pairs than its length CREATE FUNCTION test1short() RETURNS hstore -LANGUAGE plpython3u +LANGUAGE plpythonu TRANSFORM FOR TYPE hstore AS $$ class C(dict): @@ -94,7 +94,7 @@ CONTEXT: while creating return value PL/Python function "test1short" -- Likewise for a mapping whose __len__() raises CREATE FUNCTION test1brokenlen() RETURNS hstore -LANGUAGE plpython3u +LANGUAGE plpythonu TRANSFORM FOR TYPE hstore AS $$ class C(dict): diff --git a/contrib/hstore_plpython/sql/hstore_plpython.sql b/contrib/hstore_plpython/sql/hstore_plpython.sql index 8548b7dbe03..9923349dc0a 100644 --- a/contrib/hstore_plpython/sql/hstore_plpython.sql +++ b/contrib/hstore_plpython/sql/hstore_plpython.sql @@ -41,7 +41,7 @@ SELECT test1bad(); -- A mapping whose items() raises should be reported as an error, not crash -- the backend CREATE FUNCTION test1broken() RETURNS hstore -LANGUAGE plpython3u +LANGUAGE plpythonu TRANSFORM FOR TYPE hstore AS $$ class C(dict): @@ -57,7 +57,7 @@ SELECT test1broken(); -- Likewise for a mapping whose items() does not return key/value pairs CREATE FUNCTION test1malformed() RETURNS hstore -LANGUAGE plpython3u +LANGUAGE plpythonu TRANSFORM FOR TYPE hstore AS $$ class C(dict): @@ -73,7 +73,7 @@ SELECT test1malformed(); -- Likewise for a mapping whose items() yields fewer pairs than its length CREATE FUNCTION test1short() RETURNS hstore -LANGUAGE plpython3u +LANGUAGE plpythonu TRANSFORM FOR TYPE hstore AS $$ class C(dict): @@ -89,7 +89,7 @@ SELECT test1short(); -- Likewise for a mapping whose __len__() raises CREATE FUNCTION test1brokenlen() RETURNS hstore -LANGUAGE plpython3u +LANGUAGE plpythonu TRANSFORM FOR TYPE hstore AS $$ class C(dict): diff --git a/contrib/jsonb_plpython/expected/jsonb_plpython.out b/contrib/jsonb_plpython/expected/jsonb_plpython.out index f9bde492095..36712f45596 100644 --- a/contrib/jsonb_plpython/expected/jsonb_plpython.out +++ b/contrib/jsonb_plpython/expected/jsonb_plpython.out @@ -307,7 +307,7 @@ SELECT test_dict1(); -- A custom sequence whose __getitem__ raises should be reported as an error, -- not crash the backend CREATE FUNCTION test_broken_sequence() RETURNS jsonb -LANGUAGE plpython3u +LANGUAGE plpythonu TRANSFORM FOR TYPE jsonb AS $$ class C: @@ -326,7 +326,7 @@ PL/Python function "test_broken_sequence" -- A mapping whose items() raises should be reported as an error, not crash -- the backend CREATE FUNCTION test_broken_mapping() RETURNS jsonb -LANGUAGE plpython3u +LANGUAGE plpythonu TRANSFORM FOR TYPE jsonb AS $$ class C(dict): @@ -344,7 +344,7 @@ while creating return value PL/Python function "test_broken_mapping" -- Likewise for a mapping whose items() does not return key/value pairs CREATE FUNCTION test_malformed_mapping() RETURNS jsonb -LANGUAGE plpython3u +LANGUAGE plpythonu TRANSFORM FOR TYPE jsonb AS $$ class C(dict): @@ -360,7 +360,7 @@ CONTEXT: while creating return value PL/Python function "test_malformed_mapping" -- Likewise for a mapping whose items() yields fewer pairs than its length CREATE FUNCTION test_short_mapping() RETURNS jsonb -LANGUAGE plpython3u +LANGUAGE plpythonu TRANSFORM FOR TYPE jsonb AS $$ class C(dict): @@ -377,7 +377,7 @@ CONTEXT: while creating return value PL/Python function "test_short_mapping" -- Likewise for a mapping whose __len__() raises CREATE FUNCTION test_broken_len_mapping() RETURNS jsonb -LANGUAGE plpython3u +LANGUAGE plpythonu TRANSFORM FOR TYPE jsonb AS $$ class C(dict): diff --git a/contrib/jsonb_plpython/sql/jsonb_plpython.sql b/contrib/jsonb_plpython/sql/jsonb_plpython.sql index 78578fa3d8a..40832a49b3a 100644 --- a/contrib/jsonb_plpython/sql/jsonb_plpython.sql +++ b/contrib/jsonb_plpython/sql/jsonb_plpython.sql @@ -185,7 +185,7 @@ SELECT test_dict1(); -- A custom sequence whose __getitem__ raises should be reported as an error, -- not crash the backend CREATE FUNCTION test_broken_sequence() RETURNS jsonb -LANGUAGE plpython3u +LANGUAGE plpythonu TRANSFORM FOR TYPE jsonb AS $$ class C: @@ -201,7 +201,7 @@ SELECT test_broken_sequence(); -- A mapping whose items() raises should be reported as an error, not crash -- the backend CREATE FUNCTION test_broken_mapping() RETURNS jsonb -LANGUAGE plpython3u +LANGUAGE plpythonu TRANSFORM FOR TYPE jsonb AS $$ class C(dict): @@ -216,7 +216,7 @@ SELECT test_broken_mapping(); -- Likewise for a mapping whose items() does not return key/value pairs CREATE FUNCTION test_malformed_mapping() RETURNS jsonb -LANGUAGE plpython3u +LANGUAGE plpythonu TRANSFORM FOR TYPE jsonb AS $$ class C(dict): @@ -231,7 +231,7 @@ SELECT test_malformed_mapping(); -- Likewise for a mapping whose items() yields fewer pairs than its length CREATE FUNCTION test_short_mapping() RETURNS jsonb -LANGUAGE plpython3u +LANGUAGE plpythonu TRANSFORM FOR TYPE jsonb AS $$ class C(dict): @@ -246,7 +246,7 @@ SELECT test_short_mapping(); -- Likewise for a mapping whose __len__() raises CREATE FUNCTION test_broken_len_mapping() RETURNS jsonb -LANGUAGE plpython3u +LANGUAGE plpythonu TRANSFORM FOR TYPE jsonb AS $$ class C(dict): diff --git a/src/pl/plpython/expected/plpython_composite.out b/src/pl/plpython/expected/plpython_composite.out index a860dd24a57..e503de54b62 100644 --- a/src/pl/plpython/expected/plpython_composite.out +++ b/src/pl/plpython/expected/plpython_composite.out @@ -615,7 +615,7 @@ class C: def __getitem__(self, i): raise ValueError('getitem failed') return C() -$$ LANGUAGE plpython3u; +$$ LANGUAGE plpythonu; SELECT * FROM composite_type_as_broken_sequence(); ERROR: could not get element 0 from sequence DETAIL: ValueError: getitem failed diff --git a/src/pl/plpython/expected/plpython_spi.out b/src/pl/plpython/expected/plpython_spi.out index eeed3d25a7b..6cd9275b766 100644 --- a/src/pl/plpython/expected/plpython_spi.out +++ b/src/pl/plpython/expected/plpython_spi.out @@ -474,7 +474,7 @@ class C: def __getitem__(self, i): raise ValueError('getitem failed') plpy.execute(plan, C()) -$$ LANGUAGE plpython3u; +$$ LANGUAGE plpythonu; SELECT plan_broken_arg_sequence(); ERROR: spiexceptions.ExternalRoutineException: could not get element 0 from sequence DETAIL: ValueError: getitem failed @@ -490,7 +490,7 @@ class C: def __getitem__(self, i): raise ValueError('getitem failed') plpy.prepare("select $1", C()) -$$ LANGUAGE plpython3u; +$$ LANGUAGE plpythonu; SELECT prepare_broken_type_sequence(); ERROR: spiexceptions.ExternalRoutineException: could not get element 0 from sequence DETAIL: ValueError: getitem failed @@ -507,7 +507,7 @@ class C: def __getitem__(self, i): raise ValueError('getitem failed') plpy.cursor(plan, C()) -$$ LANGUAGE plpython3u; +$$ LANGUAGE plpythonu; SELECT cursor_broken_arg_sequence(); ERROR: spiexceptions.ExternalRoutineException: could not get element 0 from sequence DETAIL: ValueError: getitem failed diff --git a/src/pl/plpython/expected/plpython_types.out b/src/pl/plpython/expected/plpython_types.out index 6ef55a4efcc..98c7428eebf 100644 --- a/src/pl/plpython/expected/plpython_types.out +++ b/src/pl/plpython/expected/plpython_types.out @@ -805,7 +805,7 @@ class C: def __getitem__(self, i): raise ValueError('getitem failed') return C() -$$ LANGUAGE plpython3u; +$$ LANGUAGE plpythonu; SELECT * FROM test_type_conversion_array_getitem_fail(); ERROR: could not get element 0 from sequence DETAIL: ValueError: getitem failed diff --git a/src/pl/plpython/sql/plpython_composite.sql b/src/pl/plpython/sql/plpython_composite.sql index d7ac6463c1c..5537d754721 100644 --- a/src/pl/plpython/sql/plpython_composite.sql +++ b/src/pl/plpython/sql/plpython_composite.sql @@ -243,5 +243,5 @@ class C: def __getitem__(self, i): raise ValueError('getitem failed') return C() -$$ LANGUAGE plpython3u; +$$ LANGUAGE plpythonu; SELECT * FROM composite_type_as_broken_sequence(); diff --git a/src/pl/plpython/sql/plpython_spi.sql b/src/pl/plpython/sql/plpython_spi.sql index 93d2b0d90cd..95481580c7b 100644 --- a/src/pl/plpython/sql/plpython_spi.sql +++ b/src/pl/plpython/sql/plpython_spi.sql @@ -331,7 +331,7 @@ class C: def __getitem__(self, i): raise ValueError('getitem failed') plpy.execute(plan, C()) -$$ LANGUAGE plpython3u; +$$ LANGUAGE plpythonu; SELECT plan_broken_arg_sequence(); @@ -343,7 +343,7 @@ class C: def __getitem__(self, i): raise ValueError('getitem failed') plpy.prepare("select $1", C()) -$$ LANGUAGE plpython3u; +$$ LANGUAGE plpythonu; SELECT prepare_broken_type_sequence(); @@ -356,6 +356,6 @@ class C: def __getitem__(self, i): raise ValueError('getitem failed') plpy.cursor(plan, C()) -$$ LANGUAGE plpython3u; +$$ LANGUAGE plpythonu; SELECT cursor_broken_arg_sequence(); diff --git a/src/pl/plpython/sql/plpython_types.sql b/src/pl/plpython/sql/plpython_types.sql index b64fac4d17f..5a6fdb26b14 100644 --- a/src/pl/plpython/sql/plpython_types.sql +++ b/src/pl/plpython/sql/plpython_types.sql @@ -426,7 +426,7 @@ class C: def __getitem__(self, i): raise ValueError('getitem failed') return C() -$$ LANGUAGE plpython3u; +$$ LANGUAGE plpythonu; SELECT * FROM test_type_conversion_array_getitem_fail();