Hi,
while working on something else i encountered a bug in the trim_array()
function. The bounds check fails for empty arrays without any
dimensions. It reads the size of the non existing first dimension to
determine the arrays length.
select trim_array('{}'::int[], 10);
------------
{}
select trim_array('{}'::int[], 100);
ERROR: number of elements to trim must be between 0 and 64
The attached patch fixes that check.
Martin