summaryrefslogtreecommitdiff
path: root/src/pl
diff options
context:
space:
mode:
authorPeter Eisentraut2017-08-04 22:31:01 +0000
committerPeter Eisentraut2017-08-04 22:31:32 +0000
commit26d40ada3fa5d2671a16c34b2283448832630c86 (patch)
tree49053f3881228d2f02278ef74d8c1dc9d2ec54c6 /src/pl
parent620b49a16d2a16ce6f9edf072a88111f981919d0 (diff)
Message style improvements
Diffstat (limited to 'src/pl')
-rw-r--r--src/pl/plpython/expected/plpython_types.out3
-rw-r--r--src/pl/plpython/expected/plpython_types_3.out3
-rw-r--r--src/pl/plpython/plpy_typeio.c10
3 files changed, 9 insertions, 7 deletions
diff --git a/src/pl/plpython/expected/plpython_types.out b/src/pl/plpython/expected/plpython_types.out
index 10f7125d841..893de301dda 100644
--- a/src/pl/plpython/expected/plpython_types.out
+++ b/src/pl/plpython/expected/plpython_types.out
@@ -691,7 +691,8 @@ CREATE FUNCTION test_type_conversion_mdarray_malformed() RETURNS int[] AS $$
return [[1,2,3],[4,5]]
$$ LANGUAGE plpythonu;
SELECT * FROM test_type_conversion_mdarray_malformed();
-ERROR: multidimensional arrays must have array expressions with matching dimensions. PL/Python function return value has sequence length 2 while expected 3
+ERROR: wrong length of inner sequence: has length 2, but 3 was expected
+DETAIL: To construct a multidimensional array, the inner sequences must all have the same length.
CONTEXT: while creating return value
PL/Python function "test_type_conversion_mdarray_malformed"
CREATE FUNCTION test_type_conversion_mdarray_toodeep() RETURNS int[] AS $$
diff --git a/src/pl/plpython/expected/plpython_types_3.out b/src/pl/plpython/expected/plpython_types_3.out
index f7f0d31fef8..2d853bd5731 100644
--- a/src/pl/plpython/expected/plpython_types_3.out
+++ b/src/pl/plpython/expected/plpython_types_3.out
@@ -691,7 +691,8 @@ CREATE FUNCTION test_type_conversion_mdarray_malformed() RETURNS int[] AS $$
return [[1,2,3],[4,5]]
$$ LANGUAGE plpython3u;
SELECT * FROM test_type_conversion_mdarray_malformed();
-ERROR: multidimensional arrays must have array expressions with matching dimensions. PL/Python function return value has sequence length 2 while expected 3
+ERROR: wrong length of inner sequence: has length 2, but 3 was expected
+DETAIL: To construct a multidimensional array, the inner sequences must all have the same length.
CONTEXT: while creating return value
PL/Python function "test_type_conversion_mdarray_malformed"
CREATE FUNCTION test_type_conversion_mdarray_toodeep() RETURNS int[] AS $$
diff --git a/src/pl/plpython/plpy_typeio.c b/src/pl/plpython/plpy_typeio.c
index 4dfa3e8f915..91ddcaa7b9c 100644
--- a/src/pl/plpython/plpy_typeio.c
+++ b/src/pl/plpython/plpy_typeio.c
@@ -1002,7 +1002,7 @@ PLySequence_ToArray(PLyObToDatum *arg, int32 typmod, PyObject *plrv, bool inarra
dims[ndim] = PySequence_Length(pyptr);
if (dims[ndim] < 0)
- PLy_elog(ERROR, "cannot determine sequence length for function return value");
+ PLy_elog(ERROR, "could not determine sequence length for function return value");
if (dims[ndim] > MaxAllocSize)
PLy_elog(ERROR, "array size exceeds the maximum allowed");
@@ -1087,10 +1087,10 @@ PLySequence_ToArray_recurse(PLyObToDatum *elm, PyObject *list,
int i;
if (PySequence_Length(list) != dims[dim])
- PLy_elog(ERROR,
- "multidimensional arrays must have array expressions with matching dimensions. "
- "PL/Python function return value has sequence length %d while expected %d",
- (int) PySequence_Length(list), dims[dim]);
+ ereport(ERROR,
+ (errmsg("wrong length of inner sequence: has length %d, but %d was expected",
+ (int) PySequence_Length(list), dims[dim]),
+ (errdetail("To construct a multidimensional array, the inner sequences must all have the same length."))));
if (dim < ndim - 1)
{