38 for (
i = n - 1;
i >= 0;
i--)
40 offset += (indx[
i] - lb[
i]) *
scale;
56 for (
i = 0;
i < n;
i++)
91 #define MaxArraySize ((Size) (MaxAllocSize / sizeof(Datum)))
96 for (
i = 0;
i < ndim;
i++)
103 (
errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
104 errmsg(
"array size exceeds the maximum allowed (%d)",
107 prod = (int64) ret * (int64) dims[
i];
110 if ((int64) ret != prod)
112 (
errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
113 errmsg(
"array size exceeds the maximum allowed (%d)",
119 (
errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
120 errmsg(
"array size exceeds the maximum allowed (%d)",
149 struct Node *escontext)
153 for (
i = 0;
i < ndim;
i++)
160 (
errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
161 errmsg(
"array lower bound is too large: %d",
178 for (
i = 0;
i < n;
i++)
179 span[
i] = endp[
i] - st[
i] + 1;
193 for (
i = n - 2;
i >= 0;
i--)
194 prod[
i] = prod[
i + 1] *
range[
i + 1];
210 for (
j = n - 2;
j >= 0;
j--)
212 dist[
j] = prod[
j] - 1;
213 for (
i =
j + 1;
i < n;
i++)
214 dist[
j] -= (span[
i] - 1) * prod[
i];
236 curr[n - 1] = (curr[n - 1] + 1) % span[n - 1];
237 for (
i = n - 1;
i && curr[
i] == 0;
i--)
238 curr[
i - 1] = (curr[
i - 1] + 1) % span[
i - 1];
262 (
errcode(ERRCODE_ARRAY_ELEMENT_ERROR),
263 errmsg(
"typmod array must be type cstring[]")));
267 (
errcode(ERRCODE_ARRAY_SUBSCRIPT_ERROR),
268 errmsg(
"typmod array must be one-dimensional")));
272 (
errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
273 errmsg(
"typmod array must not contain nulls")));
279 for (
i = 0;
i < *n;
i++)
bool array_contains_nulls(ArrayType *array)
void deconstruct_array_builtin(ArrayType *array, Oid elmtype, Datum **elemsp, bool **nullsp, int *nelemsp)
void mda_get_offset_values(int n, int *dist, const int *prod, const int *span)
int ArrayGetNItemsSafe(int ndim, const int *dims, struct Node *escontext)
bool ArrayCheckBoundsSafe(int ndim, const int *dims, const int *lb, struct Node *escontext)
int ArrayGetOffset(int n, const int *dim, const int *lb, const int *indx)
void mda_get_range(int n, int *span, const int *st, const int *endp)
int ArrayGetNItems(int ndim, const int *dims)
void mda_get_prod(int n, const int *range, int *prod)
int ArrayGetOffset0(int n, const int *tup, const int *scale)
void ArrayCheckBounds(int ndim, const int *dims, const int *lb)
int mda_next_tuple(int n, int *curr, const int *span)
int32 * ArrayGetIntegerTypmods(ArrayType *arr, int *n)
#define PG_USED_FOR_ASSERTS_ONLY
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereturn(context, dummy_value,...)
#define ereport(elevel,...)
static bool pg_add_s32_overflow(int32 a, int32 b, int32 *result)
Assert(fmt[strlen(fmt) - 1] !='\n')
void pfree(void *pointer)
int32 pg_strtoint32(const char *s)
static char * DatumGetCString(Datum X)
static struct cvec * range(struct vars *v, chr a, chr b, int cases)