1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-14 08:21:07 +03:00

Message style improvements

This commit is contained in:
Peter Eisentraut
2017-08-04 18:31:01 -04:00
parent 620b49a16d
commit 26d40ada3f
8 changed files with 29 additions and 25 deletions

View File

@ -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 $$

View File

@ -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 $$

View File

@ -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)
{