Skip to content

Commit db23464

Browse files
committed
plpython: Remove regression test infrastructure for Python 2.
Since 19252e8 we reject Python 2 during build configuration. Now that the dust on the buildfarm has settled, remove regression testing infrastructure dealing with differing output between Python 2 / 3. Reviewed-By: Peter Eisentraut <peter@eisentraut.org> Reviewed-By: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/20211031184548.g4sxfe47n2kyi55r@alap3.anarazel.de
1 parent 76a29ad commit db23464

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+625
-2236
lines changed

contrib/hstore_plpython/.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# Generated subdirectories
2-
/expected/python3/
32
/log/
43
/results/
5-
/sql/python3/
64
/tmp_check/

contrib/hstore_plpython/Makefile

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ EXTENSION = hstore_plpython3u
1010
DATA = hstore_plpython3u--1.0.sql
1111

1212
REGRESS = hstore_plpython
13-
REGRESS_PLPYTHON3_MANGLE := $(REGRESS)
1413

1514
PG_CPPFLAGS = $(python_includespec) -DPLPYTHON_LIBNAME='"plpython$(python_majorversion)"'
1615

@@ -37,9 +36,4 @@ SHLIB_LINK += $(python_libspec) $(python_additional_libs)
3736
endif
3837

3938
REGRESS_OPTS += --load-extension=hstore
40-
ifeq ($(python_majorversion),2)
41-
REGRESS_OPTS += --load-extension=plpythonu --load-extension=hstore_plpythonu
42-
endif
4339
EXTRA_INSTALL += contrib/hstore
44-
45-
include $(top_srcdir)/src/pl/plpython/regress-python3-mangle.mk

contrib/hstore_plpython/expected/hstore_plpython.out

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
CREATE EXTENSION hstore_plpython2u CASCADE;
2-
NOTICE: installing required extension "plpython2u"
1+
CREATE EXTENSION hstore_plpython3u CASCADE;
2+
NOTICE: installing required extension "plpython3u"
33
-- test hstore -> python
44
CREATE FUNCTION test1(val hstore) RETURNS int
5-
LANGUAGE plpythonu
5+
LANGUAGE plpython3u
66
TRANSFORM FOR TYPE hstore
77
AS $$
88
assert isinstance(val, dict)
@@ -18,7 +18,7 @@ INFO: [('aa', 'bb'), ('cc', None)]
1818

1919
-- the same with the versioned language name
2020
CREATE FUNCTION test1n(val hstore) RETURNS int
21-
LANGUAGE plpython2u
21+
LANGUAGE plpython3u
2222
TRANSFORM FOR TYPE hstore
2323
AS $$
2424
assert isinstance(val, dict)
@@ -34,7 +34,7 @@ INFO: [('aa', 'bb'), ('cc', None)]
3434

3535
-- test hstore[] -> python
3636
CREATE FUNCTION test1arr(val hstore[]) RETURNS int
37-
LANGUAGE plpythonu
37+
LANGUAGE plpython3u
3838
TRANSFORM FOR TYPE hstore
3939
AS $$
4040
assert(val == [{'aa': 'bb', 'cc': None}, {'dd': 'ee'}])
@@ -48,7 +48,7 @@ SELECT test1arr(array['aa=>bb, cc=>NULL'::hstore, 'dd=>ee']);
4848

4949
-- test python -> hstore
5050
CREATE FUNCTION test2(a int, b text) RETURNS hstore
51-
LANGUAGE plpythonu
51+
LANGUAGE plpython3u
5252
TRANSFORM FOR TYPE hstore
5353
AS $$
5454
val = {'a': a, 'b': b, 'c': None}
@@ -65,14 +65,14 @@ SELECT test2(1, 'boo');
6565
CREATE OR REPLACE FUNCTION public.test2(a integer, b text)
6666
RETURNS hstore
6767
TRANSFORM FOR TYPE hstore
68-
LANGUAGE plpythonu
68+
LANGUAGE plpython3u
6969
AS $function$
7070
val = {'a': a, 'b': b, 'c': None}
7171
return val
7272
$function$
7373
-- test python -> hstore[]
7474
CREATE FUNCTION test2arr() RETURNS hstore[]
75-
LANGUAGE plpythonu
75+
LANGUAGE plpython3u
7676
TRANSFORM FOR TYPE hstore
7777
AS $$
7878
val = [{'a': 1, 'b': 'boo', 'c': None}, {'d': 2}]
@@ -87,7 +87,7 @@ SELECT test2arr();
8787
-- test python -> domain over hstore
8888
CREATE DOMAIN hstore_foo AS hstore CHECK(VALUE ? 'foo');
8989
CREATE FUNCTION test2dom(fn text) RETURNS hstore_foo
90-
LANGUAGE plpythonu
90+
LANGUAGE plpython3u
9191
TRANSFORM FOR TYPE hstore
9292
AS $$
9393
return {'a': 1, fn: 'boo', 'c': None}
@@ -104,7 +104,7 @@ CONTEXT: while creating return value
104104
PL/Python function "test2dom"
105105
-- test as part of prepare/execute
106106
CREATE FUNCTION test3() RETURNS void
107-
LANGUAGE plpythonu
107+
LANGUAGE plpython3u
108108
TRANSFORM FOR TYPE hstore
109109
AS $$
110110
rv = plpy.execute("SELECT 'aa=>bb, cc=>NULL'::hstore AS col1")
@@ -131,7 +131,7 @@ SELECT * FROM test1;
131131
(1 row)
132132

133133
CREATE FUNCTION test4() RETURNS trigger
134-
LANGUAGE plpythonu
134+
LANGUAGE plpython3u
135135
TRANSFORM FOR TYPE hstore
136136
AS $$
137137
assert(TD["new"] == {'a': 1, 'b': {'aa': 'bb', 'cc': None}})

contrib/hstore_plpython/sql/hstore_plpython.sql

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
CREATE EXTENSION hstore_plpython2u CASCADE;
1+
CREATE EXTENSION hstore_plpython3u CASCADE;
22

33

44
-- test hstore -> python
55
CREATE FUNCTION test1(val hstore) RETURNS int
6-
LANGUAGE plpythonu
6+
LANGUAGE plpython3u
77
TRANSFORM FOR TYPE hstore
88
AS $$
99
assert isinstance(val, dict)
@@ -16,7 +16,7 @@ SELECT test1('aa=>bb, cc=>NULL'::hstore);
1616

1717
-- the same with the versioned language name
1818
CREATE FUNCTION test1n(val hstore) RETURNS int
19-
LANGUAGE plpython2u
19+
LANGUAGE plpython3u
2020
TRANSFORM FOR TYPE hstore
2121
AS $$
2222
assert isinstance(val, dict)
@@ -29,7 +29,7 @@ SELECT test1n('aa=>bb, cc=>NULL'::hstore);
2929

3030
-- test hstore[] -> python
3131
CREATE FUNCTION test1arr(val hstore[]) RETURNS int
32-
LANGUAGE plpythonu
32+
LANGUAGE plpython3u
3333
TRANSFORM FOR TYPE hstore
3434
AS $$
3535
assert(val == [{'aa': 'bb', 'cc': None}, {'dd': 'ee'}])
@@ -41,7 +41,7 @@ SELECT test1arr(array['aa=>bb, cc=>NULL'::hstore, 'dd=>ee']);
4141

4242
-- test python -> hstore
4343
CREATE FUNCTION test2(a int, b text) RETURNS hstore
44-
LANGUAGE plpythonu
44+
LANGUAGE plpython3u
4545
TRANSFORM FOR TYPE hstore
4646
AS $$
4747
val = {'a': a, 'b': b, 'c': None}
@@ -56,7 +56,7 @@ SELECT test2(1, 'boo');
5656

5757
-- test python -> hstore[]
5858
CREATE FUNCTION test2arr() RETURNS hstore[]
59-
LANGUAGE plpythonu
59+
LANGUAGE plpython3u
6060
TRANSFORM FOR TYPE hstore
6161
AS $$
6262
val = [{'a': 1, 'b': 'boo', 'c': None}, {'d': 2}]
@@ -70,7 +70,7 @@ SELECT test2arr();
7070
CREATE DOMAIN hstore_foo AS hstore CHECK(VALUE ? 'foo');
7171

