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.
-- 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):
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):
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):
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):
-- 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):
-- 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):
-- 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):
-- Likewise for a mapping whose __len__() raises
CREATE FUNCTION test1brokenlen() RETURNS hstore
-LANGUAGE plpython3u
+LANGUAGE plpythonu
TRANSFORM FOR TYPE hstore
AS $$
class C(dict):
-- 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:
-- 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):
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):
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):
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):
-- 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:
-- 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):
-- 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):
-- 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):
-- 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):
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
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
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
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
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
def __getitem__(self, i):
raise ValueError('getitem failed')
return C()
-$$ LANGUAGE plpython3u;
+$$ LANGUAGE plpythonu;
SELECT * FROM composite_type_as_broken_sequence();
def __getitem__(self, i):
raise ValueError('getitem failed')
plpy.execute(plan, C())
-$$ LANGUAGE plpython3u;
+$$ LANGUAGE plpythonu;
SELECT plan_broken_arg_sequence();
def __getitem__(self, i):
raise ValueError('getitem failed')
plpy.prepare("select $1", C())
-$$ LANGUAGE plpython3u;
+$$ LANGUAGE plpythonu;
SELECT prepare_broken_type_sequence();
def __getitem__(self, i):
raise ValueError('getitem failed')
plpy.cursor(plan, C())
-$$ LANGUAGE plpython3u;
+$$ LANGUAGE plpythonu;
SELECT cursor_broken_arg_sequence();
def __getitem__(self, i):
raise ValueError('getitem failed')
return C()
-$$ LANGUAGE plpython3u;
+$$ LANGUAGE plpythonu;
SELECT * FROM test_type_conversion_array_getitem_fail();