Nathan Bossart writes:
> On Mon, Jul 25, 2022 at 04:40:51PM +0200, Martin Kalcher wrote:
>> +SELECT trim_array(ARRAY[]::int[], 1); -- fail
>> +ERROR: number of elements to trim must be between 0 and 0
> Can we improve the error message? Maybe it should look something like
> ERROR: number
On Mon, Jul 25, 2022 at 04:40:51PM +0200, Martin Kalcher wrote:
> +SELECT trim_array(ARRAY[]::int[], 1); -- fail
> +ERROR: number of elements to trim must be between 0 and 0
Can we improve the error message? Maybe it should look something like
ERROR: number of elements to trim must be
0200
Subject: [PATCH] Fix bounds check in trim_array()
The bounds check in trim_array() failed for empty arrays without any
dimension. It read the size of the first dimension without checking its
existence.
---
src/backend/utils/adt/arrayfuncs.c | 2 +-
src/test/regress/expected/arrays.out | 2 ++