7272
CREATE FUNCTION test2dom(fn text) RETURNS hstore_foo
73-
LANGUAGE plpythonu
73+
LANGUAGE plpython3u
7474
TRANSFORM FOR TYPE hstore
7575
AS $$
7676
return {'a': 1, fn: 'boo', 'c': None}
@@ -82,7 +82,7 @@ SELECT test2dom('bar'); -- fail
8282

8383
-- test as part of prepare/execute
8484
CREATE FUNCTION test3() RETURNS void
85-
LANGUAGE plpythonu
85+
LANGUAGE plpython3u
8686
TRANSFORM FOR TYPE hstore
8787
AS $$
8888
rv = plpy.execute("SELECT 'aa=>bb, cc=>NULL'::hstore AS col1")
@@ -103,7 +103,7 @@ INSERT INTO test1 VALUES (1, 'aa=>bb, cc=>NULL');
103103
SELECT * FROM test1;
104104

105105
CREATE FUNCTION test4() RETURNS trigger
106-
LANGUAGE plpythonu
106+
LANGUAGE plpython3u
107107
TRANSFORM FOR TYPE hstore
108108
AS $$
109109
assert(TD["new"] == {'a': 1, 'b': {'aa': 'bb', 'cc': None}})

contrib/jsonb_plpython/.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# Generated subdirectories
2-
/expected/python3/
32
/log/
43
/results/
5-
/sql/python3/
64
/tmp_check/

contrib/jsonb_plpython/Makefile

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ EXTENSION = jsonb_plpython3u
1212
DATA = jsonb_plpython3u--1.0.sql
1313

1414
REGRESS = jsonb_plpython
15-
REGRESS_PLPYTHON3_MANGLE := $(REGRESS)
1615

1716
ifdef USE_PGXS
1817
PG_CONFIG = pg_config
@@ -33,9 +32,3 @@ else
3332
rpathdir = $(python_libdir)
3433
SHLIB_LINK += $(python_libspec) $(python_additional_libs)
3534
endif
36-
37-
ifeq ($(python_majorversion),2)
38-
REGRESS_OPTS += --load-extension=plpythonu --load-extension=jsonb_plpythonu
39-
endif
40-
41-
include $(top_srcdir)/src/pl/plpython/regress-python3-mangle.mk

contrib/jsonb_plpython/expected/jsonb_plpython.out

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
CREATE EXTENSION jsonb_plpython2u CASCADE;
2-
NOTICE: installing required extension "plpython2u"
1+
CREATE EXTENSION jsonb_plpython3u CASCADE;
2+
NOTICE: installing required extension "plpython3u"
33
-- test jsonb -> python dict
44
CREATE FUNCTION test1(val jsonb) RETURNS int
5-
LANGUAGE plpythonu
5+
LANGUAGE plpython3u
66
TRANSFORM FOR TYPE jsonb
77
AS $$
88
assert isinstance(val, dict)
@@ -18,7 +18,7 @@ SELECT test1('{"a": 1, "c": "NULL"}'::jsonb);
1818
-- test jsonb -> python dict
1919
-- complex dict with dicts as value
2020
CREATE FUNCTION test1complex(val jsonb) RETURNS int
21-
LANGUAGE plpython2u
21+
LANGUAGE plpython3u
2222
TRANSFORM FOR TYPE jsonb
2323
AS $$
2424
assert isinstance(val, dict)
@@ -34,7 +34,7 @@ SELECT test1complex('{"d": {"d": 1}}'::jsonb);
3434
-- test jsonb[] -> python dict
3535
-- dict with array as value
3636
CREATE FUNCTION test1arr(val jsonb) RETURNS int
37-
LANGUAGE plpythonu
37+
LANGUAGE plpython3u
3838
TRANSFORM FOR TYPE jsonb
3939
AS $$
4040
assert isinstance(val, dict)
@@ -50,7 +50,7 @@ SELECT test1arr('{"d":[12, 1]}'::jsonb);
5050
-- test jsonb[] -> python list
5151
-- simple list
5252
CREATE FUNCTION test2arr(val jsonb) RETURNS int
53-
LANGUAGE plpythonu
53+
LANGUAGE plpython3u
5454
TRANSFORM FOR TYPE jsonb
5555
AS $$
5656
assert isinstance(val, list)
@@ -66,7 +66,7 @@ SELECT test2arr('[12, 1]'::jsonb);
6666
-- test jsonb[] -> python list
6767
-- array of dicts
6868
CREATE FUNCTION test3arr(val jsonb) RETURNS int
69-
LANGUAGE plpythonu
69+
LANGUAGE plpython3u
7070
TRANSFORM FOR TYPE jsonb
7171
AS $$
7272
assert isinstance(val, list)
@@ -81,7 +81,7 @@ SELECT test3arr('[{"a": 1, "b": 2}, {"c": 3,"d": 4}]'::jsonb);
8181

