Commit c155f654 authored by Bruce Momjian's avatar Bruce Momjian

intarray: return empty zero-dimensional array for an empty array

Previously a one-dimensional empty array was returned, but its text
representation matched a zero-dimensional array, and there is no way to
dump/reload a one-dimensional empty array.

BACKWARD INCOMPATIBILITY

Per report from elein
parent b8104730
......@@ -246,6 +246,13 @@ resize_intArrayType(ArrayType *a, int num)
int nbytes = ARR_DATA_OFFSET(a) + sizeof(int) * num;
int i;
/* if no elements, return a zero-dimensional array */
if (num == 0)
{
ARR_NDIM(a) = 0;
return a;
}
if (num == ARRNELEMS(a))
return a;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment