diff options
Diffstat (limited to 'src/include/utils/array.h')
-rw-r--r-- | src/include/utils/array.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/include/utils/array.h b/src/include/utils/array.h index b13dfb345ef..e6c8d88d9f2 100644 --- a/src/include/utils/array.h +++ b/src/include/utils/array.h @@ -75,6 +75,13 @@ struct ExprContext; #define MAXDIM 6 /* + * Maximum number of elements in an array. We limit this to at most about a + * quarter billion elements, so that it's not necessary to check for overflow + * in quite so many places --- for instance when palloc'ing Datum arrays. + */ +#define MaxArraySize ((Size) (MaxAllocSize / sizeof(Datum))) + +/* * Arrays are varlena objects, so must meet the varlena convention that * the first int32 of the object contains the total object size in bytes. * Be sure to use VARSIZE() and SET_VARSIZE() to access it, though! |