Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6b72aa5

Browse files
committed
Add a regression test case for bug #5497
1 parentbc325d8 commit6b72aa5

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+
CREATEFUNCTIONtest_type_conversion_array_text(xtext[]) RETURNStext[]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
CREATEFUNCTIONtest_type_conversion_array_bytea(xbytea[]) RETURNSbytea[]AS $$
227235
plpy.info(x, type(x))
228236
return x

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp