Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6b72aa5

Browse files
committed
Add a regression test case for bug #5497
1 parent bc325d8 commit 6b72aa5

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

src/pl/plpython/expected/plpython_types.out

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,18 @@ SELECT * FROM test_type_conversion_array_int4(ARRAY[[1,2,3],[4,5,6]]);
528528
ERROR: cannot convert multidimensional array to Python list
529529
DETAIL: PL/Python only supports one-dimensional arrays.
530530
CONTEXT: PL/Python function "test_type_conversion_array_int4"
531+
CREATE FUNCTION test_type_conversion_array_text(x text[]) RETURNS text[] AS $$
532+
plpy.info(x, type(x))
533+
return x
534+
$$ LANGUAGE plpythonu;
535+
SELECT * FROM test_type_conversion_array_text(ARRAY['foo', 'bar']);
536+
INFO: (['foo', 'bar'], <type 'list'>)
537+
CONTEXT: PL/Python function "test_type_conversion_array_text"
538+
test_type_conversion_array_text
539+
---------------------------------
540+
{foo,bar}
541+
(1 row)
542+
531543
CREATE FUNCTION test_type_conversion_array_bytea(x bytea[]) RETURNS bytea[] AS $$
532544
plpy.info(x, type(x))
533545
return x

src/pl/plpython/expected/plpython_types_3.out

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,18 @@ SELECT * FROM test_type_conversion_array_int4(ARRAY[[1,2,3],[4,5,6]]);
528528
ERROR: cannot convert multidimensional array to Python list
529529
DETAIL: PL/Python only supports one-dimensional arrays.
530530
CONTEXT: PL/Python function "test_type_conversion_array_int4"
531+
CREATE FUNCTION test_type_conversion_array_text(x text[]) RETURNS text[] AS $$
532+
plpy.info(x, type(x))
533+
return x
534+
$$ LANGUAGE plpython3u;
535+
SELECT * FROM test_type_conversion_array_text(ARRAY['foo', 'bar']);
536+
INFO: (['foo', 'bar'], <class 'list'>)
537+
CONTEXT: PL/Python function "test_type_conversion_array_text"
538+
test_type_conversion_array_text
539+
---------------------------------
540+
{foo,bar}
541+
(1 row)
542+
531543
CREATE FUNCTION test_type_conversion_array_bytea(x bytea[]) RETURNS bytea[] AS $$
532544
plpy.info(x, type(x))
533545
return x

src/pl/plpython/sql/plpython_types.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,14 @@ SELECT * FROM test_type_conversion_array_int4(NULL);
223223
SELECT * FROM test_type_conversion_array_int4(ARRAY[[1,2,3],[4,5,6]]);
224224

225225

226+
CREATE FUNCTION test_type_conversion_array_text(x text[]) RETURNS text[] AS $$
227+
plpy.info(x, type(x))
228+
return x
229+
$$ LANGUAGE plpythonu;
230+
231+
SELECT * FROM test_type_conversion_array_text(ARRAY['foo', 'bar']);
232+
233+
226234
CREATE FUNCTION test_type_conversion_array_bytea(x bytea[]) RETURNS bytea[] AS $$
227235
plpy.info(x, type(x))
228236
return x

0 commit comments

Comments
 (0)