mirror of
https://github.com/postgres/postgres.git
synced 2025-04-25 21:42:33 +03: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 nbytes = ARR_DATA_OFFSET(a) + sizeof(int) * num;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
/* if no elements, return a zero-dimensional array */
|
||||||
|
if (num == 0)
|
||||||
|
{
|
||||||
|
ARR_NDIM(a) = 0;
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
if (num == ARRNELEMS(a))
|
if (num == ARRNELEMS(a))
|
||||||
return a;
|
return a;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user