PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
_int_op.c File Reference
#include "postgres.h"
#include "_int.h"
Include dependency graph for _int_op.c:

Go to the source code of this file.

Functions

 PG_MODULE_MAGIC_EXT (.name="intarray",.version=PG_VERSION)
 
 PG_FUNCTION_INFO_V1 (_int_different)
 
 PG_FUNCTION_INFO_V1 (_int_same)
 
 PG_FUNCTION_INFO_V1 (_int_contains)
 
 PG_FUNCTION_INFO_V1 (_int_contained)
 
 PG_FUNCTION_INFO_V1 (_int_overlap)
 
 PG_FUNCTION_INFO_V1 (_int_union)
 
 PG_FUNCTION_INFO_V1 (_int_inter)
 
Datum _int_contained (PG_FUNCTION_ARGS)
 
Datum _int_contains (PG_FUNCTION_ARGS)
 
Datum _int_different (PG_FUNCTION_ARGS)
 
Datum _int_same (PG_FUNCTION_ARGS)
 
Datum _int_overlap (PG_FUNCTION_ARGS)
 
Datum _int_union (PG_FUNCTION_ARGS)
 
Datum _int_inter (PG_FUNCTION_ARGS)
 
 PG_FUNCTION_INFO_V1 (intset)
 
 PG_FUNCTION_INFO_V1 (icount)
 
 PG_FUNCTION_INFO_V1 (sort)
 
 PG_FUNCTION_INFO_V1 (sort_asc)
 
 PG_FUNCTION_INFO_V1 (sort_desc)
 
 PG_FUNCTION_INFO_V1 (uniq)
 
 PG_FUNCTION_INFO_V1 (idx)
 
 PG_FUNCTION_INFO_V1 (subarray)
 
 PG_FUNCTION_INFO_V1 (intarray_push_elem)
 
 PG_FUNCTION_INFO_V1 (intarray_push_array)
 
 PG_FUNCTION_INFO_V1 (intarray_del_elem)
 
 PG_FUNCTION_INFO_V1 (intset_union_elem)
 
 PG_FUNCTION_INFO_V1 (intset_subtract)
 
Datum intset (PG_FUNCTION_ARGS)
 
Datum icount (PG_FUNCTION_ARGS)
 
Datum sort (PG_FUNCTION_ARGS)
 
Datum sort_asc (PG_FUNCTION_ARGS)
 
Datum sort_desc (PG_FUNCTION_ARGS)
 
Datum uniq (PG_FUNCTION_ARGS)
 
Datum idx (PG_FUNCTION_ARGS)
 
Datum subarray (PG_FUNCTION_ARGS)
 
Datum intarray_push_elem (PG_FUNCTION_ARGS)
 
Datum intarray_push_array (PG_FUNCTION_ARGS)
 
Datum intarray_del_elem (PG_FUNCTION_ARGS)
 
Datum intset_union_elem (PG_FUNCTION_ARGS)
 
Datum intset_subtract (PG_FUNCTION_ARGS)
 

Function Documentation

◆ _int_contained()

Datum _int_contained ( PG_FUNCTION_ARGS  )

Definition at line 22 of file _int_op.c.

23{
24 /* just reverse the operands and call _int_contains */
28}
Datum _int_contains(PG_FUNCTION_ARGS)
Definition: _int_op.c:31
#define DirectFunctionCall2(func, arg1, arg2)
Definition: fmgr.h:684
#define PG_GETARG_DATUM(n)
Definition: fmgr.h:268

References _int_contains(), DirectFunctionCall2, and PG_GETARG_DATUM.

◆ _int_contains()

Datum _int_contains ( PG_FUNCTION_ARGS  )

Definition at line 31 of file _int_op.c.

32{
33 /* Force copy so we can modify the arrays in-place */
36 bool res;
37
42 res = inner_int_contains(a, b);
43 pfree(a);
44 pfree(b);
45 PG_RETURN_BOOL(res);
46}
bool inner_int_contains(ArrayType *a, ArrayType *b)
Definition: _int_tool.c:15
#define PREPAREARR(x)
Definition: _int.h:49
#define CHECKARRVALID(x)
Definition: _int.h:30
#define PG_GETARG_ARRAYTYPE_P_COPY(n)
Definition: array.h:264
#define PG_RETURN_BOOL(x)
Definition: fmgr.h:359
int b
Definition: isn.c:74
int a
Definition: isn.c:73
void pfree(void *pointer)
Definition: mcxt.c:2146

