mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-03-07 19:47:50 +08:00
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
This commit is contained in:
parent
b8104730c8
commit
c155f654b4
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user