PostgreSQL Source Code  git master
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 /* avoid including execnodes.h here */
68 struct ExprState;
69 struct ExprContext;
70 
71 
72 /*
73  * Arrays are varlena objects, so must meet the varlena convention that
74  * the first int32 of the object contains the total object size in bytes.
75  * Be sure to use VARSIZE() and SET_VARSIZE() to access it, though!
76  *
77  * CAUTION: if you change the header for ordinary arrays you will also
78  * need to change the headers for oidvector and int2vector!
79  */
80 typedef struct
81 {
82  int32 vl_len_; /* varlena header (do not touch directly!) */
83  int ndim; /* # of dimensions */
84  int32 dataoffset; /* offset to data, or 0 if no bitmap */
85  Oid elemtype; /* element type OID */
86 } ArrayType;
87 
88 /*
89  * An expanded array is contained within a private memory context (as
90  * all expanded objects must be) and has a control structure as below.
91  *
92  * The expanded array might contain a regular "flat" array if that was the
93  * original input and we've not modified it significantly. Otherwise, the
94  * contents are represented by Datum/isnull arrays plus dimensionality and
95  * type information. We could also have both forms, if we've deconstructed
96  * the original array for access purposes but not yet changed it. For pass-
97  * by-reference element types, the Datums would point into the flat array in
98  * this situation. Once we start modifying array elements, new pass-by-ref
99  * elements are separately palloc'd within the memory context.
100  */
101 #define EA_MAGIC 689375833 /* ID for debugging crosschecks */
102 
103 typedef struct ExpandedArrayHeader
104 {
105  /* Standard header for expanded objects */
107 
108  /* Magic value identifying an expanded array (for debugging only) */
109  int ea_magic;
110 
111  /* Dimensionality info (always valid) */
112  int ndims; /* # of dimensions */
113  int *dims; /* array dimensions */
114  int *lbound; /* index lower bounds for each dimension */
115 
116  /* Element type info (always valid) */
117  Oid element_type; /* element type OID */
118  int16 typlen; /* needed info about element datatype */
119  bool typbyval;
120  char typalign;
121 
122  /*
123  * If we have a Datum-array representation of the array, it's kept here;
124  * else dvalues/dnulls are NULL. The dvalues and dnulls arrays are always
125  * palloc'd within the object private context, but may change size from
126  * time to time. For pass-by-ref element types, dvalues entries might
127  * point either into the fstartptr..fendptr area, or to separately
128  * palloc'd chunks. Elements should always be fully detoasted, as they
129  * are in the standard flat representation.
130  *
131  * Even when dvalues is valid, dnulls can be NULL if there are no null
132  * elements.
133  */
134  Datum *dvalues; /* array of Datums */
135  bool *dnulls; /* array of is-null flags for Datums */
136  int dvalueslen; /* allocated length of above arrays */
137  int nelems; /* number of valid entries in above arrays */
138 
139  /*
140  * flat_size is the current space requirement for the flat equivalent of
141  * the expanded array, if known; otherwise it's 0. We store this to make
142  * consecutive calls of get_flat_size cheap.
143  */
145 
146  /*
147  * fvalue points to the flat representation if it is valid, else it is
148  * NULL. If we have or ever had a flat representation then
149  * fstartptr/fendptr point to the start and end+1 of its data area; this
150  * is so that we can tell which Datum pointers point into the flat
151  * representation rather than being pointers to separately palloc'd data.
152  */
153  ArrayType *fvalue; /* must be a fully detoasted array */
154  char *fstartptr; /* start of its data area */
155  char *fendptr; /* end+1 of its data area */
157 
158 /*
159  * Functions that can handle either a "flat" varlena array or an expanded
160  * array use this union to work with their input.
161  */
162 typedef union AnyArrayType
163 {
166 } AnyArrayType;
167 
168 /*
169  * working state for accumArrayResult() and friends
170  * note that the input must be scalars (legal array elements)
171  */
172 typedef struct ArrayBuildState
173 {
174  MemoryContext mcontext; /* where all the temp stuff is kept */
175  Datum *dvalues; /* array of accumulated Datums */
176  bool *dnulls; /* array of is-null flags for Datums */
177  int alen; /* allocated length of above arrays */
178  int nelems; /* number of valid entries in above arrays */
179  Oid element_type; /* data type of the Datums */
180  int16 typlen; /* needed info about datatype */
181  bool typbyval;
182  char typalign;
183  bool private_cxt; /* use private memory context */
185 
186 /*
187  * working state for accumArrayResultArr() and friends
188  * note that the input must be arrays, and the same array type is returned
189  */
190 typedef struct ArrayBuildStateArr
191 {
192  MemoryContext mcontext; /* where all the temp stuff is kept */
193  char *data; /* accumulated data */
194  bits8 *nullbitmap; /* bitmap of is-null flags, or NULL if none */
195  int abytes; /* allocated length of "data" */
196  int nbytes; /* number of bytes used so far */
197  int aitems; /* allocated length of bitmap (in elements) */
198  int nitems; /* total number of elements in result */
199  int ndims; /* current dimensions of result */
200  int dims[MAXDIM];
201  int lbs[MAXDIM];
202  Oid array_type; /* data type of the arrays */
203  Oid element_type; /* data type of the array elements */
204  bool private_cxt; /* use private memory context */
206 
207 /*
208  * working state for accumArrayResultAny() and friends
209  * these functions handle both cases
210  */
211 typedef struct ArrayBuildStateAny
212 {
213  /* Exactly one of these is not NULL: */
217 
218 /*
219  * structure to cache type metadata needed for array manipulation
220  */
221 typedef struct ArrayMetaState
222 {
225  bool typbyval;
226  char typalign;
227  char typdelim;
232 
233 /*
234  * private state needed by array_map (here because caller must provide it)
235  */
236 typedef struct ArrayMapState
237 {
240 } ArrayMapState;
241 
242 /* ArrayIteratorData is private in arrayfuncs.c */
244 
245 /* fmgr macros for regular varlena array objects */
246 #define DatumGetArrayTypeP(X) ((ArrayType *) PG_DETOAST_DATUM(X))
247 #define DatumGetArrayTypePCopy(X) ((ArrayType *) PG_DETOAST_DATUM_COPY(X))
248 #define PG_GETARG_ARRAYTYPE_P(n) DatumGetArrayTypeP(PG_GETARG_DATUM(n))
249 #define PG_GETARG_ARRAYTYPE_P_COPY(n) DatumGetArrayTypePCopy(PG_GETARG_DATUM(n))
250 #define PG_RETURN_ARRAYTYPE_P(x) PG_RETURN_POINTER(x)
251 
252 /* fmgr macros for expanded array objects */
253 #define PG_GETARG_EXPANDED_ARRAY(n) DatumGetExpandedArray(PG_GETARG_DATUM(n))
254 #define PG_GETARG_EXPANDED_ARRAYX(n, metacache) \
255  DatumGetExpandedArrayX(PG_GETARG_DATUM(n), metacache)
256 #define PG_RETURN_EXPANDED_ARRAY(x) PG_RETURN_DATUM(EOHPGetRWDatum(&(x)->hdr))
257 
258 /* fmgr macros for AnyArrayType (ie, get either varlena or expanded form) */
259 #define PG_GETARG_ANY_ARRAY_P(n) DatumGetAnyArrayP(PG_GETARG_DATUM(n))
260 
261 /*
262  * Access macros for varlena array header fields.
263  *
264  * ARR_DIMS returns a pointer to an array of array dimensions (number of
265  * elements along the various array axes).
266  *
267  * ARR_LBOUND returns a pointer to an array of array lower bounds.
268  *
269  * That is: if the third axis of an array has elements 5 through 8, then
270  * ARR_DIMS(a)[2] == 4 and ARR_LBOUND(a)[2] == 5.
271  *
272  * Unlike C, the default lower bound is 1.
273  */
274 #define ARR_SIZE(a) VARSIZE(a)
275 #define ARR_NDIM(a) ((a)->ndim)
276 #define ARR_HASNULL(a) ((a)->dataoffset != 0)
277 #define ARR_ELEMTYPE(a) ((a)->elemtype)
278 
279 #define ARR_DIMS(a) \
280  ((int *) (((char *) (a)) + sizeof(ArrayType)))
281 #define ARR_LBOUND(a) \
282  ((int *) (((char *) (a)) + sizeof(ArrayType) + \
283  sizeof(int) * ARR_NDIM(a)))
284 
285 #define ARR_NULLBITMAP(a) \
286  (ARR_HASNULL(a) ? \
287  (bits8 *) (((char *) (a)) + sizeof(ArrayType) + \
288  2 * sizeof(int) * ARR_NDIM(a)) \
289  : (bits8 *) NULL)
290 
291 /*
292  * The total array header size (in bytes) for an array with the specified
293  * number of dimensions and total number of items.
294  */
295 #define ARR_OVERHEAD_NONULLS(ndims) \
296  MAXALIGN(sizeof(ArrayType) + 2 * sizeof(int) * (ndims))
297 #define ARR_OVERHEAD_WITHNULLS(ndims, nitems) \
298  MAXALIGN(sizeof(ArrayType) + 2 * sizeof(int) * (ndims) + \
299  ((nitems) + 7) / 8)
300 
301 #define ARR_DATA_OFFSET(a) \
302  (ARR_HASNULL(a) ? (a)->dataoffset : ARR_OVERHEAD_NONULLS(ARR_NDIM(a)))
303 
304 /*
305  * Returns a pointer to the actual array data.
306  */
307 #define ARR_DATA_PTR(a) \
308  (((char *) (a)) + ARR_DATA_OFFSET(a))
309 
310 /*
311  * Macros for working with AnyArrayType inputs. Beware multiple references!
312  */
313 #define AARR_NDIM(a) \
314  (VARATT_IS_EXPANDED_HEADER(a) ? (a)->xpn.ndims : ARR_NDIM(&(a)->flt))
315 #define AARR_HASNULL(a) \
316  (VARATT_IS_EXPANDED_HEADER(a) ? \
317  ((a)->xpn.dvalues != NULL ? (a)->xpn.dnulls != NULL : ARR_HASNULL((a)->xpn.fvalue)) : \
318  ARR_HASNULL(&(a)->flt))
319 #define AARR_ELEMTYPE(a) \
320  (VARATT_IS_EXPANDED_HEADER(a) ? (a)->xpn.element_type : ARR_ELEMTYPE(&(a)->flt))
321 #define AARR_DIMS(a) \
322  (VARATT_IS_EXPANDED_HEADER(a) ? (a)->xpn.dims : ARR_DIMS(&(a)->flt))
323 #define AARR_LBOUND(a) \
324  (VARATT_IS_EXPANDED_HEADER(a) ? (a)->xpn.lbound : ARR_LBOUND(&(a)->flt))
325 
326 
327 /*
328  * GUC parameter
329  */
330 extern bool Array_nulls;
331 
332 /*
333  * prototypes for functions defined in arrayfuncs.c
334  */
335 extern void CopyArrayEls(ArrayType *array,
336  Datum *values,
337  bool *nulls,
338  int nitems,
339  int typlen,
340  bool typbyval,
341  char typalign,
342  bool freedata);
343 
344 extern Datum array_get_element(Datum arraydatum, int nSubscripts, int *indx,
345  int arraytyplen, int elmlen, bool elmbyval, char elmalign,
346  bool *isNull);
347 extern Datum array_set_element(Datum arraydatum, int nSubscripts, int *indx,
348  Datum dataValue, bool isNull,
349  int arraytyplen, int elmlen, bool elmbyval, char elmalign);
350 extern Datum array_get_slice(Datum arraydatum, int nSubscripts,
351  int *upperIndx, int *lowerIndx,
352  bool *upperProvided, bool *lowerProvided,
353  int arraytyplen, int elmlen, bool elmbyval, char elmalign);
354 extern Datum array_set_slice(Datum arraydatum, int nSubscripts,
355  int *upperIndx, int *lowerIndx,
356  bool *upperProvided, bool *lowerProvided,
357  Datum srcArrayDatum, bool isNull,
358  int arraytyplen, int elmlen, bool elmbyval, char elmalign);
359 
360 extern Datum array_ref(ArrayType *array, int nSubscripts, int *indx,
361  int arraytyplen, int elmlen, bool elmbyval, char elmalign,
362  bool *isNull);
363 extern ArrayType *array_set(ArrayType *array, int nSubscripts, int *indx,
364  Datum dataValue, bool isNull,
365  int arraytyplen, int elmlen, bool elmbyval, char elmalign);
366 
367 extern Datum array_map(Datum arrayd,
368  struct ExprState *exprstate, struct ExprContext *econtext,
369  Oid retType, ArrayMapState *amstate);
370 
371 extern void array_bitmap_copy(bits8 *destbitmap, int destoffset,
372  const bits8 *srcbitmap, int srcoffset,
373  int nitems);
374 
375 extern ArrayType *construct_array(Datum *elems, int nelems,
376  Oid elmtype,
377  int elmlen, bool elmbyval, char elmalign);
378 extern ArrayType *construct_md_array(Datum *elems,
379  bool *nulls,
380  int ndims,
381  int *dims,
382  int *lbs,
383  Oid elmtype, int elmlen, bool elmbyval, char elmalign);
384 extern ArrayType *construct_empty_array(Oid elmtype);
386  MemoryContext parentcontext,
387  ArrayMetaState *metacache);
388 extern void deconstruct_array(ArrayType *array,
389  Oid elmtype,
390  int elmlen, bool elmbyval, char elmalign,
391  Datum **elemsp, bool **nullsp, int *nelemsp);
392 extern bool array_contains_nulls(ArrayType *array);
393 
395  MemoryContext rcontext, bool subcontext);
397  Datum dvalue, bool disnull,
399  MemoryContext rcontext);
400 extern Datum makeArrayResult(ArrayBuildState *astate,
401  MemoryContext rcontext);
402 extern Datum makeMdArrayResult(ArrayBuildState *astate, int ndims,
403  int *dims, int *lbs, MemoryContext rcontext, bool release);
404 
406  MemoryContext rcontext, bool subcontext);
408  Datum dvalue, bool disnull,
409  Oid array_type,
410  MemoryContext rcontext);
412  MemoryContext rcontext, bool release);
413 
414 extern ArrayBuildStateAny *initArrayResultAny(Oid input_type,
415  MemoryContext rcontext, bool subcontext);
417  Datum dvalue, bool disnull,
418  Oid input_type,
419  MemoryContext rcontext);
421  MemoryContext rcontext, bool release);
422 
423 extern ArrayIterator array_create_iterator(ArrayType *arr, int slice_ndim, ArrayMetaState *mstate);
424 extern bool array_iterate(ArrayIterator iterator, Datum *value, bool *isnull);
425 extern void array_free_iterator(ArrayIterator iterator);
426 
427 /*
428  * prototypes for functions defined in arrayutils.c
429  */
430 
431 extern int ArrayGetOffset(int n, const int *dim, const int *lb, const int *indx);
432 extern int ArrayGetOffset0(int n, const int *tup, const int *scale);
433 extern int ArrayGetNItems(int ndim, const int *dims);
434 extern void mda_get_range(int n, int *span, const int *st, const int *endp);
435 extern void mda_get_prod(int n, const int *range, int *prod);
436 extern void mda_get_offset_values(int n, int *dist, const int *prod, const int *span);
437 extern int mda_next_tuple(int n, int *curr, const int *span);
438 extern int32 *ArrayGetIntegerTypmods(ArrayType *arr, int *n);
439 
440 /*
441  * prototypes for functions defined in array_expanded.c
442  */
443 extern Datum expand_array(Datum arraydatum, MemoryContext parentcontext,
444  ArrayMetaState *metacache);
447  ArrayMetaState *metacache);
450 
451 #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:283
void CopyArrayEls(ArrayType *array, Datum *values, bool *nulls, int nitems, int typlen, bool typbyval, char typalign, bool freedata)
Definition: arrayfuncs.c:957
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:2016
ArrayType * construct_empty_array(Oid elmtype)
Definition: arrayfuncs.c:3398
ArrayBuildStateAny * accumArrayResultAny(ArrayBuildStateAny *astate, Datum dvalue, bool disnull, Oid input_type, MemoryContext rcontext)
Definition: arrayfuncs.c:5513
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:2747
#define MAXDIM
Definition: c.h:467
Datum array_map(Datum arrayd, struct ExprState *exprstate, struct ExprContext *econtext, Oid retType, ArrayMapState *amstate)
Definition: arrayfuncs.c:3119
void mda_get_range(int n, int *span, const int *st, const int *endp)
Definition: arrayutils.c:120
Datum * dvalues
Definition: array.h:175
int32 dataoffset
Definition: array.h:84
int mda_next_tuple(int n, int *curr, const int *span)
Definition: arrayutils.c:175
struct ArrayMetaState ArrayMetaState
AnyArrayType * DatumGetAnyArrayP(Datum d)
bool typbyval
Definition: array.h:181
ExpandedArrayHeader xpn
Definition: array.h:165
Oid element_type
Definition: array.h:179
bool private_cxt
Definition: array.h:183
int scale
Definition: pgbench.c:108
ArrayBuildState * initArrayResult(Oid element_type, MemoryContext rcontext, bool subcontext)
Definition: arrayfuncs.c:5003
bool array_contains_nulls(ArrayType *array)
Definition: arrayfuncs.c:3516
Datum * dvalues
Definition: array.h:134
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:2187
unsigned int Oid
Definition: postgres_ext.h:31
char * fendptr
Definition: array.h:155
ArrayBuildState * scalarstate
Definition: array.h:214
Datum expand_array(Datum arraydatum, MemoryContext parentcontext, ArrayMetaState *metacache)
signed int int32
Definition: c.h:284
Datum makeArrayResultAny(ArrayBuildStateAny *astate, MemoryContext rcontext, bool release)
Definition: arrayfuncs.c:5541
bool * dnulls
Definition: array.h:176
union AnyArrayType AnyArrayType
bool typbyval
Definition: array.h:225
bits8 * nullbitmap
Definition: array.h:194
ArrayBuildState * accumArrayResult(ArrayBuildState *astate, Datum dvalue, bool disnull, Oid element_type, MemoryContext rcontext)
Definition: arrayfuncs.c:5042
Datum makeArrayResultArr(ArrayBuildStateArr *astate, MemoryContext rcontext, bool release)
Definition: arrayfuncs.c:5393
ExpandedObjectHeader hdr
Definition: array.h:106
Oid elemtype
Definition: array.h:85
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:238
char typalign
Definition: array.h:182
struct ArrayMapState ArrayMapState
int16 typlen
Definition: array.h:224
struct ArrayIteratorData * ArrayIterator
Definition: array.h:243
char typdelim
Definition: array.h:227
ArrayBuildStateArr * initArrayResultArr(Oid array_type, Oid element_type, MemoryContext rcontext, bool subcontext)
Definition: arrayfuncs.c:5190
ArrayIterator array_create_iterator(ArrayType *arr, int slice_ndim, ArrayMetaState *mstate)
Definition: arrayfuncs.c:4307
Datum array_ref(ArrayType *array, int nSubscripts, int *indx, int arraytyplen, int elmlen, bool elmbyval, char elmalign, bool *isNull)
Definition: arrayfuncs.c:3064
Datum makeMdArrayResult(ArrayBuildState *astate, int ndims, int *dims, int *lbs, MemoryContext rcontext, bool release)
Definition: arrayfuncs.c:5138
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:3314
Datum array_get_element(Datum arraydatum, int nSubscripts, int *indx, int arraytyplen, int elmlen, bool elmbyval, char elmalign, bool *isNull)
Definition: arrayfuncs.c:1807
ArrayType * fvalue
Definition: array.h:153
bool array_iterate(ArrayIterator iterator, Datum *value, bool *isnull)
Definition: arrayfuncs.c:4386
ArrayBuildStateArr * arraystate
Definition: array.h:215
uint8 bits8
Definition: c.h:303
Datum makeArrayResult(ArrayBuildState *astate, MemoryContext rcontext)
Definition: arrayfuncs.c:5106
ArrayBuildStateArr * accumArrayResultArr(ArrayBuildStateArr *astate, Datum dvalue, bool disnull, Oid array_type, MemoryContext rcontext)
Definition: arrayfuncs.c:5236
void array_free_iterator(ArrayIterator iterator)
Definition: arrayfuncs.c:4469
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 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:3279
void array_bitmap_copy(bits8 *destbitmap, int destoffset, const bits8 *srcbitmap, int srcoffset, int nitems)
Definition: arrayfuncs.c:4676
Oid typioparam
Definition: array.h:228
struct ArrayBuildStateAny ArrayBuildStateAny
size_t Size
Definition: c.h:404
ArrayMetaState ret_extra
Definition: array.h:239
struct ArrayBuildStateArr ArrayBuildStateArr
Oid typiofunc
Definition: array.h:229
char typalign
Definition: array.h:226
MemoryContext mcontext
Definition: array.h:174
static Datum values[MAXATTR]
Definition: bootstrap.c:164
int32 * ArrayGetIntegerTypmods(ArrayType *arr, int *n)
Definition: arrayutils.c:200
ArrayType flt
Definition: array.h:164
int32 vl_len_
Definition: array.h:82
FmgrInfo proc
Definition: array.h:230
char * fstartptr
Definition: array.h:154
void deconstruct_array(ArrayType *array, Oid elmtype, int elmlen, bool elmbyval, char elmalign, Datum **elemsp, bool **nullsp, int *nelemsp)
Definition: arrayfuncs.c:3449
bool private_cxt
Definition: array.h:204
Oid element_type
Definition: array.h:223
ArrayType * array_set(ArrayType *array, int nSubscripts, int *indx, Datum dataValue, bool isNull, int arraytyplen, int elmlen, bool elmbyval, char elmalign)
Definition: arrayfuncs.c:3081
int16 typlen
Definition: array.h:180
void deconstruct_expanded_array(ExpandedArrayHeader *eah)
struct ArrayBuildState ArrayBuildState
bool Array_nulls
Definition: arrayfuncs.c:40
MemoryContext mcontext
Definition: array.h:192
int ndim
Definition: array.h:83
ArrayType * arr
Definition: arrayfuncs.c:70
ArrayBuildStateAny * initArrayResultAny(Oid input_type, MemoryContext rcontext, bool subcontext)
Definition: arrayfuncs.c:5468
ExpandedArrayHeader * construct_empty_expanded_array(Oid element_type, MemoryContext parentcontext, ArrayMetaState *metacache)
Definition: arrayfuncs.c:3415