diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2010-06-12 06:05:20 +0000 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2010-06-12 06:05:20 +0000 |
commit | 6b72aa515498d76eb9459d989843eed6e8b3b219 (patch) | |
tree | 6beeaecc277f1db334d44123a8b14bf1b1564cc9 | |
parent | bc325d843235803356eb9e67cc4c7622df33c02d (diff) | |
download | postgresql-6b72aa515498d76eb9459d989843eed6e8b3b219.tar.gz postgresql-6b72aa515498d76eb9459d989843eed6e8b3b219.zip |
Add a regression test case for bug #5497
-rw-r--r-- | src/pl/plpython/expected/plpython_types.out | 12 | ||||
-rw-r--r-- | src/pl/plpython/expected/plpython_types_3.out | 12 | ||||
-rw-r--r-- | src/pl/plpython/sql/plpython_types.sql | 8 |
3 files changed, 32 insertions, 0 deletions
diff --git a/src/pl/plpython/expected/plpython_types.out b/src/pl/plpython/expected/plpython_types.out index 502dbb5cc07..a1659362820 100644 --- a/src/pl/plpython/expected/plpython_types.out +++ b/src/pl/plpython/expected/plpython_types.out @@ -528,6 +528,18 @@ SELECT * FROM test_type_conversion_array_int4(ARRAY[[1,2,3],[4,5,6]]); ERROR: cannot convert multidimensional array to Python list DETAIL: PL/Python only supports one-dimensional arrays. CONTEXT: PL/Python function "test_type_conversion_array_int4" +CREATE FUNCTION test_type_conversion_array_text(x text[]) RETURNS text[] AS $$ +plpy.info(x, type(x)) +return x +$$ LANGUAGE plpythonu; +SELECT * FROM test_type_conversion_array_text(ARRAY['foo', 'bar']); +INFO: (['foo', 'bar'], <type 'list'>) +CONTEXT: PL/Python function "test_type_conversion_array_text" + test_type_conversion_array_text +--------------------------------- + {foo,bar} +(1 row) + CREATE FUNCTION test_type_conversion_array_bytea(x bytea[]) RETURNS bytea[] AS $$ plpy.info(x, type(x)) return x diff --git a/src/pl/plpython/expected/plpython_types_3.out b/src/pl/plpython/expected/plpython_types_3.out index d88495512c8..38ddf029850 100644 --- a/src/pl/plpython/expected/plpython_types_3.out +++ b/src/pl/plpython/expected/plpython_types_3.out @@ -528,6 +528,18 @@ SELECT * FROM test_type_conversion_array_int4(ARRAY[[1,2,3],[4,5,6]]); ERROR: cannot convert multidimensional array to Python list DETAIL: PL/Python only supports one-dimensional arrays. CONTEXT: PL/Python function "test_type_conversion_array_int4" +CREATE FUNCTION test_type_conversion_array_text(x text[]) RETURNS text[] AS $$ +plpy.info(x, type(x)) +return x +$$ LANGUAGE plpython3u; +SELECT * FROM test_type_conversion_array_text(ARRAY['foo', 'bar']); +INFO: (['foo', 'bar'], <class 'list'>) +CONTEXT: PL/Python function "test_type_conversion_array_text" + test_type_conversion_array_text +--------------------------------- + {foo,bar} +(1 row) + CREATE FUNCTION test_type_conversion_array_bytea(x bytea[]) RETURNS bytea[] AS $$ plpy.info(x, type(x)) return x diff --git a/src/pl/plpython/sql/plpython_types.sql b/src/pl/plpython/sql/plpython_types.sql index 0b905d18027..2afc2ffcc11 100644 --- a/src/pl/plpython/sql/plpython_types.sql +++ b/src/pl/plpython/sql/plpython_types.sql @@ -223,6 +223,14 @@ SELECT * FROM test_type_conversion_array_int4(NULL); SELECT * FROM test_type_conversion_array_int4(ARRAY[[1,2,3],[4,5,6]]); +CREATE FUNCTION test_type_conversion_array_text(x text[]) RETURNS text[] AS $$ +plpy.info(x, type(x)) +return x +$$ LANGUAGE plpythonu; + +SELECT * FROM test_type_conversion_array_text(ARRAY['foo', 'bar']); + + CREATE FUNCTION test_type_conversion_array_bytea(x bytea[]) RETURNS bytea[] AS $$ plpy.info(x, type(x)) return x |