PostgreSQL Source Code  git master
_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_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)
 

Variables

 PG_MODULE_MAGIC
 

Function Documentation

◆ _int_contained()

Datum _int_contained ( PG_FUNCTION_ARGS  )

Definition at line 19 of file _int_op.c.

20 {
21  /* just reverse the operands and call _int_contains */
23  PG_GETARG_DATUM(1),
24  PG_GETARG_DATUM(0));
25 }
Datum _int_contains(PG_FUNCTION_ARGS)
Definition: _int_op.c:28
#define DirectFunctionCall2(func, arg1, arg2)
Definition: fmgr.h:643
#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 28 of file _int_op.c.

29 {
30  /* Force copy so we can modify the arrays in-place */
33  bool res;
34 
37  PREPAREARR(a);
38  PREPAREARR(b);
40  pfree(a);
41  pfree(b);
43 }
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:69
int a
Definition: isn.c:68
void pfree(void *pointer)
Definition: mcxt.c:1521

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

Referenced by _int_contained().

◆ _int_different()

Datum _int_different ( PG_FUNCTION_ARGS  )

Definition at line 46 of file _int_op.c.

47 {
51 }
Datum _int_same(PG_FUNCTION_ARGS)
Definition: _int_op.c:54
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:276
static bool DatumGetBool(Datum X)
Definition: postgres.h:90
static Datum PointerGetDatum(const void *X)
Definition: postgres.h:322

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

◆ _int_inter()

Datum _int_inter ( PG_FUNCTION_ARGS  )

Definition at line 143 of file _int_op.c.

144 {
147  ArrayType *result;
148 
149  CHECKARRVALID(a);
150  CHECKARRVALID(b);
151 
152  SORT(a);
153  SORT(b);
154 
155  result = inner_int_inter(a, b);
156 
157  pfree(a);
158  pfree(b);
159 
160  PG_RETURN_POINTER(result);
161 }
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 99 of file _int_op.c.

100 {
103  bool result;
104 
105  CHECKARRVALID(a);
106  CHECKARRVALID(b);
107  if (ARRISEMPTY(a) || ARRISEMPTY(b))
108  return false;
109 
110  SORT(a);
111  SORT(b);
112 
113  result = inner_int_overlap(a, b);
114 
115  pfree(a);
116  pfree(b);
117 
118  PG_RETURN_BOOL(result);
119 }
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 54 of file _int_op.c.

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

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 122 of file _int_op.c.

123 {
126  ArrayType *result;
127 
128  CHECKARRVALID(a);
129  CHECKARRVALID(b);
130 
131  SORT(a);
132  SORT(b);
133 
134  result = inner_int_union(a, b);
135 
136  pfree(a);
137  pfree(b);
138 
139  PG_RETURN_POINTER(result);
140 }
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 185 of file _int_op.c.

186 {
188  int32 count = ARRNELEMS(a);
189 
190  PG_FREE_IF_COPY(a, 0);
191  PG_RETURN_INT32(count);
192 }
#define PG_GETARG_ARRAYTYPE_P(n)
Definition: array.h:263
signed int int32
Definition: c.h:508
#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 259 of file _int_op.c.

260 {
262  int32 result;
263 
264  CHECKARRVALID(a);
265  result = ARRNELEMS(a);
266  if (result)
267  result = intarray_match_first(a, PG_GETARG_INT32(1));
268  PG_FREE_IF_COPY(a, 0);
269  PG_RETURN_INT32(result);
270 }
int32 intarray_match_first(ArrayType *a, int32 elem)
Definition: _int_tool.c:336
#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(), AttachPartitionEnsureIndexes(), avlCollectFields(), brin_minmax_multi_summary_out(), brin_revmap_data(), build_expr_data(), build_sorted_items(), 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_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(), 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 347 of file _int_op.c.

348 {
350  int32 elem = PG_GETARG_INT32(1);
351  int32 c;
352  int32 *aa;
353  int32 n = 0,
354  i;
355 
356  CHECKARRVALID(a);
357  if (!ARRISEMPTY(a))
358  {
359  c = ARRNELEMS(a);
360  aa = ARRPTR(a);
361  for (i = 0; i < c; i++)
362  {
363  if (aa[i] != elem)
364  {
365  if (i > n)
366  aa[n++] = aa[i];
367  else
368  n++;
369  }
370  }
371  a = resize_intArrayType(a, n);
372  }
374 }
ArrayType * resize_intArrayType(ArrayType *a, int num)
Definition: _int_tool.c:250
int i
Definition: isn.c:72
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 334 of file _int_op.c.