References a, b, CHECKARRVALID, inner_int_contains(), pfree(), PG_GETARG_ARRAYTYPE_P_COPY, PG_RETURN_BOOL, and PREPAREARR.

Referenced by _int_contained().

◆ _int_different()

Datum _int_different ( PG_FUNCTION_ARGS  )

Definition at line 49 of file _int_op.c.

50{
54}
Datum _int_same(PG_FUNCTION_ARGS)
Definition: _int_op.c:57
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:276
static bool DatumGetBool(Datum X)
Definition: postgres.h:95
static Datum PointerGetDatum(const void *X)
Definition: postgres.h:327

References _int_same(), DatumGetBool(), DirectFunctionCall2, PG_GETARG_POINTER, PG_RETURN_BOOL, and PointerGetDatum().

◆ _int_inter()

Datum _int_inter ( PG_FUNCTION_ARGS  )

Definition at line 146 of file _int_op.c.

147{
150 ArrayType *result;
151
154
155 SORT(a);
156 SORT(b);
157
158 result = inner_int_inter(a, b);
159
160 pfree(a);
161 pfree(b);
162
163 PG_RETURN_POINTER(result);
164}
ArrayType * inner_int_inter(ArrayType *a, ArrayType *b)
Definition: _int_tool.c:136
#define SORT(x)
Definition: _int.h:41
#define PG_RETURN_POINTER(x)
Definition: fmgr.h:361

References a, b, CHECKARRVALID, inner_int_inter(), pfree(), PG_GETARG_ARRAYTYPE_P_COPY, PG_RETURN_POINTER, and SORT.

◆ _int_overlap()

Datum _int_overlap ( PG_FUNCTION_ARGS  )

Definition at line 102 of file _int_op.c.

103{
106 bool result;
107
110 if (ARRISEMPTY(a) || ARRISEMPTY(b))
111 return false;
112
113 SORT(a);
114 SORT(b);
115
116 result = inner_int_overlap(a, b);
117
118 pfree(a);
119 pfree(b);
120
121 PG_RETURN_BOOL(result);
122}
bool inner_int_overlap(ArrayType *a, ArrayType *b)
Definition: _int_tool.c:50
#define ARRISEMPTY(x)
Definition: _int.h:38

References a, ARRISEMPTY, b, CHECKARRVALID, inner_int_overlap(), pfree(), PG_GETARG_ARRAYTYPE_P_COPY, PG_RETURN_BOOL, and SORT.

◆ _int_same()

Datum _int_same ( PG_FUNCTION_ARGS  )

Definition at line 57 of file _int_op.c.

58{
61 int na,
62 nb;
63 int n;
64 int *da,
65 *db;
66 bool result;
67
70 na = ARRNELEMS(a);
71 nb = ARRNELEMS(b);
72 da = ARRPTR(a);
73 db = ARRPTR(b);
74
75 result = false;
76
77 if (na == nb)
78 {
79 SORT(a);
80 SORT(b);
81 result = true;
82
83 for (n = 0; n < na; n++)
84 {
85 if (da[n] != db[n])
86 {
87 result = false;
88 break;
89 }
90 }
91 }
92
93 pfree(a);
94 pfree(b);
95
96 PG_RETURN_BOOL(result);
97}
#define ARRNELEMS(x)
Definition: cube.c:29
#define ARRPTR(x)
Definition: cube.c:28

References a, ARRNELEMS, ARRPTR, b, CHECKARRVALID, pfree(), PG_GETARG_ARRAYTYPE_P_COPY, PG_RETURN_BOOL, and SORT.

Referenced by _int_different().

◆ _int_union()

Datum _int_union ( PG_FUNCTION_ARGS  )

Definition at line 125 of file _int_op.c.

126{
129 ArrayType *result;
130
133
134 SORT(a);
135 SORT(b);
136
137 result = inner_int_union(a, b);
138
139 pfree(a);
140 pfree(b);
141
142 PG_RETURN_POINTER(result);
143}
ArrayType * inner_int_union(ArrayType *a, ArrayType *b)
Definition: _int_tool.c:79