8282
-- test jsonb int -> python int
8383
CREATE FUNCTION test1int(val jsonb) RETURNS int
84-
LANGUAGE plpythonu
84+
LANGUAGE plpython3u
8585
TRANSFORM FOR TYPE jsonb
8686
AS $$
8787
assert(val == 1)
@@ -95,7 +95,7 @@ SELECT test1int('1'::jsonb);
9595

9696
-- test jsonb string -> python string
9797
CREATE FUNCTION test1string(val jsonb) RETURNS text
98-
LANGUAGE plpythonu
98+
LANGUAGE plpython3u
9999
TRANSFORM FOR TYPE jsonb
100100
AS $$
101101
assert(val == "a")
@@ -109,7 +109,7 @@ SELECT test1string('"a"'::jsonb);
109109

110110
-- test jsonb null -> python None
111111
CREATE FUNCTION test1null(val jsonb) RETURNS int
112-
LANGUAGE plpythonu
112+
LANGUAGE plpython3u
113113
TRANSFORM FOR TYPE jsonb
114114
AS $$
115115
assert(val == None)
@@ -123,7 +123,7 @@ SELECT test1null('null'::jsonb);
123123

124124
-- test python -> jsonb
125125
CREATE FUNCTION roundtrip(val jsonb) RETURNS jsonb
126-
LANGUAGE plpythonu
126+
LANGUAGE plpython3u
127127
TRANSFORM FOR TYPE jsonb
128128
as $$
129129
return val
@@ -238,7 +238,7 @@ SELECT roundtrip('["string", "string2"]'::jsonb);
238238

239239
-- complex numbers -> jsonb
240240
CREATE FUNCTION testComplexNumbers() RETURNS jsonb
241-
LANGUAGE plpythonu
241+
LANGUAGE plpython3u
242242
TRANSFORM FOR TYPE jsonb
243243
AS $$
244244
x = 1 + 2j
@@ -250,7 +250,7 @@ CONTEXT: while creating return value
250250
PL/Python function "testcomplexnumbers"
251251
-- range -> jsonb
252252
CREATE FUNCTION testRange() RETURNS jsonb
253-
LANGUAGE plpythonu
253+
LANGUAGE plpython3u
254254
TRANSFORM FOR TYPE jsonb
255255
AS $$
256256
x = range(3)
@@ -264,7 +264,7 @@ SELECT testRange();
264264

265265
-- 0xff -> jsonb
266266
CREATE FUNCTION testDecimal() RETURNS jsonb
267-
LANGUAGE plpythonu
267+
LANGUAGE plpython3u
268268
TRANSFORM FOR TYPE jsonb
269269
AS $$
270270
x = 0xff
@@ -278,7 +278,7 @@ SELECT testDecimal();
278278

279279
-- tuple -> jsonb
280280
CREATE FUNCTION testTuple() RETURNS jsonb
281-
LANGUAGE plpythonu
281+
LANGUAGE plpython3u
282282
TRANSFORM FOR TYPE jsonb
283283
AS $$
284284
x = (1, 'String', None)
@@ -292,7 +292,7 @@ SELECT testTuple();
292292

293293
-- interesting dict -> jsonb
294294
CREATE FUNCTION test_dict1() RETURNS jsonb
295-
LANGUAGE plpythonu
295+
LANGUAGE plpython3u
296296
TRANSFORM FOR TYPE jsonb
297297
AS $$
298298
x = {"a": 1, None: 2, 33: 3}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy