PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
array.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * array.h
4  * Declarations for Postgres arrays.
5  *
6  * A standard varlena array has the following internal structure:
7  * <vl_len_> - standard varlena header word
8  * <ndim> - number of dimensions of the array
9  * <dataoffset> - offset to stored data, or 0 if no nulls bitmap
10  * <elemtype> - element type OID
11  * <dimensions> - length of each array axis (C array of int)
12  * <lower bnds> - lower boundary of each dimension (C array of int)
13  * <null bitmap> - bitmap showing locations of nulls (OPTIONAL)
14  * <actual data> - whatever is the stored data
15  *
16  * The <dimensions> and <lower bnds> arrays each have ndim elements.
17  *
18  * The <null bitmap> may be omitted if the array contains no NULL elements.
19  * If it is absent, the <dataoffset> field is zero and the offset to the
20  * stored data must be computed on-the-fly. If the bitmap is present,
21  * <dataoffset> is nonzero and is equal to the offset from the array start
22  * to the first data element (including any alignment padding). The bitmap
23  * follows the same conventions as tuple null bitmaps, ie, a 1 indicates
24  * a non-null entry and the LSB of each bitmap byte is used first.
25  *
26  * The actual data starts on a MAXALIGN boundary. Individual items in the
27  * array are aligned as specified by the array element type. They are
28  * stored in row-major order (last subscript varies most rapidly).
29  *
30  * NOTE: it is important that array elements of toastable datatypes NOT be
31  * toasted, since the tupletoaster won't know they are there. (We could
32  * support compressed toasted items; only out-of-line items are dangerous.
33  * However, it seems preferable to store such items uncompressed and allow
34  * the toaster to compress the whole array as one input.)
35  *
36  *
37  * The OIDVECTOR and INT2VECTOR datatypes are storage-compatible with
38  * generic arrays, but they support only one-dimensional arrays with no
39  * nulls (and no null bitmap). They don't support being toasted, either.
40  *
41  * There are also some "fixed-length array" datatypes, such as NAME and
42  * POINT. These are simply a sequence of a fixed number of items each
43  * of a fixed-length datatype, with no overhead; the item size must be
44  * a multiple of its alignment requirement, because we do no padding.
45  * We support subscripting on these types, but array_in() and array_out()
46  * only work with varlena arrays.
47  *
48  * In addition, arrays are a major user of the "expanded object" TOAST
49  * infrastructure. This allows a varlena array to be converted to a
50  * separate representation that may include "deconstructed" Datum/isnull
51  * arrays holding the elements.
52  *
53  *
54  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
55  * Portions Copyright (c) 1994, Regents of the University of California
56  *
57  * src/include/utils/array.h
58  *
59  *-------------------------------------------------------------------------
60  */
61 #ifndef ARRAY_H
62 #define ARRAY_H
63 
64 #include "fmgr.h"
65 #include "utils/expandeddatum.h"
66 
67 
68 /*
69  * Arrays are varlena objects, so must meet the varlena convention that
70  * the first int32 of the object contains the total object size in bytes.
71  * Be sure to use VARSIZE() and SET_VARSIZE() to access it, though!
72  *
73  * CAUTION: if you change the header for ordinary arrays you will also
74  * need to change the headers for oidvector and int2vector!
75  */
76 typedef struct
77 {
78  int32 vl_len_; /* varlena header (do not touch directly!) */
79  int ndim; /* # of dimensions */
80  int32 dataoffset; /* offset to data, or 0 if no bitmap */
81  Oid elemtype; /* element type OID */
82 } ArrayType;
83 
84 /*
85  * An expanded array is contained within a private memory context (as
86  * all expanded objects must be) and has a control structure as below.
87  *
88  * The expanded array might contain a regular "flat" array if that was the
89  * original input and we've not modified it significantly. Otherwise, the
90  * contents are represented by Datum/isnull arrays plus dimensionality and
91  * type information. We could also have both forms, if we've deconstructed
92  * the original array for access purposes but not yet changed it. For pass-
93  * by-reference element types, the Datums would point into the flat array in
94  * this situation. Once we start modifying array elements, new pass-by-ref
95  * elements are separately palloc'd within the memory context.
96  */
97 #define EA_MAGIC 689375833 /* ID for debugging crosschecks */
98 
99 typedef struct ExpandedArrayHeader
100 {
101  /* Standard header for expanded objects */
103 
104  /* Magic value identifying an expanded array (for debugging only) */
105  int ea_magic;
106 
107  /* Dimensionality info (always valid) */
108  int ndims; /* # of dimensions */
109  int *dims; /* array dimensions */
110  int *lbound; /* index lower bounds for each dimension */
111 
112  /* Element type info (always valid) */
113  Oid element_type; /* element type OID */
114  int16 typlen; /* needed info about element datatype */
115  bool typbyval;
116  char typalign;
117 
118  /*
119  * If we have a Datum-array representation of the array, it's kept here;
120  * else dvalues/dnulls are NULL. The dvalues and dnulls arrays are always
121  * palloc'd within the object private context, but may change size from
122  * time to time. For pass-by-ref element types, dvalues entries might
123  * point either into the fstartptr..fendptr area, or to separately
124  * palloc'd chunks. Elements should always be fully detoasted, as they
125  * are in the standard flat representation.
126  *
127  * Even when dvalues is valid, dnulls can be NULL if there are no null
128  * elements.
129  */
130  Datum *dvalues; /* array of Datums */
131  bool *dnulls; /* array of is-null flags for Datums */
132  int dvalueslen; /* allocated length of above arrays */
133  int nelems; /* number of valid entries in above arrays */
134 
135  /*
136  * flat_size is the current space requirement for the flat equivalent of
137  * the expanded array, if known; otherwise it's 0. We store this to make
138  * consecutive calls of get_flat_size cheap.
139  */
141 
142  /*
143  * fvalue points to the flat representation if it is valid, else it is
144  * NULL. If we have or ever had a flat representation then
145  * fstartptr/fendptr point to the start and end+1 of its data area; this
146  * is so that we can tell which Datum pointers point into the flat
147  * representation rather than being pointers to separately palloc'd data.
148  */
149  ArrayType *fvalue; /* must be a fully detoasted array */
150  char *fstartptr; /* start of its data area */
151  char *fendptr; /* end+1 of its data area */
153 
154 /*
155  * Functions that can handle either a "flat" varlena array or an expanded
156  * array use this union to work with their input.
157  */
158 typedef union AnyArrayType
159 {
162 } AnyArrayType;
163 
164 /*
165  * working state for accumArrayResult() and friends
166  * note that the input must be scalars (legal array elements)
167  */
168 typedef struct ArrayBuildState
169 {
170  MemoryContext mcontext; /* where all the temp stuff is kept */
171  Datum *dvalues; /* array of accumulated Datums */
172  bool *dnulls; /* array of is-null flags for Datums */
173  int alen; /* allocated length of above arrays */
174  int nelems; /* number of valid entries in above arrays */
175  Oid element_type; /* data type of the Datums */
176  int16 typlen; /* needed info about datatype */
177  bool typbyval;
178  char typalign;
179  bool private_cxt; /* use private memory context */
181 
182 /*
183  * working state for accumArrayResultArr() and friends
184  * note that the input must be arrays, and the same array type is returned
185  */
186 typedef struct ArrayBuildStateArr
187 {
188  MemoryContext mcontext; /* where all the temp stuff is kept */
189  char *data; /* accumulated data */
190  bits8 *nullbitmap; /* bitmap of is-null flags, or NULL if none */
191  int abytes; /* allocated length of "data" */
192  int nbytes; /* number of bytes used so far */
193  int aitems; /* allocated length of bitmap (in elements) */
194  int nitems; /* total number of elements in result */
195  int ndims; /* current dimensions of result */
196  int dims[MAXDIM];
197  int lbs[MAXDIM];
198  Oid array_type; /* data type of the arrays */
199  Oid element_type; /* data type of the array elements */
200  bool private_cxt; /* use private memory context */
202 
203 /*
204  * working state for accumArrayResultAny() and friends
205  * these functions handle both cases
206  */
207 typedef struct ArrayBuildStateAny
208 {
209  /* Exactly one of these is not NULL: */
213 
214 /*
215  * structure to cache type metadata needed for array manipulation
216  */
217 typedef struct ArrayMetaState
218 {
221  bool typbyval;
222  char typalign;
223  char typdelim;
228 
229 /*
230  * private state needed by array_map (here because caller must provide it)
231  */
232 typedef struct ArrayMapState
233 {
236 } ArrayMapState;
237 
238 /* ArrayIteratorData is private in arrayfuncs.c */
240 
241 /* fmgr macros for regular varlena array objects */
242 #define DatumGetArrayTypeP(X) ((ArrayType *) PG_DETOAST_DATUM(X))
243 #define DatumGetArrayTypePCopy(X) ((ArrayType *) PG_DETOAST_DATUM_COPY(X))
244 #define PG_GETARG_ARRAYTYPE_P(n) DatumGetArrayTypeP(PG_GETARG_DATUM(n))
245 #define PG_GETARG_ARRAYTYPE_P_COPY(n) DatumGetArrayTypePCopy(PG_GETARG_DATUM(n))
246 #define PG_RETURN_ARRAYTYPE_P(x) PG_RETURN_POINTER(x)
247 
248 /* fmgr macros for expanded array objects */
249 #define PG_GETARG_EXPANDED_ARRAY(n) DatumGetExpandedArray(PG_GETARG_DATUM(n))
250 #define PG_GETARG_EXPANDED_ARRAYX(n, metacache) \
251  DatumGetExpandedArrayX(PG_GETARG_DATUM(n), metacache)
252 #define PG_RETURN_EXPANDED_ARRAY(x) PG_RETURN_DATUM(EOHPGetRWDatum(&(x)->hdr))
253 
254 /* fmgr macros for AnyArrayType (ie, get either varlena or expanded form) */
255 #define PG_GETARG_ANY_ARRAY(n) DatumGetAnyArray(PG_GETARG_DATUM(n))
256 
257 /*
258  * Access macros for varlena array header fields.
259  *
260  * ARR_DIMS returns a pointer to an array of array dimensions (number of
261  * elements along the various array axes).
262  *
263  * ARR_LBOUND returns a pointer to an array of array lower bounds.
264  *
265  * That is: if the third axis of an array has elements 5 through 8, then
266  * ARR_DIMS(a)[2] == 4 and ARR_LBOUND(a)[2] == 5.
267  *
268  * Unlike C, the default lower bound is 1.
269  */
270 #define ARR_SIZE(a) VARSIZE(a)
271 #define ARR_NDIM(a) ((a)->ndim)
272 #define ARR_HASNULL(a) ((a)->dataoffset != 0)
273 #define ARR_ELEMTYPE(a) ((a)->elemtype)
274 
275 #define ARR_DIMS(a) \
276  ((int *) (((char *) (a)) + sizeof(ArrayType)))
277 #define ARR_LBOUND(a) \
278  ((int *) (((char *) (a)) + sizeof(ArrayType) + \
279  sizeof(int) * ARR_NDIM(a)))
280 
281 #define ARR_NULLBITMAP(a) \
282  (ARR_HASNULL(a) ? \
283  (bits8 *) (((char *) (a)) + sizeof(ArrayType) + \
284  2 * sizeof(int) * ARR_NDIM(a)) \
285  : (bits8 *) NULL)
286 
287 /*
288  * The total array header size (in bytes) for an array with the specified
289  * number of dimensions and total number of items.
290  */
291 #define ARR_OVERHEAD_NONULLS(ndims) \
292  MAXALIGN(sizeof(ArrayType) + 2 * sizeof(int) * (ndims))
293 #define ARR_OVERHEAD_WITHNULLS(ndims, nitems) \
294  MAXALIGN(sizeof(ArrayType) + 2 * sizeof(int) * (ndims) + \
295  ((nitems) + 7) / 8)
296 
297 #define ARR_DATA_OFFSET(a) \
298  (ARR_HASNULL(a) ? (a)->dataoffset : ARR_OVERHEAD_NONULLS(ARR_NDIM(a)))
299 
300 /*
301  * Returns a pointer to the actual array data.
302  */
303 #define ARR_DATA_PTR(a) \
304  (((char *) (a)) + ARR_DATA_OFFSET(a))
305 
306 /*
307  * Macros for working with AnyArrayType inputs. Beware multiple references!
308  */
309 #define AARR_NDIM(a) \
310  (VARATT_IS_EXPANDED_HEADER(a) ? (a)->xpn.ndims : ARR_NDIM(&(a)->flt))
311 #define AARR_HASNULL(a) \
312  (VARATT_IS_EXPANDED_HEADER(a) ? \
313  ((a)->xpn.dvalues != NULL ? (a)->xpn.dnulls != NULL : ARR_HASNULL((a)->xpn.fvalue)) : \
314  ARR_HASNULL(&(a)->flt))
315 #define AARR_ELEMTYPE(a) \
316  (VARATT_IS_EXPANDED_HEADER(a) ? (a)->xpn.element_type : ARR_ELEMTYPE(&(a)->flt))
317 #define AARR_DIMS(a) \
318  (VARATT_IS_EXPANDED_HEADER(a) ? (a)->xpn.dims : ARR_DIMS(&(a)->flt))
319 #define AARR_LBOUND(a) \
320  (VARATT_IS_EXPANDED_HEADER(a) ? (a)->xpn.lbound : ARR_LBOUND(&(a)->flt))
321 
322 
323 /*
324  * GUC parameter
325  */
326 extern bool Array_nulls;
327 
328 /*
329  * prototypes for functions defined in arrayfuncs.c
330  */
331 extern void CopyArrayEls(ArrayType *array,
332  Datum *values,
333  bool *nulls,
334  int nitems,
335  int typlen,
336  bool typbyval,
337  char typalign,
338  bool freedata);
339 
340 extern Datum array_get_element(Datum arraydatum, int nSubscripts, int *indx,
341  int arraytyplen, int elmlen, bool elmbyval, char elmalign,
342  bool *isNull);
343 extern Datum array_set_element(Datum arraydatum, int nSubscripts, int *indx,
344  Datum dataValue, bool isNull,
345  int arraytyplen, int elmlen, bool elmbyval, char elmalign);
346 extern Datum array_get_slice(Datum arraydatum, int nSubscripts,
347  int *upperIndx, int *lowerIndx,
348  bool *upperProvided, bool *lowerProvided,
349  int arraytyplen, int elmlen, bool elmbyval, char elmalign);
350 extern Datum array_set_slice(Datum arraydatum, int nSubscripts,
351  int *upperIndx, int *lowerIndx,
352  bool *upperProvided, bool *lowerProvided,
353  Datum srcArrayDatum, bool isNull,
354  int arraytyplen, int elmlen, bool elmbyval, char elmalign);
355 
356 extern Datum array_ref(ArrayType *array, int nSubscripts, int *indx,
357  int arraytyplen, int elmlen, bool elmbyval, char elmalign,
358  bool *isNull);
359 extern ArrayType *array_set(ArrayType *array, int nSubscripts, int *indx,
360  Datum dataValue, bool isNull,
361  int arraytyplen, int elmlen, bool elmbyval, char elmalign);
362 
363 extern Datum array_map(FunctionCallInfo fcinfo, Oid retType,
364  ArrayMapState *amstate);
365 
366 extern void array_bitmap_copy(bits8 *destbitmap, int destoffset,
367  const bits8 *srcbitmap, int srcoffset,
368  int nitems);
369 
370 extern ArrayType *construct_array(Datum *elems, int nelems,
371  Oid elmtype,
372  int elmlen, bool elmbyval, char elmalign);
373 extern ArrayType *construct_md_array(Datum *elems,
374  bool *nulls,
375  int ndims,
376  int *dims,
377  int *lbs,
378  Oid elmtype, int elmlen, bool elmbyval, char elmalign);
379 extern ArrayType *construct_empty_array(Oid elmtype);
381  MemoryContext parentcontext,
382  ArrayMetaState *metacache);
383 extern void deconstruct_array(ArrayType *array,
384  Oid elmtype,
385  int elmlen, bool elmbyval, char elmalign,
386  Datum **elemsp, bool **nullsp, int *nelemsp);
387 extern bool array_contains_nulls(ArrayType *array);
388 
389 extern ArrayBuildState *initArrayResult(Oid element_type,
390  MemoryContext rcontext, bool subcontext);
392  Datum dvalue, bool disnull,
393  Oid element_type,
394  MemoryContext rcontext);
395 extern Datum makeArrayResult(ArrayBuildState *astate,
396  MemoryContext rcontext);
397 extern Datum makeMdArrayResult(ArrayBuildState *astate, int ndims,
398  int *dims, int *lbs, MemoryContext rcontext, bool release);
399 
400 extern ArrayBuildStateArr *initArrayResultArr(Oid array_type, Oid element_type,
401  MemoryContext rcontext, bool subcontext);
403  Datum dvalue, bool disnull,
404  Oid array_type,
405  MemoryContext rcontext);
407  MemoryContext rcontext, bool release);
408 
409 extern ArrayBuildStateAny *initArrayResultAny(Oid input_type,
410  MemoryContext rcontext, bool subcontext);
412  Datum dvalue, bool disnull,
413  Oid input_type,
414  MemoryContext rcontext);
416  MemoryContext rcontext, bool release);
417 
418 extern ArrayIterator array_create_iterator(ArrayType *arr, int slice_ndim, ArrayMetaState *mstate);
419 extern bool array_iterate(ArrayIterator iterator, Datum *value, bool *isnull);
420 extern void array_free_iterator(ArrayIterator iterator);
421 
422 /*
423  * prototypes for functions defined in arrayutils.c
424  */
425 
426 extern int ArrayGetOffset(int n, const int *dim, const int *lb, const int *indx);
427 extern int ArrayGetOffset0(int n, const int *tup, const int *scale);
428 extern int ArrayGetNItems(int ndim, const int *dims);
429 extern void mda_get_range(int n, int *span, const int *st, const int *endp);
430 extern void mda_get_prod(int n, const int *range, int *prod);
431 extern void mda_get_offset_values(int n, int *dist, const int *prod, const int *span);
432 extern int mda_next_tuple(int n, int *curr, const int *span);
433 extern int32 *ArrayGetIntegerTypmods(ArrayType *arr, int *n);
434 
435 /*
436  * prototypes for functions defined in array_expanded.c
437  */
438 extern Datum expand_array(Datum arraydatum, MemoryContext parentcontext,
439  ArrayMetaState *metacache);
442  ArrayMetaState *metacache);
445 
446 #endif /* ARRAY_H */
void mda_get_offset_values(int n, int *dist, const int *prod, const int *span)
Definition: arrayutils.c:150
signed short int16
Definition: c.h:255
void CopyArrayEls(ArrayType *array, Datum *values, bool *nulls, int nitems, int typlen, bool typbyval, char typalign, bool freedata)
Definition: arrayfuncs.c:956
Definition: fmgr.h:56
Datum array_get_slice(Datum arraydatum, int nSubscripts, int *upperIndx, int *lowerIndx, bool *upperProvided, bool *lowerProvided, int arraytyplen, int elmlen, bool elmbyval, char elmalign)
Definition: arrayfuncs.c:2015
ArrayType * construct_empty_array(Oid elmtype)
Definition: arrayfuncs.c:3424
ArrayBuildStateAny * accumArrayResultAny(ArrayBuildStateAny *astate, Datum dvalue, bool disnull, Oid input_type, MemoryContext rcontext)
Definition: arrayfuncs.c:5461
AnyArrayType * DatumGetAnyArray(Datum d)
Datum array_set_slice(Datum arraydatum, int nSubscripts, int *upperIndx, int *lowerIndx, bool *upperProvided, bool *lowerProvided, Datum srcArrayDatum, bool isNull, int arraytyplen, int elmlen, bool elmbyval, char elmalign)
Definition: arrayfuncs.c:2746
#define MAXDIM
Definition: c.h:419
Datum array_map(FunctionCallInfo fcinfo, Oid retType, ArrayMapState *amstate)
Definition: arrayfuncs.c:3120
void mda_get_range(int n, int *span, const int *st, const int *endp)
Definition: arrayutils.c:120
Datum * dvalues
Definition: array.h:171
int32 dataoffset
Definition: array.h:80
int mda_next_tuple(int n, int *curr, const int *span)
Definition: arrayutils.c:175
struct ArrayMetaState ArrayMetaState
bool typbyval
Definition: array.h:177
ExpandedArrayHeader xpn
Definition: array.h:161
Oid element_type
Definition: array.h:175
bool private_cxt
Definition: array.h:179
int scale
Definition: pgbench.c:106
ArrayBuildState * initArrayResult(Oid element_type, MemoryContext rcontext, bool subcontext)
Definition: arrayfuncs.c:4951
bool array_contains_nulls(ArrayType *array)
Definition: arrayfuncs.c:3542
Datum * dvalues
Definition: array.h:130
Datum array_set_element(Datum arraydatum, int nSubscripts, int *indx, Datum dataValue, bool isNull, int arraytyplen, int elmlen, bool elmbyval, char elmalign)
Definition: arrayfuncs.c:2186
unsigned int Oid
Definition: postgres_ext.h:31
char * fendptr
Definition: array.h:151
ArrayBuildState * scalarstate
Definition: array.h:210
Datum expand_array(Datum arraydatum, MemoryContext parentcontext, ArrayMetaState *metacache)
signed int int32
Definition: c.h:256
Datum makeArrayResultAny(ArrayBuildStateAny *astate, MemoryContext rcontext, bool release)
Definition: arrayfuncs.c:5489
bool * dnulls
Definition: array.h:172
union AnyArrayType AnyArrayType
bool typbyval
Definition: array.h:221
bits8 * nullbitmap
Definition: array.h:190
ArrayBuildState * accumArrayResult(ArrayBuildState *astate, Datum dvalue, bool disnull, Oid element_type, MemoryContext rcontext)
Definition: arrayfuncs.c:4990
Datum makeArrayResultArr(ArrayBuildStateArr *astate, MemoryContext rcontext, bool release)
Definition: arrayfuncs.c:5341
ExpandedObjectHeader hdr
Definition: array.h:102
Oid elemtype
Definition: array.h:81
int ArrayGetOffset0(int n, const int *tup, const int *scale)
Definition: arrayutils.c:50
static struct @121 value
ExpandedArrayHeader * DatumGetExpandedArrayX(Datum d, ArrayMetaState *metacache)
ArrayMetaState inp_extra
Definition: array.h:234
char typalign
Definition: array.h:178
struct ArrayMapState ArrayMapState
int16 typlen
Definition: array.h:220
struct ArrayIteratorData * ArrayIterator
Definition: array.h:239
char typdelim
Definition: array.h:223
ArrayBuildStateArr * initArrayResultArr(Oid array_type, Oid element_type, MemoryContext rcontext, bool subcontext)
Definition: arrayfuncs.c:5138
ArrayIterator array_create_iterator(ArrayType *arr, int slice_ndim, ArrayMetaState *mstate)
Definition: arrayfuncs.c:4255
Datum array_ref(ArrayType *array, int nSubscripts, int *indx, int arraytyplen, int elmlen, bool elmbyval, char elmalign, bool *isNull)
Definition: arrayfuncs.c:3063
Datum makeMdArrayResult(ArrayBuildState *astate, int ndims, int *dims, int *lbs, MemoryContext rcontext, bool release)
Definition: arrayfuncs.c:5086
static struct cvec * range(struct vars *v, chr a, chr b, int cases)
Definition: regc_locale.c:416
int ArrayGetNItems(int ndim, const int *dims)
Definition: arrayutils.c:75
ExpandedArrayHeader * DatumGetExpandedArray(Datum d)
ArrayType * construct_md_array(Datum *elems, bool *nulls, int ndims, int *dims, int *lbs, Oid elmtype, int elmlen, bool elmbyval, char elmalign)
Definition: arrayfuncs.c:3340
Datum array_get_element(Datum arraydatum, int nSubscripts, int *indx, int arraytyplen, int elmlen, bool elmbyval, char elmalign, bool *isNull)
Definition: arrayfuncs.c:1806
ArrayType * fvalue
Definition: array.h:149
bool array_iterate(ArrayIterator iterator, Datum *value, bool *isnull)
Definition: arrayfuncs.c:4334
ArrayBuildStateArr * arraystate
Definition: array.h:211
uint8 bits8
Definition: c.h:275
Datum makeArrayResult(ArrayBuildState *astate, MemoryContext rcontext)
Definition: arrayfuncs.c:5054
ArrayBuildStateArr * accumArrayResultArr(ArrayBuildStateArr *astate, Datum dvalue, bool disnull, Oid array_type, MemoryContext rcontext)
Definition: arrayfuncs.c:5184
void array_free_iterator(ArrayIterator iterator)
Definition: arrayfuncs.c:4417
uintptr_t Datum
Definition: postgres.h:372
void mda_get_prod(int n, const int *range, int *prod)
Definition: arrayutils.c:134
struct ExpandedArrayHeader ExpandedArrayHeader
int lbs[MAXDIM]
Definition: array.h:197
int ArrayGetOffset(int n, const int *dim, const int *lb, const int *indx)
Definition: arrayutils.c:31
ArrayType * construct_array(Datum *elems, int nelems, Oid elmtype, int elmlen, bool elmbyval, char elmalign)
Definition: arrayfuncs.c:3306
void array_bitmap_copy(bits8 *destbitmap, int destoffset, const bits8 *srcbitmap, int srcoffset, int nitems)
Definition: arrayfuncs.c:4624
Oid typioparam
Definition: array.h:224
struct ArrayBuildStateAny ArrayBuildStateAny
size_t Size
Definition: c.h:356
ArrayMetaState ret_extra
Definition: array.h:235
struct ArrayBuildStateArr ArrayBuildStateArr
Oid typiofunc
Definition: array.h:225
char typalign
Definition: array.h:222
MemoryContext mcontext
Definition: array.h:170
static Datum values[MAXATTR]
Definition: bootstrap.c:163
int dims[MAXDIM]
Definition: array.h:196
int32 * ArrayGetIntegerTypmods(ArrayType *arr, int *n)
Definition: arrayutils.c:200
ArrayType flt
Definition: array.h:160
int32 vl_len_
Definition: array.h:78
FmgrInfo proc
Definition: array.h:226
char * fstartptr
Definition: array.h:150
void deconstruct_array(ArrayType *array, Oid elmtype, int elmlen, bool elmbyval, char elmalign, Datum **elemsp, bool **nullsp, int *nelemsp)
Definition: arrayfuncs.c:3475
bool private_cxt
Definition: array.h:200
Oid element_type
Definition: array.h:219
ArrayType * array_set(ArrayType *array, int nSubscripts, int *indx, Datum dataValue, bool isNull, int arraytyplen, int elmlen, bool elmbyval, char elmalign)
Definition: arrayfuncs.c:3080
int16 typlen
Definition: array.h:176
void deconstruct_expanded_array(ExpandedArrayHeader *eah)
struct ArrayBuildState ArrayBuildState
bool Array_nulls
Definition: arrayfuncs.c:39
MemoryContext mcontext
Definition: array.h:188
int ndim
Definition: array.h:79
ArrayType * arr
Definition: arrayfuncs.c:69
ArrayBuildStateAny * initArrayResultAny(Oid input_type, MemoryContext rcontext, bool subcontext)
Definition: arrayfuncs.c:5416
ExpandedArrayHeader * construct_empty_expanded_array(Oid element_type, MemoryContext parentcontext, ArrayMetaState *metacache)
Definition: arrayfuncs.c:3441