References a, b, CHECKARRVALID, inner_int_union(), pfree(), PG_GETARG_ARRAYTYPE_P_COPY, PG_RETURN_POINTER, and SORT.

◆ icount()

Datum icount ( PG_FUNCTION_ARGS  )

Definition at line 188 of file _int_op.c.

189{
191 int32 count = ARRNELEMS(a);
192
193 PG_FREE_IF_COPY(a, 0);
194 PG_RETURN_INT32(count);
195}
#define PG_GETARG_ARRAYTYPE_P(n)
Definition: array.h:263
int32_t int32
Definition: c.h:498
#define PG_FREE_IF_COPY(ptr, n)
Definition: fmgr.h:260
#define PG_RETURN_INT32(x)
Definition: fmgr.h:354

References a, ARRNELEMS, PG_FREE_IF_COPY, PG_GETARG_ARRAYTYPE_P, and PG_RETURN_INT32.

◆ idx()

Definition at line 262 of file _int_op.c.

263{
265 int32 result;
266
268 result = ARRNELEMS(a);
269 if (result)
271 PG_FREE_IF_COPY(a, 0);
272 PG_RETURN_INT32(result);
273}
int32 intarray_match_first(ArrayType *a, int32 elem)
Definition: _int_tool.c:338
#define PG_GETARG_INT32(n)
Definition: fmgr.h:269

References a, ARRNELEMS, CHECKARRVALID, intarray_match_first(), PG_FREE_IF_COPY, PG_GETARG_ARRAYTYPE_P, PG_GETARG_INT32, and PG_RETURN_INT32.

Referenced by aclexplode(), AllocSetFreeIndex(), appendStringInfoRegexpSubstr(), array_subscript_transform(), AtProcExit_memstats_cleanup(), AttachPartitionEnsureIndexes(), avlCollectFields(), brin_minmax_multi_summary_out(), brin_revmap_data(), build_expr_data(), build_sorted_items(), casemap(), cube_subset(), dependencies_clauselist_selectivity(), DetachPartitionFinalize(), do_set_block_offsets(), estimate_multivariate_ndistinct(), ExecHashIncreaseNumBatches(), ExecHashIncreaseNumBuckets(), ExecInitIndexOnlyScan(), ExecParallelHashIncreaseNumBuckets(), ExecParallelHashRepartitionFirst(), fill_expanded_ranges(), GetXLogBuffer(), hstore_contains(), hstore_defined(), hstore_exists(), hstore_exists_all(), hstore_exists_any(), hstore_fetchval(), hstore_populate_record(), hstore_slice_to_array(), hstore_slice_to_hstore(), hstore_subscript_fetch(), indexOfColumn(), InjectionPointAttach(), InjectionPointDetach(), jsonb_delete_idx(), jsonb_subscript_transform(), lazy_cleanup_all_indexes(), lazy_vacuum_all_indexes(), Lookahead(), make_build_data(), mcv_get_match_bitmap(), mcv_match_expression(), merge_overlapping_ranges(), multirange_bsearch_match(), parallel_vacuum_process_safe_indexes(), percentile_cont_multi_final_common(), percentile_disc_multi_final(), pg_buffercache_numa_pages(), pg_get_wait_events(), pg_mb_radix_conv(), pg_nextoid(), pg_stat_get_db_numbackends(), pgoutput_row_filter_init(), pgstat_build_snapshot_fixed(), pgstat_fetch_replslot(), pgstat_get_custom_shmem_data(), pgstat_get_custom_snapshot_data(), pgstat_get_kind_from_str(), pgstat_get_kind_info(), pgstat_get_local_beentry_by_index(), pgstat_read_statsfile(), pgstat_register_kind(), pgstat_replslot_from_serialized_name_cb(), PLy_result_item(), PLySequence_ToComposite(), printCrosstab(), ProcessGetMemoryContextInterrupt(), range_gist_double_sorting_split(), range_gist_single_sorting_split(), ReindexRelationConcurrently(), ResourceOwnerAddToHash(), ResourceOwnerForget(), ResourceOwnerReleaseAll(), ResourceOwnerRemember(), ResourceOwnerSort(), ri_ReportViolation(), RT_ADD_CHILD_256(), RT_ADD_CHILD_48(), RT_GROW_NODE_16(), RT_NODE_256_IS_CHUNK_USED(), RT_NODE_4_GET_INSERTPOS(), RT_VERIFY_NODE(), setPathArray(), stat_find_expression(), statext_expressions_load(), StatsShmemInit(), store_expanded_ranges(), StoreIndexTuple(), tbm_prepare_shared_iterate(), test_pattern(), TidStoreSetBlockOffsets(), transformContainerSubscripts(), update_relstats_all_indexes(), and WALReadFromBuffers().

◆ intarray_del_elem()

Datum intarray_del_elem ( PG_FUNCTION_ARGS  )

Definition at line 350 of file _int_op.c.

351{
353 int32 elem = PG_GETARG_INT32(1);
354 int32 c;
355 int32 *aa;
356 int32 n = 0,
357 i;
358
360 if (!ARRISEMPTY(a))
361 {
362 c = ARRNELEMS(a);
363 aa = ARRPTR(a);
364 for (i = 0; i < c; i++)
365 {
366 if (aa[i] != elem)
367 {
368 if (i > n)
369 aa[n++] = aa[i];
370 else
371 n++;
372 }
373 }
374 a = resize_intArrayType(a, n);
375 }
377}
ArrayType * resize_intArrayType(ArrayType *a, int num)
Definition: _int_tool.c:252
int i
Definition: isn.c:77
char * c

References a, ARRISEMPTY, ARRNELEMS, ARRPTR, CHECKARRVALID, i, PG_GETARG_ARRAYTYPE_P_COPY, PG_GETARG_INT32, PG_RETURN_POINTER, and resize_intArrayType().

◆ intarray_push_array()

Datum intarray_push_array ( PG_FUNCTION_ARGS  )

Definition at line 337 of file _int_op.c.

338{
341 ArrayType *result;
342
343 result = intarray_concat_arrays(a, b);
344 PG_FREE_IF_COPY(a, 0);
345 PG_FREE_IF_COPY(b, 1);
346 PG_RETURN_POINTER(result);
347}
ArrayType * intarray_concat_arrays(ArrayType *a, ArrayType *b)
Definition: _int_tool.c:371

References a, b, intarray_concat_arrays(), PG_FREE_IF_COPY, PG_GETARG_ARRAYTYPE_P, and PG_RETURN_POINTER.

◆ intarray_push_elem()

Datum intarray_push_elem ( PG_FUNCTION_ARGS  )

Definition at line 326 of file _int_op.c.

327{
329 ArrayType *result;
330
331 result = intarray_add_elem(a, PG_GETARG_INT32(1));
332 PG_FREE_IF_COPY(a, 0);
333 PG_RETURN_POINTER(result);
334}
ArrayType * intarray_add_elem(ArrayType *a, int32 elem)
Definition: _int_tool.c:354

References a, intarray_add_elem(), PG_FREE_IF_COPY, PG_GETARG_ARRAYTYPE_P, PG_GETARG_INT32, and PG_RETURN_POINTER.

◆ intset()

◆ intset_subtract()

Datum intset_subtract ( PG_FUNCTION_ARGS  )

Definition at line 392 of file _int_op.c.

393{
396 ArrayType *result;
397 int32 ca;
398 int32 cb;
399 int32 *aa,
400 *bb,
401 *r;
402 int32 n = 0,
403 i = 0,
404 k = 0;
405
408
409 QSORT(a, 1);
410 a = _int_unique(a);
411 ca = ARRNELEMS(a);
412 QSORT(b, 1);
413 b = _int_unique(b);
414 cb = ARRNELEMS(b);
415 result = new_intArrayType(ca);
416 aa = ARRPTR(a);
417 bb = ARRPTR(b);
418 r = ARRPTR(result);
419 while (i < ca)
420 {
421 if (k == cb || aa[i] < bb[k])
422 r[n++] = aa[i++];
423 else if (aa[i] == bb[k])
424 {
425 i++;
426 k++;
427 }
428 else
429 k++;
430 }
431 result = resize_intArrayType(result, n);
432 pfree(a);
433 pfree(b);
434 PG_RETURN_POINTER(result);
435}
ArrayType * new_intArrayType(int num)
Definition: _int_tool.c:224
#define QSORT(a, direction)
Definition: _int.h:180
ArrayType * _int_unique(ArrayType *r)
Definition: _int_tool.c:313

References _int_unique(), a, ARRNELEMS, ARRPTR, b, CHECKARRVALID, i, new_intArrayType(), pfree(), PG_GETARG_ARRAYTYPE_P_COPY, PG_RETURN_POINTER, QSORT, and resize_intArrayType().

◆ intset_union_elem()

Datum intset_union_elem ( PG_FUNCTION_ARGS  )

Definition at line 380 of file _int_op.c.

381{
383 ArrayType *result;
384
385 result = intarray_add_elem(a, PG_GETARG_INT32(1));
386 PG_FREE_IF_COPY(a, 0);
387 QSORT(result, 1);
389}

References _int_unique(), a, intarray_add_elem(), PG_FREE_IF_COPY, PG_GETARG_ARRAYTYPE_P, PG_GETARG_INT32, PG_RETURN_POINTER, and QSORT.

◆ PG_FUNCTION_INFO_V1() [1/20]

PG_FUNCTION_INFO_V1 ( _int_contained  )

◆ PG_FUNCTION_INFO_V1() [2/20]

PG_FUNCTION_INFO_V1 ( _int_contains  )

◆ PG_FUNCTION_INFO_V1() [3/20]

PG_FUNCTION_INFO_V1 ( _int_different  )

◆ PG_FUNCTION_INFO_V1() [4/20]

PG_FUNCTION_INFO_V1 ( _int_inter  )

◆ PG_FUNCTION_INFO_V1() [5/20]

PG_FUNCTION_INFO_V1 ( _int_overlap  )

◆ PG_FUNCTION_INFO_V1() [6/20]

PG_FUNCTION_INFO_V1 ( _int_same  )

◆ PG_FUNCTION_INFO_V1() [7/20]

PG_FUNCTION_INFO_V1 ( _int_union  )

◆ PG_FUNCTION_INFO_V1() [8/20]

PG_FUNCTION_INFO_V1 ( icount  )

◆ PG_FUNCTION_INFO_V1() [9/20]

PG_FUNCTION_INFO_V1 ( idx  )

◆ PG_FUNCTION_INFO_V1() [10/20]

PG_FUNCTION_INFO_V1 ( intarray_del_elem  )

◆ PG_FUNCTION_INFO_V1() [11/20]

PG_FUNCTION_INFO_V1 ( intarray_push_array  )

◆ PG_FUNCTION_INFO_V1() [12/20]

PG_FUNCTION_INFO_V1 ( intarray_push_elem  )

◆ PG_FUNCTION_INFO_V1() [13/20]

PG_FUNCTION_INFO_V1 ( intset  )

◆ PG_FUNCTION_INFO_V1() [14/20]

PG_FUNCTION_INFO_V1 ( intset_subtract  )

◆ PG_FUNCTION_INFO_V1() [15/20]

PG_FUNCTION_INFO_V1 ( intset_union_elem  )

◆ PG_FUNCTION_INFO_V1() [16/20]

PG_FUNCTION_INFO_V1 ( sort  )

◆ PG_FUNCTION_INFO_V1() [17/20]

PG_FUNCTION_INFO_V1 ( sort_asc  )

◆ PG_FUNCTION_INFO_V1() [18/20]

PG_FUNCTION_INFO_V1 ( sort_desc  )

◆ PG_FUNCTION_INFO_V1() [19/20]

PG_FUNCTION_INFO_V1 ( subarray  )

◆ PG_FUNCTION_INFO_V1() [20/20]

PG_FUNCTION_INFO_V1 ( uniq  )

◆ PG_MODULE_MAGIC_EXT()

PG_MODULE_MAGIC_EXT ( name = "intarray",
version = PG_VERSION 
)

◆ sort()

Datum sort ( PG_FUNCTION_ARGS  )

Definition at line 198 of file _int_op.c.

199{
201 text *dirstr = (fcinfo->nargs == 2) ? PG_GETARG_TEXT_PP(1) : NULL;
202 int32 dc = (dirstr) ? VARSIZE_ANY_EXHDR(dirstr) : 0;
203 char *d = (dirstr) ? VARDATA_ANY(dirstr) : NULL;
204 int dir = -1;
205
207 if (ARRNELEMS(a) < 2)
209
210 if (dirstr == NULL || (dc == 3
211 && (d[0] == 'A' || d[0] == 'a')
212 && (d[1] == 'S' || d[1] == 's')
213 && (d[2] == 'C' || d[2] == 'c')))
214 dir = 1;
215 else if (dc == 4
216 && (d[0] == 'D' || d[0] == 'd')
217 && (d[1] == 'E' || d[1] == 'e')
218 && (d[2] == 'S' || d[2] == 's')
219 && (d[3] == 'C' || d[3] == 'c'))
220 dir = 0;
221 if (dir == -1)
223 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
224 errmsg("second parameter must be \"ASC\" or \"DESC\"")));
225 QSORT(a, dir);
227}
int errcode(int sqlerrcode)
Definition: elog.c:854
int errmsg(const char *fmt,...)
Definition: elog.c:1071
#define ERROR
Definition: elog.h:39
#define ereport(elevel,...)
Definition: elog.h:149
#define PG_GETARG_TEXT_PP(n)
Definition: fmgr.h:309
Definition: c.h:658
#define VARDATA_ANY(PTR)
Definition: varatt.h:324
#define VARSIZE_ANY_EXHDR(PTR)
Definition: varatt.h:317

References a, ARRNELEMS, CHECKARRVALID, ereport, errcode(), errmsg(), ERROR, PG_GETARG_ARRAYTYPE_P_COPY, PG_GETARG_TEXT_PP, PG_RETURN_POINTER, QSORT, VARDATA_ANY, and VARSIZE_ANY_EXHDR.

Referenced by create_append_plan(), create_incremental_sort_path(), create_merge_append_plan(), create_mergejoin_plan(), and create_unique_plan().

◆ sort_asc()

Datum sort_asc ( PG_FUNCTION_ARGS  )

Definition at line 230 of file _int_op.c.

231{
233
235 QSORT(a, 1);
237}

References a, CHECKARRVALID, PG_GETARG_ARRAYTYPE_P_COPY, PG_RETURN_POINTER, and QSORT.

◆ sort_desc()

Datum sort_desc ( PG_FUNCTION_ARGS  )

Definition at line 240 of file _int_op.c.

241{
243
245 QSORT(a, 0);
247}

References a, CHECKARRVALID, PG_GETARG_ARRAYTYPE_P_COPY, PG_RETURN_POINTER, and QSORT.

◆ subarray()

Datum subarray ( PG_FUNCTION_ARGS  )

Definition at line 276 of file _int_op.c.

277{
280 int32 len = (fcinfo->nargs == 3) ? PG_GETARG_INT32(2) : 0;
281 int32 end = 0;
282 int32 c;
283 ArrayType *result;
284
285 start = (start > 0) ? start - 1 : start;
286
288 if (ARRISEMPTY(a))
289 {
290 PG_FREE_IF_COPY(a, 0);
292 }
293
294 c = ARRNELEMS(a);
295
296 if (start < 0)
297 start = c + start;
298
299 if (len < 0)
300 end = c + len;
301 else if (len == 0)
302 end = c;
303 else
304 end = start + len;
305
306 if (end > c)
307 end = c;
308
309 if (start < 0)
310 start = 0;
311
312 if (start >= end || end <= 0)
313 {
314 PG_FREE_IF_COPY(a, 0);
316 }
317
318 result = new_intArrayType(end - start);
319 if (end - start > 0)
320 memcpy(ARRPTR(result), ARRPTR(a) + start, (end - start) * sizeof(int32));
321 PG_FREE_IF_COPY(a, 0);
322 PG_RETURN_POINTER(result);
323}
return str start
const void size_t len

References a, ARRISEMPTY, ARRNELEMS, ARRPTR, CHECKARRVALID, len, new_intArrayType(), PG_FREE_IF_COPY, PG_GETARG_ARRAYTYPE_P, PG_GETARG_INT32, PG_RETURN_POINTER, and start.

◆ uniq()

Datum uniq ( PG_FUNCTION_ARGS  )

Definition at line 250 of file _int_op.c.

251{
253
255 if (ARRNELEMS(a) < 2)
257 a = _int_unique(a);
259}

References _int_unique(), a, ARRNELEMS, CHECKARRVALID, PG_GETARG_ARRAYTYPE_P_COPY, and PG_RETURN_POINTER.