mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
plpython: Remove regression test infrastructure for Python 2.
Since 19252e8ec9
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
This commit is contained in:
2
contrib/hstore_plpython/.gitignore
vendored
2
contrib/hstore_plpython/.gitignore
vendored
@ -1,6 +1,4 @@
|
||||
# Generated subdirectories
|
||||
/expected/python3/
|
||||
/log/
|
||||
/results/
|
||||
/sql/python3/
|
||||
/tmp_check/
|
||||
|
@ -10,7 +10,6 @@ EXTENSION = hstore_plpython3u
|
||||
DATA = hstore_plpython3u--1.0.sql
|
||||
|
||||
REGRESS = hstore_plpython
|
||||
REGRESS_PLPYTHON3_MANGLE := $(REGRESS)
|
||||
|
||||
PG_CPPFLAGS = $(python_includespec) -DPLPYTHON_LIBNAME='"plpython$(python_majorversion)"'
|
||||
|
||||
@ -37,9 +36,4 @@ SHLIB_LINK += $(python_libspec) $(python_additional_libs)
|
||||
endif
|
||||
|
||||
REGRESS_OPTS += --load-extension=hstore
|
||||
ifeq ($(python_majorversion),2)
|
||||
REGRESS_OPTS += --load-extension=plpythonu --load-extension=hstore_plpythonu
|
||||
endif
|
||||
EXTRA_INSTALL += contrib/hstore
|
||||
|
||||
include $(top_srcdir)/src/pl/plpython/regress-python3-mangle.mk
|
||||
|
@ -1,8 +1,8 @@
|
||||
CREATE EXTENSION hstore_plpython2u CASCADE;
|
||||
NOTICE: installing required extension "plpython2u"
|
||||
CREATE EXTENSION hstore_plpython3u CASCADE;
|
||||
NOTICE: installing required extension "plpython3u"
|
||||
-- test hstore -> python
|
||||
CREATE FUNCTION test1(val hstore) RETURNS int
|
||||
LANGUAGE plpythonu
|
||||
LANGUAGE plpython3u
|
||||
TRANSFORM FOR TYPE hstore
|
||||
AS $$
|
||||
assert isinstance(val, dict)
|
||||
@ -18,7 +18,7 @@ INFO: [('aa', 'bb'), ('cc', None)]
|
||||
|
||||
-- the same with the versioned language name
|
||||
CREATE FUNCTION test1n(val hstore) RETURNS int
|
||||
LANGUAGE plpython2u
|
||||
LANGUAGE plpython3u
|
||||
TRANSFORM FOR TYPE hstore
|
||||
AS $$
|
||||
assert isinstance(val, dict)
|
||||
@ -34,7 +34,7 @@ INFO: [('aa', 'bb'), ('cc', None)]
|
||||
|
||||
-- test hstore[] -> python
|
||||
CREATE FUNCTION test1arr(val hstore[]) RETURNS int
|
||||
LANGUAGE plpythonu
|
||||
LANGUAGE plpython3u
|
||||
TRANSFORM FOR TYPE hstore
|
||||
AS $$
|
||||
assert(val == [{'aa': 'bb', 'cc': None}, {'dd': 'ee'}])
|
||||
@ -48,7 +48,7 @@ SELECT test1arr(array['aa=>bb, cc=>NULL'::hstore, 'dd=>ee']);
|
||||
|
||||
-- test python -> hstore
|
||||
CREATE FUNCTION test2(a int, b text) RETURNS hstore
|
||||
LANGUAGE plpythonu
|
||||
LANGUAGE plpython3u
|
||||
TRANSFORM FOR TYPE hstore
|
||||
AS $$
|
||||
val = {'a': a, 'b': b, 'c': None}
|
||||
@ -65,14 +65,14 @@ SELECT test2(1, 'boo');
|
||||
CREATE OR REPLACE FUNCTION public.test2(a integer, b text)
|
||||
RETURNS hstore
|
||||
TRANSFORM FOR TYPE hstore
|
||||
LANGUAGE plpythonu
|
||||
LANGUAGE plpython3u
|
||||
AS $function$
|
||||
val = {'a': a, 'b': b, 'c': None}
|
||||
return val
|
||||
$function$
|
||||
-- test python -> hstore[]
|
||||
CREATE FUNCTION test2arr() RETURNS hstore[]
|
||||
LANGUAGE plpythonu
|
||||
LANGUAGE plpython3u
|
||||
TRANSFORM FOR TYPE hstore
|
||||
AS $$
|
||||
val = [{'a': 1, 'b': 'boo', 'c': None}, {'d': 2}]
|
||||
@ -87,7 +87,7 @@ SELECT test2arr();
|
||||
-- test python -> domain over hstore
|
||||
CREATE DOMAIN hstore_foo AS hstore CHECK(VALUE ? 'foo');
|
||||
CREATE FUNCTION test2dom(fn text) RETURNS hstore_foo
|
||||
LANGUAGE plpythonu
|
||||
LANGUAGE plpython3u
|
||||
TRANSFORM FOR TYPE hstore
|
||||
AS $$
|
||||
return {'a': 1, fn: 'boo', 'c': None}
|
||||
@ -104,7 +104,7 @@ CONTEXT: while creating return value
|
||||
PL/Python function "test2dom"
|
||||
-- test as part of prepare/execute
|
||||
CREATE FUNCTION test3() RETURNS void
|
||||
LANGUAGE plpythonu
|
||||
LANGUAGE plpython3u
|
||||
TRANSFORM FOR TYPE hstore
|
||||
AS $$
|
||||
rv = plpy.execute("SELECT 'aa=>bb, cc=>NULL'::hstore AS col1")
|
||||
@ -131,7 +131,7 @@ SELECT * FROM test1;
|
||||
(1 row)
|
||||
|
||||
CREATE FUNCTION test4() RETURNS trigger
|
||||
LANGUAGE plpythonu
|
||||
LANGUAGE plpython3u
|
||||
TRANSFORM FOR TYPE hstore
|
||||
AS $$
|
||||
assert(TD["new"] == {'a': 1, 'b': {'aa': 'bb', 'cc': None}})
|
||||
|
@ -1,9 +1,9 @@
|
||||
CREATE EXTENSION hstore_plpython2u CASCADE;
|
||||
CREATE EXTENSION hstore_plpython3u CASCADE;
|
||||
|
||||
|
||||
-- test hstore -> python
|
||||
CREATE FUNCTION test1(val hstore) RETURNS int
|
||||
LANGUAGE plpythonu
|
||||
LANGUAGE plpython3u
|
||||
TRANSFORM FOR TYPE hstore
|
||||
AS $$
|
||||
assert isinstance(val, dict)
|
||||
@ -16,7 +16,7 @@ SELECT test1('aa=>bb, cc=>NULL'::hstore);
|
||||
|
||||
-- the same with the versioned language name
|
||||
CREATE FUNCTION test1n(val hstore) RETURNS int
|
||||
LANGUAGE plpython2u
|
||||
LANGUAGE plpython3u
|
||||
TRANSFORM FOR TYPE hstore
|
||||
AS $$
|
||||
assert isinstance(val, dict)
|
||||
@ -29,7 +29,7 @@ SELECT test1n('aa=>bb, cc=>NULL'::hstore);
|
||||
|
||||
-- test hstore[] -> python
|
||||
CREATE FUNCTION test1arr(val hstore[]) RETURNS int
|
||||
LANGUAGE plpythonu
|
||||
LANGUAGE plpython3u
|
||||
TRANSFORM FOR TYPE hstore
|
||||
AS $$
|
||||
assert(val == [{'aa': 'bb', 'cc': None}, {'dd': 'ee'}])
|
||||
@ -41,7 +41,7 @@ SELECT test1arr(array['aa=>bb, cc=>NULL'::hstore, 'dd=>ee']);
|
||||
|
||||
-- test python -> hstore
|
||||
CREATE FUNCTION test2(a int, b text) RETURNS hstore
|
||||
LANGUAGE plpythonu
|
||||
LANGUAGE plpython3u
|
||||
TRANSFORM FOR TYPE hstore
|
||||
AS $$
|
||||
val = {'a': a, 'b': b, 'c': None}
|
||||
@ -56,7 +56,7 @@ SELECT test2(1, 'boo');
|
||||
|
||||
-- test python -> hstore[]
|
||||
CREATE FUNCTION test2arr() RETURNS hstore[]
|
||||
LANGUAGE plpythonu
|
||||
LANGUAGE plpython3u
|
||||
TRANSFORM FOR TYPE hstore
|
||||
AS $$
|
||||
val = [{'a': 1, 'b': 'boo', 'c': None}, {'d': 2}]
|
||||
@ -70,7 +70,7 @@ SELECT test2arr();
|
||||
CREATE DOMAIN hstore_foo AS hstore CHECK(VALUE ? 'foo');
|
||||
|
||||
CREATE FUNCTION test2dom(fn text) RETURNS hstore_foo
|
||||
LANGUAGE plpythonu
|
||||
LANGUAGE plpython3u
|
||||
TRANSFORM FOR TYPE hstore
|
||||
AS $$
|
||||
return {'a': 1, fn: 'boo', 'c': None}
|
||||
@ -82,7 +82,7 @@ SELECT test2dom('bar'); -- fail
|
||||
|
||||
-- test as part of prepare/execute
|
||||
CREATE FUNCTION test3() RETURNS void
|
||||
LANGUAGE plpythonu
|
||||
LANGUAGE plpython3u
|
||||
TRANSFORM FOR TYPE hstore
|
||||
AS $$
|
||||
rv = plpy.execute("SELECT 'aa=>bb, cc=>NULL'::hstore AS col1")
|
||||
@ -103,7 +103,7 @@ INSERT INTO test1 VALUES (1, 'aa=>bb, cc=>NULL');
|
||||
SELECT * FROM test1;
|
||||
|
||||
CREATE FUNCTION test4() RETURNS trigger
|
||||
LANGUAGE plpythonu
|
||||
LANGUAGE plpython3u
|
||||
TRANSFORM FOR TYPE hstore
|
||||
AS $$
|
||||
assert(TD["new"] == {'a': 1, 'b': {'aa': 'bb', 'cc': None}})
|
||||
|
Reference in New Issue
Block a user