335 {
338  ArrayType *result;
339 
340  result = intarray_concat_arrays(a, b);
341  PG_FREE_IF_COPY(a, 0);
342  PG_FREE_IF_COPY(b, 1);
343  PG_RETURN_POINTER(result);
344 }
ArrayType * intarray_concat_arrays(ArrayType *a, ArrayType *b)
Definition: _int_tool.c:369

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 323 of file _int_op.c.

324 {
326  ArrayType *result;
327 
328  result = intarray_add_elem(a, PG_GETARG_INT32(1));
329  PG_FREE_IF_COPY(a, 0);
330  PG_RETURN_POINTER(result);
331 }
ArrayType * intarray_add_elem(ArrayType *a, int32 elem)
Definition: _int_tool.c:352

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 389 of file _int_op.c.

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

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 377 of file _int_op.c.

378 {
380  ArrayType *result;
381 
382  result = intarray_add_elem(a, PG_GETARG_INT32(1));
383  PG_FREE_IF_COPY(a, 0);
384  QSORT(result, 1);
386 }

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  )

◆ sort()

Datum sort ( PG_FUNCTION_ARGS  )

Definition at line 195 of file _int_op.c.

196 {
198  text *dirstr = (fcinfo->nargs == 2) ? PG_GETARG_TEXT_PP(1) : NULL;
199  int32 dc = (dirstr) ? VARSIZE_ANY_EXHDR(dirstr) : 0;
200  char *d = (dirstr) ? VARDATA_ANY(dirstr) : NULL;
201  int dir = -1;
202 
203  CHECKARRVALID(a);
204  if (ARRNELEMS(a) < 2)
206 
207  if (dirstr == NULL || (dc == 3
208  && (d[0] == 'A' || d[0] == 'a')
209  && (d[1] == 'S' || d[1] == 's')
210  && (d[2] == 'C' || d[2] == 'c')))
211  dir = 1;
212  else if (dc == 4
213  && (d[0] == 'D' || d[0] == 'd')
214  && (d[1] == 'E' || d[1] == 'e')
215  && (d[2] == 'S' || d[2] == 's')
216  && (d[3] == 'C' || d[3] == 'c'))
217  dir = 0;
218  if (dir == -1)
219  ereport(ERROR,
220  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
221  errmsg("second parameter must be \"ASC\" or \"DESC\"")));
222  QSORT(a, dir);
224 }
int errcode(int sqlerrcode)
Definition: elog.c:853
int errmsg(const char *fmt,...)
Definition: elog.c:1070
#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:690
#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 227 of file _int_op.c.

228 {
230 
231  CHECKARRVALID(a);
232  QSORT(a, 1);
234 }

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

◆ sort_desc()

Datum sort_desc ( PG_FUNCTION_ARGS  )

Definition at line 237 of file _int_op.c.

238 {
240 
241  CHECKARRVALID(a);
242  QSORT(a, 0);
244 }

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

◆ subarray()

Datum subarray ( PG_FUNCTION_ARGS  )

Definition at line 273 of file _int_op.c.

274 {
277  int32 len = (fcinfo->nargs == 3) ? PG_GETARG_INT32(2) : 0;
278  int32 end = 0;
279  int32 c;
280  ArrayType *result;
281 
282  start = (start > 0) ? start - 1 : start;
283 
284  CHECKARRVALID(a);
285  if (ARRISEMPTY(a))
286  {
287  PG_FREE_IF_COPY(a, 0);
289  }
290 
291  c = ARRNELEMS(a);
292 
293  if (start < 0)
294  start = c + start;
295 
296  if (len < 0)
297  end = c + len;
298  else if (len == 0)
299  end = c;
300  else
301  end = start + len;
302 
303  if (end > c)
304  end = c;
305 
306  if (start < 0)
307  start = 0;
308 
309  if (start >= end || end <= 0)
310  {
311  PG_FREE_IF_COPY(a, 0);
313  }
314 
315  result = new_intArrayType(end - start);
316  if (end - start > 0)
317  memcpy(ARRPTR(result), ARRPTR(a) + start, (end - start) * sizeof(int32));
318  PG_FREE_IF_COPY(a, 0);
319  PG_RETURN_POINTER(result);
320 }
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 247 of file _int_op.c.

248 {
250 
251  CHECKARRVALID(a);
252  if (ARRNELEMS(a) < 2)
254  a = _int_unique(a);
256 }

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

Variable Documentation

◆ PG_MODULE_MAGIC

PG_MODULE_MAGIC

Definition at line 8 of file _int_op.c.