Content-Length: 266684 | pFad | http://github.com/postgrespro/postgres_cluster/commit/c155f654b4f755b4111bd9adb60559fe22526a10

20 intarray: return empty zero-dimensional array for an empty array · postgrespro/postgres_cluster@c155f65 · GitHub
Skip to content

Commit c155f65

Browse files
committed
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
1 parent b810473 commit c155f65

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

contrib/intarray/_int_tool.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,13 @@ resize_intArrayType(ArrayType *a, int num)
246246
int nbytes = ARR_DATA_OFFSET(a) + sizeof(int) * num;
247247
int i;
248248

249+
/* if no elements, return a zero-dimensional array */
250+
if (num == 0)
251+
{
252+
ARR_NDIM(a) = 0;
253+
return a;
254+
}
255+
249256
if (num == ARRNELEMS(a))
250257
return a;
251258

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres_cluster/commit/c155f654b4f755b4111bd9adb60559fe22526a10

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy