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.
This commit is contained in:
Richard Guo 2026-06-29 14:21:15 +09:00
parent 0b7719f744
commit 309dc4526d
10 changed files with 28 additions and 28 deletions

View file

@ -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):

View file

@ -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):

View file

@ -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):

View file

@ -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):

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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();

View file

@ -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();

View file

@ -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();