PostgreSQL Source Code git master
Loading...
Searching...
No Matches
pg_list.h File Reference
#include "nodes/nodes.h"
Include dependency graph for pg_list.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

union  ListCell
 
struct  List
 
struct  ForEachState
 
struct  ForBothState
 
struct  ForBothCellState
 
struct  ForThreeState
 
struct  ForFourState
 
struct  ForFiveState
 

Macros

#define NIL   ((List *) NULL)
 
#define lfirst(lc)   ((lc)->ptr_value)
 
#define lfirst_int(lc)   ((lc)->int_value)
 
#define lfirst_oid(lc)   ((lc)->oid_value)
 
#define lfirst_xid(lc)   ((lc)->xid_value)
 
#define lfirst_node(type, lc)   castNode(type, lfirst(lc))
 
#define linitial(l)   lfirst(list_nth_cell(l, 0))
 
#define linitial_int(l)   lfirst_int(list_nth_cell(l, 0))
 
#define linitial_oid(l)   lfirst_oid(list_nth_cell(l, 0))
 
#define linitial_node(type, l)   castNode(type, linitial(l))
 
#define lsecond(l)   lfirst(list_nth_cell(l, 1))
 
#define lsecond_int(l)   lfirst_int(list_nth_cell(l, 1))
 
#define lsecond_oid(l)   lfirst_oid(list_nth_cell(l, 1))
 
#define lsecond_node(type, l)   castNode(type, lsecond(l))
 
#define lthird(l)   lfirst(list_nth_cell(l, 2))
 
#define lthird_int(l)   lfirst_int(list_nth_cell(l, 2))
 
#define lthird_oid(l)   lfirst_oid(list_nth_cell(l, 2))
 
#define lthird_node(type, l)   castNode(type, lthird(l))
 
#define lfourth(l)   lfirst(list_nth_cell(l, 3))
 
#define lfourth_int(l)   lfirst_int(list_nth_cell(l, 3))
 
#define lfourth_oid(l)   lfirst_oid(list_nth_cell(l, 3))
 
#define lfourth_node(type, l)   castNode(type, lfourth(l))
 
#define llast(l)   lfirst(list_last_cell(l))
 
#define llast_int(l)   lfirst_int(list_last_cell(l))
 
#define llast_oid(l)   lfirst_oid(list_last_cell(l))
 
#define llast_xid(l)   lfirst_xid(list_last_cell(l))
 
#define llast_node(type, l)   castNode(type, llast(l))
 
#define list_make_ptr_cell(v)   ((ListCell) {.ptr_value = (v)})
 
#define list_make_int_cell(v)   ((ListCell) {.int_value = (v)})
 
#define list_make_oid_cell(v)   ((ListCell) {.oid_value = (v)})
 
#define list_make_xid_cell(v)   ((ListCell) {.xid_value = (v)})
 
#define list_make1(x1)    list_make1_impl(T_List, list_make_ptr_cell(x1))
 
#define list_make2(x1, x2)    list_make2_impl(T_List, list_make_ptr_cell(x1), list_make_ptr_cell(x2))
 
#define list_make3(x1, x2, x3)
 
#define list_make4(x1, x2, x3, x4)
 
#define list_make5(x1, x2, x3, x4, x5)
 
#define list_make1_int(x1)    list_make1_impl(T_IntList, list_make_int_cell(x1))
 
#define list_make2_int(x1, x2)    list_make2_impl(T_IntList, list_make_int_cell(x1), list_make_int_cell(x2))
 
#define list_make3_int(x1, x2, x3)
 
#define list_make4_int(x1, x2, x3, x4)
 
#define list_make5_int(x1, x2, x3, x4, x5)
 
#define list_make1_oid(x1)    list_make1_impl(T_OidList, list_make_oid_cell(x1))
 
#define list_make2_oid(x1, x2)    list_make2_impl(T_OidList, list_make_oid_cell(x1), list_make_oid_cell(x2))
 
#define list_make3_oid(x1, x2, x3)
 
#define list_make4_oid(x1, x2, x3, x4)
 
#define list_make5_oid(x1, x2, x3, x4, x5)
 
#define list_make1_xid(x1)    list_make1_impl(T_XidList, list_make_xid_cell(x1))
 
#define list_make2_xid(x1, x2)    list_make2_impl(T_XidList, list_make_xid_cell(x1), list_make_xid_cell(x2))
 
#define list_make3_xid(x1, x2, x3)
 
#define list_make4_xid(x1, x2, x3, x4)
 
#define list_make5_xid(x1, x2, x3, x4, x5)
 
#define list_nth_node(type, list, n)   castNode(type, list_nth(list, n))
 
#define foreach(cell, lst)
 
#define foreach_delete_current(lst, var_or_cell)    ((List *) (var_or_cell##__state.l = list_delete_nth_cell(lst, var_or_cell##__state.i--)))
 
#define foreach_current_index(var_or_cell)   (var_or_cell##__state.i)
 
#define for_each_from(cell, lst, N)
 
#define for_each_cell(cell, lst, initcell)
 
#define foreach_ptr(type, var, lst)   foreach_internal(type, *, var, lst, lfirst)
 
#define foreach_int(var, lst)   foreach_internal(int, , var, lst, lfirst_int)
 
#define foreach_oid(var, lst)   foreach_internal(Oid, , var, lst, lfirst_oid)
 
#define foreach_xid(var, lst)   foreach_internal(TransactionId, , var, lst, lfirst_xid)
 
#define foreach_internal(type, pointer, var, lst, func)
 
#define foreach_node(type, var, lst)
 
#define forboth(cell1, list1, cell2, list2)
 
#define multi_for_advance_cell(cell, state, l, i)
 
#define for_both_cell(cell1, list1, initcell1, cell2, list2, initcell2)
 
#define forthree(cell1, list1, cell2, list2, cell3, list3)
 
#define forfour(cell1, list1, cell2, list2, cell3, list3, cell4, list4)
 
#define forfive(cell1, list1, cell2, list2, cell3, list3, cell4, list4, cell5, list5)
 

Typedefs

typedef union ListCell ListCell
 
typedef struct List List
 
typedef struct ForEachState ForEachState
 
typedef struct ForBothState ForBothState
 
typedef struct ForBothCellState ForBothCellState
 
typedef struct ForThreeState ForThreeState
 
typedef struct ForFourState ForFourState
 
typedef struct ForFiveState ForFiveState
 
typedef int(* list_sort_comparator) (const ListCell *a, const ListCell *b)
 

Functions

static ListCelllist_head (const List *l)
 
static ListCelllist_tail (const List *l)
 
static ListCelllist_second_cell (const List *l)
 
static int list_length (const List *l)
 
static ListCelllist_nth_cell (const List *list, int n)
 
static ListCelllist_last_cell (const List *list)
 
static voidlist_nth (const List *list, int n)
 
static int list_nth_int (const List *list, int n)
 
static Oid list_nth_oid (const List *list, int n)
 
static int list_cell_number (const List *l, const ListCell *c)
 
static ListCelllnext (const List *l, const ListCell *c)
 
static ForEachState for_each_from_setup (const List *lst, int N)
 
static ForEachState for_each_cell_setup (const List *lst, const ListCell *initcell)
 
static ForBothCellState for_both_cell_setup (const List *list1, const ListCell *initcell1, const List *list2, const ListCell *initcell2)
 
Listlist_make1_impl (NodeTag t, ListCell datum1)
 
Listlist_make2_impl (NodeTag t, ListCell datum1, ListCell datum2)
 
Listlist_make3_impl (NodeTag t, ListCell datum1, ListCell datum2, ListCell datum3)
 
Listlist_make4_impl (NodeTag t, ListCell datum1, ListCell datum2, ListCell datum3, ListCell datum4)
 
Listlist_make5_impl (NodeTag t, ListCell datum1, ListCell datum2, ListCell datum3, ListCell datum4, ListCell datum5)
 
pg_nodiscard Listlappend (List *list, void *datum)
 
pg_nodiscard Listlappend_int (List *list, int datum)
 
pg_nodiscard Listlappend_oid (List *list, Oid datum)
 
pg_nodiscard Listlappend_xid (List *list, TransactionId datum)
 
pg_nodiscard Listlist_insert_nth (List *list, int pos, void *datum)
 
pg_nodiscard Listlist_insert_nth_int (List *list, int pos, int datum)
 
pg_nodiscard Listlist_insert_nth_oid (List *list, int pos, Oid datum)
 
pg_nodiscard Listlcons (void *datum, List *list)
 
pg_nodiscard Listlcons_int (int datum, List *list)
 
pg_nodiscard Listlcons_oid (Oid datum, List *list)
 
pg_nodiscard Listlist_concat (List *list1, const List *list2)
 
pg_nodiscard Listlist_concat_copy (const List *list1, const List *list2)
 
pg_nodiscard Listlist_truncate (List *list, int new_size)
 
bool list_member (const List *list, const void *datum)
 
bool list_member_ptr (const List *list, const void *datum)
 
bool list_member_int (const List *list, int datum)
 
bool list_member_oid (const List *list, Oid datum)
 
bool list_member_xid (const List *list, TransactionId datum)
 
pg_nodiscard Listlist_delete (List *list, void *datum)
 
pg_nodiscard Listlist_delete_ptr (List *list, void *datum)
 
pg_nodiscard Listlist_delete_int (List *list, int datum)
 
pg_nodiscard Listlist_delete_oid (List *list, Oid datum)
 
pg_nodiscard Listlist_delete_first (List *list)
 
pg_nodiscard Listlist_delete_last (List *list)
 
pg_nodiscard Listlist_delete_first_n (List *list, int n)
 
pg_nodiscard Listlist_delete_nth_cell (List *list, int n)
 
pg_nodiscard Listlist_delete_cell (List *list, ListCell *cell)
 
Listlist_union (const List *list1, const List *list2)
 
Listlist_union_ptr (const List *list1, const List *list2)
 
Listlist_union_int (const List *list1, const List *list2)
 
Listlist_union_oid (const List *list1, const List *list2)
 
Listlist_intersection (const List *list1, const List *list2)
 
Listlist_intersection_int (const List *list1, const List *list2)
 
Listlist_difference (const List *list1, const List *list2)
 
Listlist_difference_ptr (const List *list1, const List *list2)
 
Listlist_difference_int (const List *list1, const List *list2)
 
Listlist_difference_oid (const List *list1, const List *list2)
 
pg_nodiscard Listlist_append_unique (List *list, void *datum)
 
pg_nodiscard Listlist_append_unique_ptr (List *list, void *datum)
 
pg_nodiscard Listlist_append_unique_int (List *list, int datum)
 
pg_nodiscard Listlist_append_unique_oid (List *list, Oid datum)
 
pg_nodiscard Listlist_concat_unique (List *list1, const List *list2)
 
pg_nodiscard Listlist_concat_unique_ptr (List *list1, const List *list2)
 
pg_nodiscard Listlist_concat_unique_int (List *list1, const List *list2)
 
pg_nodiscard Listlist_concat_unique_oid (List *list1, const List *list2)
 
void list_deduplicate_oid (List *list)
 
void list_free (List *list)
 
void list_free_deep (List *list)
 
pg_nodiscard Listlist_copy (const List *oldlist)
 
pg_nodiscard Listlist_copy_head (const List *oldlist, int len)
 
pg_nodiscard Listlist_copy_tail (const List *oldlist, int nskip)
 
pg_nodiscard Listlist_copy_deep (const List *oldlist)
 
void list_sort (List *list, list_sort_comparator cmp)
 
int list_int_cmp (const ListCell *p1, const ListCell *p2)
 
int list_oid_cmp (const ListCell *p1, const ListCell *p2)
 

Macro Definition Documentation

◆ for_both_cell

#define for_both_cell (   cell1,
  list1,
  initcell1,
  cell2,
  list2,
  initcell2 
)
Value:
(cell1 != NULL && cell2 != NULL); \
static ForBothCellState for_both_cell_setup(const List *list1, const ListCell *initcell1, const List *list2, const ListCell *initcell2)
Definition pg_list.h:549
static int fb(int x)

Definition at line 540 of file pg_list.h.

550{
554
555 return r;
556}
557
558/*
559 * forthree -
560 * the same for three lists
561 */
562#define forthree(cell1, list1, cell2, list2, cell3, list3) \
563 for (ForThreeState cell1##__state = {(list1), (list2), (list3), 0}; \
564 multi_for_advance_cell(cell1, cell1##__state, l1, i), \
565 multi_for_advance_cell(cell2, cell1##__state, l2, i), \
566 multi_for_advance_cell(cell3, cell1##__state, l3, i), \
567 (cell1 != NULL && cell2 != NULL && cell3 != NULL); \
568 cell1##__state.i++)
569
570/*
571 * forfour -
572 * the same for four lists
573 */
574#define forfour(cell1, list1, cell2, list2, cell3, list3, cell4, list4) \
575 for (ForFourState cell1##__state = {(list1), (list2), (list3), (list4), 0}; \
576 multi_for_advance_cell(cell1, cell1##__state, l1, i), \
577 multi_for_advance_cell(cell2, cell1##__state, l2, i), \
578 multi_for_advance_cell(cell3, cell1##__state, l3, i), \
579 multi_for_advance_cell(cell4, cell1##__state, l4, i), \
580 (cell1 != NULL && cell2 != NULL && cell3 != NULL && cell4 != NULL); \
581 cell1##__state.i++)
582
583/*
584 * forfive -
585 * the same for five lists
586 */
587#define forfive(cell1, list1, cell2, list2, cell3, list3, cell4, list4, cell5, list5) \
588 for (ForFiveState cell1##__state = {(list1), (list2), (list3), (list4), (list5), 0}; \
589 multi_for_advance_cell(cell1, cell1##__state, l1, i), \
590 multi_for_advance_cell(cell2, cell1##__state, l2, i), \
591 multi_for_advance_cell(cell3, cell1##__state, l3, i), \
592 multi_for_advance_cell(cell4, cell1##__state, l4, i), \
593 multi_for_advance_cell(cell5, cell1##__state, l5, i), \
594 (cell1 != NULL && cell2 != NULL && cell3 != NULL && \
595 cell4 != NULL && cell5 != NULL); \
596 cell1##__state.i++)
597
598/* Functions in src/backend/nodes/list.c */
599
600extern List *list_make1_impl(NodeTag t, ListCell datum1);
609
610pg_nodiscard extern List *lappend(List *list, void *datum);
611pg_nodiscard extern List *lappend_int(List *list, int datum);
612pg_nodiscard extern List *lappend_oid(List *list, Oid datum);
613pg_nodiscard extern List *lappend_xid(List *list, TransactionId datum);
614
615pg_nodiscard extern List *list_insert_nth(List *list, int pos, void *datum);
616pg_nodiscard extern List *list_insert_nth_int(List *list, int pos, int datum);
617pg_nodiscard extern List *list_insert_nth_oid(List *list, int pos, Oid datum);
618
619pg_nodiscard extern List *lcons(void *datum, List *list);
620pg_nodiscard extern List *lcons_int(int datum, List *list);
621pg_nodiscard extern List *lcons_oid(Oid datum, List *list);
622
624pg_nodiscard extern List *list_concat_copy(const List *list1, const List *list2);
625
626pg_nodiscard extern List *list_truncate(List *list, int new_size);
627
628extern bool list_member(const List *list, const void *datum);
629extern bool list_member_ptr(const List *list, const void *datum);
630extern bool list_member_int(const List *list, int datum);
631extern bool list_member_oid(const List *list, Oid datum);
632extern bool list_member_xid(const List *list, TransactionId datum);
633
634pg_nodiscard extern List *list_delete(List *list, void *datum);
635pg_nodiscard extern List *list_delete_ptr(List *list, void *datum);
636pg_nodiscard extern List *list_delete_int(List *list, int datum);
637pg_nodiscard extern List *list_delete_oid(List *list, Oid datum);
640pg_nodiscard extern List *list_delete_first_n(List *list, int n);
641pg_nodiscard extern List *list_delete_nth_cell(List *list, int n);
642pg_nodiscard extern List *list_delete_cell(List *list, ListCell *cell);
643
644extern List *list_union(const List *list1, const List *list2);
645extern List *list_union_ptr(const List *list1, const List *list2);
646extern List *list_union_int(const List *list1, const List *list2);
647extern List *list_union_oid(const List *list1, const List *list2);
648
649extern List *list_intersection(const List *list1, const List *list2);
650extern List *list_intersection_int(const List *list1, const List *list2);
651
652/* currently, there's no need for list_intersection_ptr etc */
653
654extern List *list_difference(const List *list1, const List *list2);
655extern List *list_difference_ptr(const List *list1, const List *list2);
656extern List *list_difference_int(const List *list1, const List *list2);
657extern List *list_difference_oid(const List *list1, const List *list2);
658
659pg_nodiscard extern List *list_append_unique(List *list, void *datum);
660pg_nodiscard extern List *list_append_unique_ptr(List *list, void *datum);
661pg_nodiscard extern List *list_append_unique_int(List *list, int datum);
662pg_nodiscard extern List *list_append_unique_oid(List *list, Oid datum);
663
668
669extern void list_deduplicate_oid(List *list);
670
671extern void list_free(List *list);
672extern void list_free_deep(List *list);
673
674pg_nodiscard extern List *list_copy(const List *oldlist);
675pg_nodiscard extern List *list_copy_head(const List *oldlist, int len);
676pg_nodiscard extern List *list_copy_tail(const List *oldlist, int nskip);
678
679typedef int (*list_sort_comparator) (const ListCell *a, const ListCell *b);
680extern void list_sort(List *list, list_sort_comparator cmp);
681
682extern int list_int_cmp(const ListCell *p1, const ListCell *p2);
683extern int list_oid_cmp(const ListCell *p1, const ListCell *p2);
684
685#endif /* PG_LIST_H */
#define pg_nodiscard
Definition c.h:144
uint32 TransactionId
Definition c.h:666
int b
Definition isn.c:74
int a
Definition isn.c:73
NodeTag
Definition nodes.h:27
const void size_t len
pg_nodiscard List * list_delete_first(List *list)
Definition list.c:943
List * list_difference(const List *list1, const List *list2)
Definition list.c:1237
pg_nodiscard List * list_copy_tail(const List *oldlist, int nskip)
Definition list.c:1613
pg_nodiscard List * lcons(void *datum, List *list)
Definition list.c:495
pg_nodiscard List * list_delete_first_n(List *list, int n)
Definition list.c:983
List * list_union_ptr(const List *list1, const List *list2)
Definition list.c:1090
List * list_make4_impl(NodeTag t, ListCell datum1, ListCell datum2, ListCell datum3, ListCell datum4)
Definition list.c:270
pg_nodiscard List * lappend_oid(List *list, Oid datum)
Definition list.c:375
void list_sort(List *list, list_sort_comparator cmp)
Definition list.c:1674
static int list_length(const List *l)
Definition pg_list.h:152
pg_nodiscard List * list_append_unique_ptr(List *list, void *datum)
Definition list.c:1356
pg_nodiscard List * list_concat_unique(List *list1, const List *list2)
Definition list.c:1405
pg_nodiscard List * list_concat_unique_int(List *list1, const List *list2)
Definition list.c:1448
pg_nodiscard List * list_copy_head(const List *oldlist, int len)
Definition list.c:1593
pg_nodiscard List * list_concat_copy(const List *list1, const List *list2)
Definition list.c:598
List * list_difference_ptr(const List *list1, const List *list2)
Definition list.c:1263
List * list_difference_int(const List *list1, const List *list2)
Definition list.c:1288
pg_nodiscard List * list_copy(const List *oldlist)
Definition list.c:1573
List * list_intersection(const List *list1, const List *list2)
Definition list.c:1174
List * list_make3_impl(NodeTag t, ListCell datum1, ListCell datum2, ListCell datum3)
Definition list.c:257
pg_nodiscard List * lappend(List *list, void *datum)
Definition list.c:339
pg_nodiscard List * list_copy_deep(const List *oldlist)
Definition list.c:1639
pg_nodiscard List * list_append_unique_int(List *list, int datum)
Definition list.c:1368
pg_nodiscard List * lcons_oid(Oid datum, List *list)
Definition list.c:531
pg_nodiscard List * list_append_unique(List *list, void *datum)
Definition list.c:1343
pg_nodiscard List * list_delete_oid(List *list, Oid datum)
Definition list.c:910
pg_nodiscard List * lappend_xid(List *list, TransactionId datum)
Definition list.c:393
pg_nodiscard List * list_delete_ptr(List *list, void *datum)
Definition list.c:872
List * list_difference_oid(const List *list1, const List *list2)
Definition list.c:1313
pg_nodiscard List * lappend_int(List *list, int datum)
Definition list.c:357
pg_nodiscard List * list_insert_nth_oid(List *list, int pos, Oid datum)
Definition list.c:467
pg_nodiscard List * list_delete_int(List *list, int datum)
Definition list.c:891
pg_nodiscard List * list_delete_last(List *list)
Definition list.c:957
pg_nodiscard List * list_insert_nth(List *list, int pos, void *datum)
Definition list.c:439
List * list_union_oid(const List *list1, const List *list2)
Definition list.c:1136
pg_nodiscard List * list_concat_unique_oid(List *list1, const List *list2)
Definition list.c:1469
bool list_member_xid(const List *list, TransactionId datum)
Definition list.c:742
List * list_make1_impl(NodeTag t, ListCell datum1)
Definition list.c:236
pg_nodiscard List * list_append_unique_oid(List *list, Oid datum)
Definition list.c:1380
List * list_intersection_int(const List *list1, const List *list2)
Definition list.c:1200
pg_nodiscard List * list_delete_nth_cell(List *list, int n)
Definition list.c:767
pg_nodiscard List * lcons_int(int datum, List *list)
Definition list.c:513
int(* list_sort_comparator)(const ListCell *a, const ListCell *b)
Definition pg_list.h:680
pg_nodiscard List * list_insert_nth_int(List *list, int pos, int datum)
Definition list.c:453
void list_deduplicate_oid(List *list)
Definition list.c:1495
int list_oid_cmp(const ListCell *p1, const ListCell *p2)
Definition list.c:1703
List * list_make2_impl(NodeTag t, ListCell datum1, ListCell datum2)
Definition list.c:246
pg_nodiscard List * list_delete_cell(List *list, ListCell *cell)
Definition list.c:841
bool list_member_ptr(const List *list, const void *datum)
Definition list.c:682
void list_free(List *list)
Definition list.c:1546
bool list_member_int(const List *list, int datum)
Definition list.c:702
bool list_member_oid(const List *list, Oid datum)
Definition list.c:722
int list_int_cmp(const ListCell *p1, const ListCell *p2)
Definition list.c:1691
pg_nodiscard List * list_truncate(List *list, int new_size)
Definition list.c:631
bool list_member(const List *list, const void *datum)
Definition list.c:661
List * list_union_int(const List *list1, const List *list2)
Definition list.c:1113
List * list_make5_impl(NodeTag t, ListCell datum1, ListCell datum2, ListCell datum3, ListCell datum4, ListCell datum5)
Definition list.c:284
pg_nodiscard List * list_concat_unique_ptr(List *list1, const List *list2)
Definition list.c:1427
void list_free_deep(List *list)
Definition list.c:1560
static int list_cell_number(const List *l, const ListCell *c)
Definition pg_list.h:333
pg_nodiscard List * list_delete(List *list, void *datum)
Definition list.c:853
List * list_union(const List *list1, const List *list2)
Definition list.c:1066
pg_nodiscard List * list_concat(List *list1, const List *list2)
Definition list.c:561
unsigned int Oid
static int cmp(const chr *x, const chr *y, size_t len)
Definition pg_list.h:54

◆ for_each_cell

#define for_each_cell (   cell,
  lst,
  initcell 
)
Value:
(cell##__state.l != NIL && \
cell##__state.i < cell##__state.l->length) ? \
(cell = &cell##__state.l->elements[cell##__state.i], true) : \
(cell = NULL, false); \
cell##__state.i++)
#define NIL
Definition pg_list.h:68
static ForEachState for_each_cell_setup(const List *lst, const ListCell *initcell)
Definition pg_list.h:447

Definition at line 438 of file pg_list.h.

442 : \
443 (cell = NULL, false); \
444 cell##__state.i++)

◆ for_each_from

#define for_each_from (   cell,
  lst,
 
)
Value:
(cell##__state.l != NIL && \
cell##__state.i < cell##__state.l->length) ? \
(cell = &cell##__state.l->elements[cell##__state.i], true) : \
(cell = NULL, false); \
cell##__state.i++)
static ForEachState for_each_from_setup(const List *lst, int N)
Definition pg_list.h:423

Definition at line 414 of file pg_list.h.

418 : \
419 (cell = NULL, false); \
420 cell##__state.i++)

◆ forboth

#define forboth (   cell1,
  list1,
  cell2,
  list2 
)
Value:

Definition at line 518 of file pg_list.h.

519 {(list1), (list2), 0}; \
522 (cell1 != NULL && cell2 != NULL); \
523 cell1##__state.i++)

◆ foreach

#define foreach (   cell,
  lst 
)
Value:
for (ForEachState cell##__state = {(lst), 0}; \
(cell##__state.l != NIL && \
cell##__state.i < cell##__state.l->length) ? \
(cell = &cell##__state.l->elements[cell##__state.i], true) : \
(cell = NULL, false); \
cell##__state.i++)

Definition at line 373 of file pg_list.h.

374 {(lst), 0}; \
375 (cell##__state.l != NIL && \
376 cell##__state.i < cell##__state.l->length) ? \
377 (cell = &cell##__state.l->elements[cell##__state.i], true) : \
378 (cell = NULL, false); \
379 cell##__state.i++)

◆ foreach_current_index

#define foreach_current_index (   var_or_cell)    (var_or_cell##__state.i)

Definition at line 403 of file pg_list.h.

◆ foreach_delete_current

#define foreach_delete_current (   lst,
  var_or_cell 
)     ((List *) (var_or_cell##__state.l = list_delete_nth_cell(lst, var_or_cell##__state.i--)))

Definition at line 391 of file pg_list.h.

◆ foreach_int

#define foreach_int (   var,
  lst 
)    foreach_internal(int, , var, lst, lfirst_int)

Definition at line 470 of file pg_list.h.

◆ foreach_internal

#define foreach_internal (   type,
  pointer,
  var,
  lst,
  func 
)
Value:
for (type pointer var = 0, pointer var##__outerloop = (type pointer) 1; \
var##__outerloop; \
var##__outerloop = 0) \
for (ForEachState var##__state = {(lst), 0}; \
(var##__state.l != NIL && \
var##__state.i < var##__state.l->length && \
(var = (type pointer) func(&var##__state.l->elements[var##__state.i]), true)); \
var##__state.i++)
const char * type

Definition at line 481 of file pg_list.h.

485 {(lst), 0}; \
486 (var##__state.l != NIL && \
487 var##__state.i < var##__state.l->length && \
488 (var = (type pointer) func(&var##__state.l->elements[var##__state.i]), true)); \
489 var##__state.i++)

◆ foreach_node

#define foreach_node (   type,
  var,
  lst 
)
Value:
for (type * var = 0, *var##__outerloop = (type *) 1; \
var##__outerloop; \
var##__outerloop = 0) \
for (ForEachState var##__state = {(lst), 0}; \
(var##__state.l != NIL && \
var##__state.i < var##__state.l->length && \
(var = lfirst_node(type, &var##__state.l->elements[var##__state.i]), true)); \
var##__state.i++)
#define lfirst_node(type, lc)
Definition pg_list.h:176

Definition at line 496 of file pg_list.h.

500 {(lst), 0}; \
501 (var##__state.l != NIL && \
502 var##__state.i < var##__state.l->length && \
503 (var = lfirst_node(type, &var##__state.l->elements[var##__state.i]), true)); \
504 var##__state.i++)

◆ foreach_oid

#define foreach_oid (   var,
  lst 
)    foreach_internal(Oid, , var, lst, lfirst_oid)

Definition at line 471 of file pg_list.h.

◆ foreach_ptr

#define foreach_ptr (   type,
  var,
  lst 
)    foreach_internal(type, *, var, lst, lfirst)

Definition at line 469 of file pg_list.h.

◆ foreach_xid

#define foreach_xid (   var,
  lst 
)    foreach_internal(TransactionId, , var, lst, lfirst_xid)

Definition at line 472 of file pg_list.h.

◆ forfive

◆ forfour

◆ forthree

#define forthree (   cell1,
  list1,
  cell2,
  list2,
  cell3,
  list3 
)

◆ lfirst

#define lfirst (   lc)    ((lc)->ptr_value)

Definition at line 172 of file pg_list.h.

◆ lfirst_int

#define lfirst_int (   lc)    ((lc)->int_value)

Definition at line 173 of file pg_list.h.

◆ lfirst_node

#define lfirst_node (   type,
  lc 
)    castNode(type, lfirst(lc))

Definition at line 176 of file pg_list.h.

◆ lfirst_oid

#define lfirst_oid (   lc)    ((lc)->oid_value)

Definition at line 174 of file pg_list.h.

◆ lfirst_xid

#define lfirst_xid (   lc)    ((lc)->xid_value)

Definition at line 175 of file pg_list.h.

◆ lfourth

#define lfourth (   l)    lfirst(list_nth_cell(l, 3))

Definition at line 193 of file pg_list.h.

◆ lfourth_int

#define lfourth_int (   l)    lfirst_int(list_nth_cell(l, 3))

Definition at line 194 of file pg_list.h.

◆ lfourth_node

#define lfourth_node (   type,
 
)    castNode(type, lfourth(l))

Definition at line 196 of file pg_list.h.

◆ lfourth_oid

#define lfourth_oid (   l)    lfirst_oid(list_nth_cell(l, 3))

Definition at line 195 of file pg_list.h.

◆ linitial

#define linitial (   l)    lfirst(list_nth_cell(l, 0))

Definition at line 178 of file pg_list.h.

◆ linitial_int

#define linitial_int (   l)    lfirst_int(list_nth_cell(l, 0))

Definition at line 179 of file pg_list.h.

◆ linitial_node

#define linitial_node (   type,
 
)    castNode(type, linitial(l))

Definition at line 181 of file pg_list.h.

◆ linitial_oid

#define linitial_oid (   l)    lfirst_oid(list_nth_cell(l, 0))

Definition at line 180 of file pg_list.h.

◆ list_make1

#define list_make1 (   x1)     list_make1_impl(T_List, list_make_ptr_cell(x1))

Definition at line 212 of file pg_list.h.

◆ list_make1_int

#define list_make1_int (   x1)     list_make1_impl(T_IntList, list_make_int_cell(x1))

Definition at line 227 of file pg_list.h.

◆ list_make1_oid

#define list_make1_oid (   x1)     list_make1_impl(T_OidList, list_make_oid_cell(x1))

Definition at line 242 of file pg_list.h.

◆ list_make1_xid

#define list_make1_xid (   x1)     list_make1_impl(T_XidList, list_make_xid_cell(x1))

Definition at line 257 of file pg_list.h.

◆ list_make2

Definition at line 214 of file pg_list.h.

◆ list_make2_int

#define list_make2_int (   x1,
  x2 
)     list_make2_impl(T_IntList, list_make_int_cell(x1), list_make_int_cell(x2))

Definition at line 229 of file pg_list.h.

◆ list_make2_oid

#define list_make2_oid (   x1,
  x2 
)     list_make2_impl(T_OidList, list_make_oid_cell(x1), list_make_oid_cell(x2))

Definition at line 244 of file pg_list.h.

◆ list_make2_xid

#define list_make2_xid (   x1,
  x2 
)     list_make2_impl(T_XidList, list_make_xid_cell(x1), list_make_xid_cell(x2))

Definition at line 259 of file pg_list.h.

◆ list_make3

#define list_make3 (   x1,
  x2,
  x3 
)
Value:

Definition at line 216 of file pg_list.h.

◆ list_make3_int

#define list_make3_int (   x1,
  x2,
  x3 
)
Value:

Definition at line 231 of file pg_list.h.

◆ list_make3_oid

#define list_make3_oid (   x1,
  x2,
  x3 
)
Value:

Definition at line 246 of file pg_list.h.

◆ list_make3_xid

#define list_make3_xid (   x1,
  x2,
  x3 
)
Value:

Definition at line 261 of file pg_list.h.

◆ list_make4

#define list_make4 (   x1,
  x2,
  x3,
  x4 
)

◆ list_make4_int

#define list_make4_int (   x1,
  x2,
  x3,
  x4 
)

◆ list_make4_oid

#define list_make4_oid (   x1,
  x2,
  x3,
  x4 
)

◆ list_make4_xid

#define list_make4_xid (   x1,
  x2,
  x3,
  x4 
)

◆ list_make5

#define list_make5 (   x1,
  x2,
  x3,
  x4,
  x5 
)

◆ list_make5_int

#define list_make5_int (   x1,
  x2,
  x3,
  x4,
  x5 
)

◆ list_make5_oid

#define list_make5_oid (   x1,
  x2,
  x3,
  x4,
  x5 
)

◆ list_make5_xid

#define list_make5_xid (   x1,
  x2,
  x3,
  x4,
  x5 
)

◆ list_make_int_cell

#define list_make_int_cell (   v)    ((ListCell) {.int_value = (v)})

Definition at line 208 of file pg_list.h.

◆ list_make_oid_cell

#define list_make_oid_cell (   v)    ((ListCell) {.oid_value = (v)})

Definition at line 209 of file pg_list.h.

◆ list_make_ptr_cell

#define list_make_ptr_cell (   v)    ((ListCell) {.ptr_value = (v)})

Definition at line 207 of file pg_list.h.

◆ list_make_xid_cell

#define list_make_xid_cell (   v)    ((ListCell) {.xid_value = (v)})

Definition at line 210 of file pg_list.h.

◆ list_nth_node

#define list_nth_node (   type,
  list,
 
)    castNode(type, list_nth(list, n))

Definition at line 327 of file pg_list.h.

◆ llast

#define llast (   l)    lfirst(list_last_cell(l))

Definition at line 198 of file pg_list.h.

◆ llast_int

#define llast_int (   l)    lfirst_int(list_last_cell(l))

Definition at line 199 of file pg_list.h.

◆ llast_node

#define llast_node (   type,
 
)    castNode(type, llast(l))

Definition at line 202 of file pg_list.h.

◆ llast_oid

#define llast_oid (   l)    lfirst_oid(list_last_cell(l))

Definition at line 200 of file pg_list.h.

◆ llast_xid

#define llast_xid (   l)    lfirst_xid(list_last_cell(l))

Definition at line 201 of file pg_list.h.

◆ lsecond

#define lsecond (   l)    lfirst(list_nth_cell(l, 1))

Definition at line 183 of file pg_list.h.

◆ lsecond_int

#define lsecond_int (   l)    lfirst_int(list_nth_cell(l, 1))

Definition at line 184 of file pg_list.h.

◆ lsecond_node

#define lsecond_node (   type,
 
)    castNode(type, lsecond(l))

Definition at line 186 of file pg_list.h.

◆ lsecond_oid

#define lsecond_oid (   l)    lfirst_oid(list_nth_cell(l, 1))

Definition at line 185 of file pg_list.h.

◆ lthird

#define lthird (   l)    lfirst(list_nth_cell(l, 2))

Definition at line 188 of file pg_list.h.

◆ lthird_int

#define lthird_int (   l)    lfirst_int(list_nth_cell(l, 2))

Definition at line 189 of file pg_list.h.

◆ lthird_node

#define lthird_node (   type,
 
)    castNode(type, lthird(l))

Definition at line 191 of file pg_list.h.

◆ lthird_oid

#define lthird_oid (   l)    lfirst_oid(list_nth_cell(l, 2))

Definition at line 190 of file pg_list.h.

◆ multi_for_advance_cell

#define multi_for_advance_cell (   cell,
  state,
  l,
  i 
)
Value:
(cell = (state.l != NIL && state.i < state.l->length) ? \
&state.l->elements[state.i] : NULL)

Definition at line 525 of file pg_list.h.

527 : NULL)

◆ NIL

#define NIL   ((List *) NULL)

Definition at line 68 of file pg_list.h.

Typedef Documentation

◆ ForBothCellState

◆ ForBothState

◆ ForEachState

◆ ForFiveState

◆ ForFourState

◆ ForThreeState

◆ List

◆ list_sort_comparator

typedef int(* list_sort_comparator) (const ListCell *a, const ListCell *b)

Definition at line 680 of file pg_list.h.

◆ ListCell

Function Documentation

◆ for_both_cell_setup()

static ForBothCellState for_both_cell_setup ( const List list1,
const ListCell initcell1,
const List list2,
const ListCell initcell2 
)
inlinestatic

Definition at line 549 of file pg_list.h.

References fb(), list_cell_number(), and list_length().

◆ for_each_cell_setup()

static ForEachState for_each_cell_setup ( const List lst,
const ListCell initcell 
)
inlinestatic

Definition at line 447 of file pg_list.h.

448{
449 ForEachState r = {lst,
451
452 return r;
453}

References fb(), list_cell_number(), and list_length().

◆ for_each_from_setup()

static ForEachState for_each_from_setup ( const List lst,
int  N 
)
inlinestatic

Definition at line 423 of file pg_list.h.

424{
425 ForEachState r = {lst, N};
426
427 Assert(N >= 0);
428 return r;
429}
#define Assert(condition)
Definition c.h:873

References Assert, and fb().

◆ lappend()

pg_nodiscard List * lappend ( List list,
void datum 
)
extern

Definition at line 339 of file list.c.

340{
341 Assert(IsPointerList(list));
342
343 if (list == NIL)
344 list = new_list(T_List, 1);
345 else
346 new_tail_cell(list);
347
348 llast(list) = datum;
350 return list;
351}
#define check_list_invariants(l)
Definition list.c:80
static void new_tail_cell(List *list)
Definition list.c:323
static List * new_list(NodeTag type, int min_size)
Definition list.c:91
#define IsPointerList(l)
Definition list.c:55
#define llast(l)
Definition pg_list.h:198

References Assert, check_list_invariants, fb(), IsPointerList, llast, new_list(), new_tail_cell(), and NIL.

Referenced by _SPI_make_plan_non_temp(), _SPI_prepare_oneshot_plan(), _SPI_prepare_plan(), _SPI_save_plan(), accumulate_append_subpath(), AcquireRewriteLocks(), add_base_clause_to_rel(), add_child_eq_member(), add_column_to_pathtarget(), add_dummy_return(), add_eq_member(), add_join_clause_to_rels(), add_join_rel(), add_local_reloption(), add_merged_range_bounds(), add_outer_joins_to_relids(), add_part_relids(), add_paths_to_append_rel(), add_placeholders_to_base_rels(), add_placeholders_to_joinrel(), add_row_identity_var(), add_rte_to_flat_rtable(), add_security_quals(), add_to_flat_tlist(), add_unique_group_var(), add_vars_to_targetlist(), add_with_check_options(), addArc(), AddEventToPendingNotifies(), addFamilyMember(), addFkRecurseReferencing(), addKey(), addKeyToQueue(), addNSItemToQuery(), addRangeTableEntry(), addRangeTableEntryForCTE(), addRangeTableEntryForENR(), addRangeTableEntryForFunction(), addRangeTableEntryForGroup(), addRangeTableEntryForJoin(), addRangeTableEntryForRelation(), addRangeTableEntryForSubquery(), addRangeTableEntryForTableFunc(), addRangeTableEntryForValues(), AddRelationNewConstraints(), AddRelationNotNullConstraints(), addRTEPermissionInfo(), addTargetToGroupList(), addTargetToSortList(), AlterPublicationTables(), AlterSubscription_refresh(), AlterTableMoveAll(), AlterTSDictionary(), analyzeCTE(), analyzeCTETargetList(), append_pathkeys(), apply_child_basequals(), apply_handle_truncate(), apply_scanjoin_target_to_paths(), applyLockingClause(), ApplyRetrieveRule(), array_subscript_transform(), assign_param_for_placeholdervar(), assign_param_for_var(), ATAddCheckNNConstraint(), ATExecAddColumn(), ATExecAlterConstrEnforceability(), ATExecSetExpression(), ATExecSplitPartition(), ATGetQueueEntry(), ATParseTransformCmd(), ATPostAlterTypeCleanup(), ATPostAlterTypeParse(), ATPrepAlterColumnType(), ATPrepCmd(), BaseBackupAddTarget(), btcostestimate(), build_aggregate_finalfn_expr(), build_aggregate_transfn_expr(), build_coercion_expression(), build_index_pathkeys(), build_index_paths(), build_index_tlist(), build_join_rel(), build_joinrel_tlist(), build_partition_pathkeys(), build_path_tlist(), build_physical_tlist(), build_remote_returning(), build_subplan(), BuildEventTriggerCache(), BuildOnConflictExcludedTargetlist(), buildRelationAliases(), cached_scansel(), calc_joinrel_size_estimate(), calculate_partition_bound_for_merge(), can_minmax_aggs(), check_index_predicates(), check_selective_binary_conversion(), check_sql_stmt_retval(), check_tuple_attribute(), CheckAndReportConflict(), CheckDuplicateColumnOrPathNames(), checkInsertTargets(), checkSharedDependencies(), checkWellFormedRecursionWalker(), choose_bitmap_and(), choose_plan_name(), ChooseIndexColumnNames(), classifyConditions(), clauselist_apply_dependencies(), CloneFkReferenced(), CloneFkReferencing(), CloneRowTriggersToPartition(), coerce_fn_result_column(), coerce_record_to_complex(), compute_common_attribute(), compute_semi_anti_join_factors(), compute_semijoin_info(), ComputeIndexAttrs(), ComputePartitionAttrs(), consider_groupingsets_paths(), consider_new_or_clause(), convert_ANY_sublink_to_join(), convert_EXISTS_to_ANY(), convert_subquery_pathkeys(), convert_VALUES_to_ANY(), CopyMultiInsertInfoFlush(), CopyMultiInsertInfoSetupBuffer(), cost_incremental_sort(), create_append_plan(), create_bitmap_scan_plan(), create_bitmap_subplan(), create_ctas_nodata(), create_customscan_plan(), create_degenerate_grouping_paths(), create_edata_for_relation(), create_grouping_expr_infos(), create_groupingsets_plan(), create_hashjoin_plan(), create_index_paths(), create_indexscan_plan(), create_merge_append_plan(), create_nestloop_path(), create_nestloop_plan(), create_one_window_path(), create_partitionwise_grouping_paths(), create_tidrangescan_plan(), create_tidscan_plan(), create_unique_paths(), CreateStatistics(), createTableConstraints(), database_to_xmlschema_internal(), deconstruct_distribute(), deconstruct_recurse(), DefineRelation(), DefineSequence(), DefineTSDictionary(), DefineView(), DefineVirtualRelation(), deparseFromExprForRel(), deparseParam(), deparseVar(), dependencies_object_end(), deserialize_deflist(), DetachPartitionFinalize(), determineRecursiveColTypes(), distribute_qual_to_rels(), distribute_row_identity_vars(), do_pg_backup_start(), DoCopy(), ec_add_derived_clause(), estimate_multivariate_bucketsize(), estimate_multivariate_ndistinct(), estimate_num_groups(), eval_const_expressions_mutator(), EvalPlanQualStart(), EventTriggerAlterTableEnd(), EventTriggerCollectAlterDefPrivs(), EventTriggerCollectAlterOpFam(), EventTriggerCollectAlterTableSubcmd(), EventTriggerCollectAlterTSConfig(), EventTriggerCollectCreateOpClass(), EventTriggerCollectGrant(), EventTriggerCollectSimpleCommand(), ExecAllocTableSlot(), ExecDoInitialPruning(), ExecEvalXmlExpr(), ExecGetAncestorResultRels(), ExecGetTriggerResultRel(), ExecInitExprList(), ExecInitExprRec(), ExecInitInsertProjection(), ExecInitJsonExpr(), ExecInitLockRows(), ExecInitMerge(), ExecInitModifyTable(), ExecInitNode(), ExecInitPartitionInfo(), ExecInitResultRelation(), ExecInitSubPlan(), ExecInitSubPlanExpr(), ExecInsert(), ExecPrepareExprList(), ExecSerializePlan(), ExecuteGrantStmt(), ExecuteTruncate(), ExecuteTruncateGuts(), expand_generated_columns_internal(), expand_grouping_sets(), expand_groupingset_node(), expand_inherited_rtentry(), expand_insert_targetlist(), expand_single_inheritance_child(), expand_vacuum_rel(), expand_virtual_generated_columns(), expandNSItemAttrs(), expandNSItemVars(), ExpandRowReference(), expandRTE(), expandTableLikeClause(), expandTupleDesc(), ExplainNode(), ExportSnapshot(), expr_setup_walker(), expression_tree_mutator_impl(), extract_actual_clauses(), extract_actual_join_clauses(), extract_jsp_path_expr_nodes(), extract_lateral_references(), extract_lateral_vars_from_PHVs(), extract_nonindex_conditions(), extract_or_clause(), extract_rollup_sets(), extract_slot_names(), extractRemainingColumns(), fetch_relation_list(), fetch_remote_slots(), fetch_remote_table_info(), fetch_statentries_for_relation(), fetch_upper_rel(), FetchRelationStates(), file_fdw_validator(), fill_hba_line(), FilterWalSummaries(), find_duplicate_ors(), find_hash_columns(), find_indexpath_quals(), find_list_position(), find_mergeclauses_for_outer_pathkeys(), find_partition_scheme(), find_placeholder_info(), find_window_functions_walker(), find_window_run_conditions(), findTargetlistEntrySQL99(), fireRIRrules(), fireRules(), fix_indexorderby_references(), fix_indexqual_references(), flatten_grouping_sets(), flatten_join_alias_vars_mutator(), flatten_simple_union_all(), fmgr_security_definer(), fmgr_sql_validator(), foreign_grouping_ok(), foreign_join_ok(), format_operator_parts(), format_procedure_parts(), func_get_detail(), gen_partprune_steps_internal(), gen_prune_step_combine(), gen_prune_step_op(), gen_prune_steps_from_opexps(), generate_append_tlist(), generate_bitmap_or_paths(), generate_implied_equalities_for_column(), generate_join_implied_equalities_broken(), generate_join_implied_equalities_normal(), generate_matching_part_pairs(), generate_orderedappend_paths(), generate_partitionwise_join_paths(), generate_setop_tlist(), generate_subquery_params(), generate_subquery_vars(), generate_union_paths(), generateClonedExtStatsStmt(), generateClonedIndexStmt(), generateJsonTablePathName(), generateSerialExtraStmts(), get_actual_clauses(), get_all_vacuum_rels(), get_appendrel_parampathinfo(), get_baserel_parampathinfo(), get_database_list(), get_eclass_for_sort_expr(), get_ext_ver_info(), get_ext_ver_list(), get_extension_control_directories(), get_file_fdw_attribute_options(), get_foreign_key_join_selectivity(), get_func_expr(), get_index_clause_from_support(), get_index_paths(), get_insert_query_def(), get_join_index_paths(), get_joinrel_parampathinfo(), get_local_synced_slots(), get_matching_part_pairs(), get_merge_query_def(), get_op_index_interpretation(), get_policies_for_relation(), get_qual_for_hash(), get_qual_for_list(), get_qual_for_range(), get_quals_from_indexclauses(), get_range_nulltest(), get_rel_sync_entry(), get_relation_constraints(), get_relation_foreign_keys(), get_relation_statistics_worker(), get_rels_with_domain(), get_required_extension(), get_sortgrouplist_exprs(), get_steps_using_prefix_recurse(), get_subscription_list(), get_switched_clauses(), get_tables_to_cluster(), get_tables_to_cluster_partitioned(), get_tlist_exprs(), get_update_query_targetlist_def(), get_useful_ecs_for_relation(), get_useful_group_keys_orderings(), get_useful_pathkeys_for_distinct(), get_useful_pathkeys_for_relation(), get_useful_pathkeys_for_relation(), get_windowfunc_expr_helper(), GetAfterTriggersTableData(), getAttributesList(), getObjectIdentityParts(), getState(), GetSubscriptionRelations(), getTokenTypes(), GetWalSummaries(), gistFindPath(), gistfixsplit(), gistplacetopage(), group_keys_reorder_by_pathkeys(), group_similar_or_args(), grouping_planner(), hash_inner_and_outer(), hashagg_spill_finish(), heap_truncate(), identify_current_nestloop_params(), identify_opfamily_groups(), index_concurrently_create_copy(), infer_arbiter_indexes(), init_grouping_targets(), initialize_target_list(), InitPlan(), injection_points_attach(), InjectionPointList(), innerrel_is_unique_ext(), interpret_AS_clause(), interpret_function_parameter_list(), intorel_startup(), is_innerrel_unique_for(), join_is_removable(), jsonb_ops__extract_nodes(), jsonb_path_ops__extract_nodes(), jsonb_subscript_transform(), JsonTableInitOpaque(), JsonValueListAppend(), list_append_unique(), list_append_unique_ptr(), list_concat_unique(), list_concat_unique_ptr(), list_difference(), list_difference_ptr(), list_intersection(), list_union(), list_union_ptr(), llvm_compile_module(), load_hba(), load_ident(), LoadPublications(), Lock_AF_UNIX(), logicalrep_workers_find(), LogicalRepSyncSequences(), make_bitmap_paths_for_or_group(), make_canonical_pathkey(), make_copy_attnamelist(), make_group_input_target(), make_inh_translation_list(), make_inner_pathkeys_for_merge(), make_modifytable(), make_partial_grouping_target(), make_partition_op_expr(), make_partition_pruneinfo(), make_partitionedrel_pruneinfo(), make_path_rowexpr(), make_pathkeys_for_sortclauses_extended(), make_pathtarget_from_tlist(), make_rel_from_joinlist(), make_row_comparison_op(), make_setop_translation_list(), make_sort_input_target(), make_sub_restrictinfos(), make_tlist_from_pathtarget(), make_window_input_target(), manifest_process_wal_range(), MarkGUCPrefixReserved(), markRelsAsNulledBy(), match_clause_to_index(), match_clause_to_partition_key(), match_foreign_keys_to_quals(), match_network_subset(), match_orclause_to_indexcol(), match_pathkeys_to_index(), match_pattern_prefix(), matchLocks(), mbms_add_member(), mbms_add_members(), merge_clump(), merge_list_bounds(), merge_publications(), MergeAttributes(), MergeCheckConstraint(), ndistinct_object_end(), negate_clause(), next_field_expand(), nodeRead(), ObjectsInPublicationToOids(), OpenTableList(), order_qual_clauses(), pa_launch_parallel_worker(), paraminfo_get_equal_hashops(), parse_hba_line(), parseCheckAggregates(), ParseFuncOrColumn(), PartConstraintImpliedByRelConstraint(), partitions_listdatum_intersection(), perform_base_backup(), pg_available_extension_versions(), pg_available_extensions(), pg_get_backend_memory_contexts(), pg_get_object_address(), pg_get_publication_tables(), pg_logical_slot_get_changes_guts(), pg_plan_queries(), pg_rewrite_query(), pgfdw_abort_cleanup_begin(), pgfdw_finish_abort_cleanup(), pgfdw_finish_pre_commit_cleanup(), pgfdw_subxact_callback(), pgfdw_xact_callback(), pgoutput_row_filter_init(), plan_union_children(), populate_typ_list(), postgresGetForeignPaths(), postgresGetForeignPlan(), postgresImportForeignSchema(), PreCommit_Notify(), prep_domain_constraints(), prepare_next_query(), prepare_sort_from_pathkeys(), preprocess_aggref(), preprocess_groupclause(), preprocess_grouping_sets(), preprocess_rowmarks(), preprocess_targetlist(), process_duplicate_ors(), process_equivalence(), process_pipe_input(), process_sublinks_mutator(), process_subquery_nestloop_params(), ProcessStartupPacket(), pull_ands(), pull_ors(), pull_up_simple_values(), pull_up_sublinks_jointree_recurse(), pull_up_sublinks_qual_recurse(), pull_up_union_leaf_queries(), pull_var_clause_walker(), pull_vars_walker(), query_tree_mutator_impl(), QueryRewrite(), queue_listen(), QueueCheckConstraintValidation(), QueueFKConstraintValidation(), range_table_mutator_impl(), read_tablespace_map(), rebuild_fdw_scan_tlist(), RebuildConstraintComment(), record_plan_function_dependency(), record_plan_type_dependency(), reduce_outer_joins_pass1(), register_ENR(), register_label_provider(), register_partpruneinfo(), register_reloptions_validator(), ReindexRelationConcurrently(), relation_excluded_by_constraints(), relation_has_unique_index_for(), RelationCacheInvalidate(), RelationGetDummyIndexExpressions(), RelationGetFKeyList(), RelationGetNotNullConstraints(), remap_to_groupclause_idx(), RememberConstraintForRebuilding(), RememberIndexForRebuilding(), RememberStatisticsForRebuilding(), RememberSyncRequest(), remove_rel_from_joinlist(), remove_self_join_rel(), remove_useless_groupby_columns(), RemoveInheritance(), reorder_function_arguments(), reparameterize_path(), reparameterize_path_by_child(), reparameterize_pathlist_by_child(), replace_empty_jointree(), replace_nestloop_param_placeholdervar(), replace_nestloop_param_var(), replace_outer_agg(), replace_outer_grouping(), replace_outer_merge_support(), replace_outer_returning(), ReplaceVarFromTargetList(), report_reduced_full_join(), resolve_unique_index_expr(), RewriteQuery(), rewriteSearchAndCycle(), rewriteTargetListIU(), rewriteTargetView(), rewriteValuesRTE(), rewriteValuesRTEToNulls(), RI_Initial_Check(), ScanSourceDatabasePgClassPage(), schema_to_xmlschema_internal(), SearchCatCacheList(), select_active_windows(), select_mergejoin_clauses(), select_outer_pathkeys_for_merge(), sepgsql_set_client_label(), sequence_options(), set_append_rel_pathlist(), set_append_rel_size(), set_cheapest(), set_deparse_for_query(), set_dummy_tlist_references(), set_indexonlyscan_references(), set_joinrel_partition_key_exprs(), set_plan_references(), set_plan_refs(), set_rtable_names(), set_simple_column_names(), set_subquery_pathlist(), set_upper_references(), set_using_names(), show_grouping_set_keys(), show_incremental_sort_group_info(), show_modifytable_info(), show_plan_tlist(), show_sort_group_keys(), show_tablesample(), simplify_and_arguments(), simplify_or_arguments(), split_pathtarget_at_srfs_extended(), split_pathtarget_walker(), split_selfjoin_quals(), SplitDirectoriesString(), SplitGUCList(), SplitIdentifierString(), SplitPartitionMoveRows(), SS_make_initplan_from_plan(), SS_process_ctes(), statext_is_compatible_clause_internal(), statext_mcv_clauselist_selectivity(), stringToQualifiedNameList(), subquery_planner(), table_slot_create(), textarray_to_stringlist(), textarray_to_strvaluelist(), textToQualifiedNameList(), TidExprListCreate(), TidExprListCreate(), TidRangeQualFromRestrictInfoList(), tokenize_auth_file(), tokenize_expand_file(), transform_MERGE_to_join(), transformAExprIn(), transformAggregateCall(), transformAlterTableStmt(), transformArrayExpr(), transformAssignmentIndirection(), transformBoolExpr(), transformCallStmt(), transformCaseExpr(), transformCoalesceExpr(), transformColumnDefinition(), transformCreateSchemaStmtElements(), transformCreateStmt(), transformDistinctClause(), transformDistinctOnClause(), transformExpressionList(), transformFKConstraints(), transformFkeyGetPrimaryKey(), transformFromClause(), transformFromClauseItem(), transformFuncCall(), transformGenericOptions(), transformGroupClause(), transformGroupClauseExpr(), transformGroupingFunc(), transformGroupingSet(), TransformGUCArray(), transformIndexConstraint(), transformIndexConstraints(), transformIndirection(), transformInsertRow(), transformInsertStmt(), transformJoinUsingClause(), transformJsonArrayConstructor(), transformJsonObjectConstructor(), transformJsonPassingArgs(), transformJsonTableColumns(), transformMergeStmt(), transformMinMaxExpr(), transformMultiAssignRef(), transformOfType(), transformPartitionBound(), transformPartitionRangeBounds(), transformPartitionSpec(), transformPLAssignStmt(), transformRangeFunction(), transformRangeTableFunc(), transformRangeTableSample(), transformRowExpr(), transformRuleStmt(), transformSetOperationStmt(), transformSetOperationTree(), transformSubLink(), transformTableConstraint(), transformTableLikeClause(), transformTargetList(), transformValuesClause(), transformWindowDefinitions(), transformWindowFuncCall(), transformWithClause(), transformXmlExpr(), trim_mergeclauses_for_inner_pathkeys(), TS_execute_locations_recurse(), untransformRelOptions(), update_eclasses(), UpdateLogicalMappings(), WaitForLockersMultiple(), WalkInnerWith(), and xmlelement().

◆ lappend_int()

pg_nodiscard List * lappend_int ( List list,
int  datum 
)
extern

Definition at line 357 of file list.c.

358{
359 Assert(IsIntegerList(list));
360
361 if (list == NIL)
362 list = new_list(T_IntList, 1);
363 else
364 new_tail_cell(list);
365
366 llast_int(list) = datum;
368 return list;
369}
#define IsIntegerList(l)
Definition list.c:56
#define llast_int(l)
Definition pg_list.h:199

References Assert, check_list_invariants, fb(), IsIntegerList, llast_int, new_list(), new_tail_cell(), and NIL.

Referenced by add_merged_range_bounds(), addRangeTableEntryForCTE(), addRangeTableEntryForENR(), addRangeTableEntryForFunction(), addRangeTableEntryForGroup(), addRangeTableEntryForSubquery(), AddRelationNotNullConstraints(), adjust_inherited_attnums(), adjust_partition_colnos_using_map(), analyzeCTETargetList(), ATRewriteTable(), build_merged_partition_bounds(), build_subplan(), checkInsertTargets(), convert_EXISTS_to_ANY(), copy_sequences(), CopyGetAttnums(), create_grouping_expr_infos(), deparseAnalyzeSql(), deparseExplicitTargetList(), deparseTargetList(), dependencies_scalar(), ExecBuildAggTrans(), ExecBuildGroupingEqual(), ExecBuildHash32Expr(), ExecBuildParamSetEqual(), ExecConstraints(), ExecInitExprRec(), ExecInitJsonExpr(), ExecInitModifyTable(), ExecInitPartitionInfo(), ExecInitQual(), ExecInitSubscriptingRef(), expand_indexqual_rowcompare(), extract_update_targetlist_colnos(), extractRemainingColumns(), fetch_statentries_for_relation(), finalize_grouping_exprs_walker(), find_all_inheritors(), find_compatible_agg(), fix_expr_common(), gen_partprune_steps_internal(), generate_subquery_params(), grouping_planner(), list_append_unique_int(), list_concat_unique_int(), list_difference_int(), list_intersection_int(), list_union_int(), match_pathkeys_to_index(), merge_list_bounds(), ndistinct_scalar(), nodeRead(), plan_union_children(), postgresBeginForeignInsert(), postgresPlanForeignModify(), rel_is_distinct_for(), remap_to_groupclause_idx(), RemoveInheritance(), reorder_grouping_sets(), rewriteSearchAndCycle(), set_plan_refs(), split_pathtarget_at_srfs_extended(), SS_process_ctes(), substitute_grouped_columns_mutator(), TerminateOtherDBBackends(), test_bms_overlap_list(), transformDistinctOnClause(), transformFromClauseItem(), transformGroupClauseList(), transformInsertStmt(), transformJsonTableColumns(), transformRangeTableFunc(), transformSetOperationTree(), and transformValuesClause().

◆ lappend_oid()

pg_nodiscard List * lappend_oid ( List list,
Oid  datum 
)
extern

Definition at line 375 of file list.c.

376{
377 Assert(IsOidList(list));
378
379 if (list == NIL)
380 list = new_list(T_OidList, 1);
381 else
382 new_tail_cell(list);
383
384 llast_oid(list) = datum;
386 return list;
387}
#define IsOidList(l)
Definition list.c:57
#define llast_oid(l)
Definition pg_list.h:200

References Assert, check_list_invariants, fb(), IsOidList, llast_oid, new_list(), new_tail_cell(), and NIL.

Referenced by add_rte_to_flat_rtable(), addRangeTableEntryForCTE(), addRangeTableEntryForENR(), addRangeTableEntryForFunction(), addRangeTableEntryForGroup(), addRangeTableEntryForSubquery(), AfterTriggerSetState(), AlterTableMoveAll(), analyzeCTETargetList(), apply_handle_truncate(), ApplyExtensionUpdates(), assign_collations_walker(), assign_param_for_placeholdervar(), assign_param_for_var(), assign_special_exec_param(), ATExecMergePartitions(), binary_upgrade_create_empty_extension(), check_functional_grouping(), CheckAttributeType(), CloneFkReferenced(), CloneFkReferencing(), compute_semijoin_info(), convert_EXISTS_to_ANY(), create_hashjoin_plan(), create_indexscan_plan(), CreateExtensionInternal(), CreateFunction(), DefineRelation(), DetachPartitionFinalize(), do_autovacuum(), EventTriggerCommonSetup(), ExecAlterDefaultPrivilegesStmt(), ExecInitPartitionInfo(), ExecInsertIndexTuples(), ExecuteGrantStmt(), ExecuteTruncate(), ExecuteTruncateGuts(), expand_indexqual_rowcompare(), extract_query_dependencies_walker(), ExtractExtensionList(), finalNamespacePath(), find_all_inheritors(), find_inheritance_children_extended(), find_typed_table_dependencies(), fireRIRrules(), fix_expr_common(), generate_new_exec_param(), get_index_ref_constraints(), get_mergejoin_opfamilies(), get_partition_ancestors_worker(), get_steps_using_prefix_recurse(), GetAllPublicationRelations(), GetAllTablesPublications(), getAutoExtensionsOfObject(), getOwnedSequences_internal(), GetParentedForeignKeyRefs(), GetPublicationSchemas(), GetPubPartitionOptionRelations(), GetRelationPublications(), getRelationsInNamespace(), GetSchemaPublicationRelations(), GetSchemaPublications(), heap_truncate_check_FKs(), heap_truncate_find_FKs(), index_concurrently_swap(), infer_arbiter_indexes(), InitConflictIndexes(), inline_function(), interpret_function_parameter_list(), list_append_unique_oid(), list_concat_unique_oid(), list_difference_oid(), list_union_oid(), LockViewRecurse(), logicalrep_read_truncate(), make_row_comparison_op(), nodeRead(), objectNamesToOids(), objectsInSchemaToOids(), oid_array_to_list(), OpenTableList(), paraminfo_get_equal_hashops(), PreCommit_on_commit_actions(), preprocessNamespacePath(), query_to_oid_list(), ReindexMultipleTables(), ReindexPartitions(), ReindexRelationConcurrently(), rel_is_distinct_for(), relation_is_updatable(), RelationGetIndexList(), RelationGetStatExtList(), RememberConstraintForRebuilding(), RememberIndexForRebuilding(), RememberStatisticsForRebuilding(), remove_dbtablespaces(), replace_outer_agg(), replace_outer_grouping(), replace_outer_merge_support(), replace_outer_returning(), RestoreReindexState(), rewriteSearchAndCycle(), roles_list_append(), roleSpecsToIds(), transformAggregateCall(), transformInsertStmt(), transformJsonTableColumns(), transformPartitionCmdForMerge(), transformRangeTableFunc(), transformSetOperationTree(), transformValuesClause(), TryReuseForeignKey(), and typeInheritsFrom().

◆ lappend_xid()

pg_nodiscard List * lappend_xid ( List list,
TransactionId  datum 
)
extern

Definition at line 393 of file list.c.

394{
395 Assert(IsXidList(list));
396
397 if (list == NIL)
398 list = new_list(T_XidList, 1);
399 else
400 new_tail_cell(list);
401
402 llast_xid(list) = datum;
404 return list;
405}
#define IsXidList(l)
Definition list.c:58
#define llast_xid(l)
Definition pg_list.h:201

References Assert, check_list_invariants, fb(), IsXidList, llast_xid, new_list(), new_tail_cell(), and NIL.

Referenced by nodeRead(), pa_start_subtrans(), and set_schema_sent_in_streamed_txn().

◆ lcons()

pg_nodiscard List * lcons ( void datum,
List list 
)
extern

Definition at line 495 of file list.c.

496{
497 Assert(IsPointerList(list));
498
499 if (list == NIL)
500 list = new_list(T_List, 1);
501 else
502 new_head_cell(list);
503
504 linitial(list) = datum;
506 return list;
507}
static void new_head_cell(List *list)
Definition list.c:305
#define linitial(l)
Definition pg_list.h:178

References Assert, check_list_invariants, fb(), IsPointerList, linitial, new_head_cell(), new_list(), and NIL.

Referenced by build_minmax_path(), checkWellFormedRecursionWalker(), consider_groupingsets_paths(), CreateExprContextInternal(), CreateLockFile(), ExecInitModifyTable(), expandTableLikeClause(), ExplainNode(), ExplainSubPlans(), extract_rollup_sets(), find_expr_references_walker(), find_update_path(), generateSerialExtraStmts(), get_name_for_var_field(), get_object_address_rv(), get_query_def(), get_relation_info(), get_rule_expr(), gistEmptyAllBuffers(), gistFindPath(), gistGetNodeBuffer(), gistPushItupToNodeBuffer(), load_domaintype_info(), pg_get_object_address(), plan_union_children(), PLy_subtransaction_enter(), PrepareClientEncoding(), push_child_plan(), pushOperator(), pushStop(), pushValue_internal(), readTimeLineHistory(), register_on_commit_action(), RelationBuildRowSecurity(), RelationCacheInvalidate(), RememberConstraintForRebuilding(), reorder_grouping_sets(), RewriteQuery(), rewriteSearchAndCycle(), rewriteTargetView(), sepgsql_avc_compute(), set_cheapest(), show_agg_keys(), show_group_keys(), show_window_def(), sort_inner_and_outer(), transformCaseExpr(), and WalkInnerWith().

◆ lcons_int()

pg_nodiscard List * lcons_int ( int  datum,
List list 
)
extern

Definition at line 513 of file list.c.

514{
515 Assert(IsIntegerList(list));
516
517 if (list == NIL)
518 list = new_list(T_IntList, 1);
519 else
520 new_head_cell(list);
521
522 linitial_int(list) = datum;
524 return list;
525}
#define linitial_int(l)
Definition pg_list.h:179

References Assert, check_list_invariants, fb(), IsIntegerList, linitial_int, new_head_cell(), new_list(), and NIL.

Referenced by ExecInitAgg(), ExplainBeginOutput(), ExplainOpenGroup(), ExplainOpenSetAsideGroup(), ExplainRestoreGroup(), and PutMemoryContextsStatsTupleStore().

◆ lcons_oid()

pg_nodiscard List * lcons_oid ( Oid  datum,
List list 
)
extern

Definition at line 531 of file list.c.

532{
533 Assert(IsOidList(list));
534
535 if (list == NIL)
536 list = new_list(T_OidList, 1);
537 else
538 new_head_cell(list);
539
540 linitial_oid(list) = datum;
542 return list;
543}
#define linitial_oid(l)
Definition pg_list.h:180

References Assert, check_list_invariants, fb(), IsOidList, linitial_oid, new_head_cell(), new_list(), and NIL.

Referenced by finalNamespacePath(), pg_partition_ancestors(), ReindexMultipleTables(), and RememberConstraintForRebuilding().

◆ list_append_unique()

pg_nodiscard List * list_append_unique ( List list,
void datum 
)
extern

Definition at line 1343 of file list.c.

1344{
1345 if (list_member(list, datum))
1346 return list;
1347 else
1348 return lappend(list, datum);
1349}
List * lappend(List *list, void *datum)
Definition list.c:339
bool list_member(const List *list, const void *datum)
Definition list.c:661

References lappend(), and list_member().

Referenced by add_security_quals(), add_with_check_options(), check_publications_origin_sequences(), check_publications_origin_tables(), create_agg_clause_infos(), and create_index_paths().

◆ list_append_unique_int()

pg_nodiscard List * list_append_unique_int ( List list,
int  datum 
)
extern

Definition at line 1368 of file list.c.

1369{
1370 if (list_member_int(list, datum))
1371 return list;
1372 else
1373 return lappend_int(list, datum);
1374}
List * lappend_int(List *list, int datum)
Definition list.c:357
bool list_member_int(const List *list, int datum)
Definition list.c:702

References lappend_int(), and list_member_int().

◆ list_append_unique_oid()

pg_nodiscard List * list_append_unique_oid ( List list,
Oid  datum 
)
extern

Definition at line 1380 of file list.c.

1381{
1382 if (list_member_oid(list, datum))
1383 return list;
1384 else
1385 return lappend_oid(list, datum);
1386}
List * lappend_oid(List *list, Oid datum)
Definition list.c:375
bool list_member_oid(const List *list, Oid datum)
Definition list.c:722

References lappend_oid(), and list_member_oid().

Referenced by AlterConstrTriggerDeferrability(), btvalidate(), DropRole(), hashvalidate(), heap_truncate_find_FKs(), LogicalRepWorkersWakeupAtCommit(), map_sql_typecoll_to_xmlschema_types(), and ObjectsInPublicationToOids().

◆ list_append_unique_ptr()

pg_nodiscard List * list_append_unique_ptr ( List list,
void datum 
)
extern

Definition at line 1356 of file list.c.

1357{
1358 if (list_member_ptr(list, datum))
1359 return list;
1360 else
1361 return lappend(list, datum);
1362}
bool list_member_ptr(const List *list, const void *datum)
Definition list.c:682

References lappend(), and list_member_ptr().

Referenced by get_useful_ecs_for_relation(), match_join_clauses_to_index(), postgresGetForeignPaths(), subbuild_joinrel_joinlist(), and subbuild_joinrel_restrictlist().

◆ list_cell_number()

static int list_cell_number ( const List l,
const ListCell c 
)
inlinestatic

Definition at line 333 of file pg_list.h.

334{
335 Assert(c >= &l->elements[0] && c < &l->elements[l->length]);
336 return c - l->elements;
337}
char * c
int length
Definition pg_list.h:56
ListCell * elements
Definition pg_list.h:58

References Assert, List::elements, fb(), and List::length.

Referenced by for_both_cell_setup(), for_each_cell_setup(), push_ancestor_plan(), subquery_planner(), and SyncPostCheckpoint().

◆ list_concat()

pg_nodiscard List * list_concat ( List list1,
const List list2 
)
extern

Definition at line 561 of file list.c.

562{
563 int new_len;
564
565 if (list1 == NIL)
566 return list_copy(list2);
567 if (list2 == NIL)
568 return list1;
569
570 Assert(list1->type == list2->type);
571
572 new_len = list1->length + list2->length;
573 /* Enlarge array if necessary */
574 if (new_len > list1->max_length)
576
577 /* Even if list1 == list2, using memcpy should be safe here */
578 memcpy(&list1->elements[list1->length], &list2->elements[0],
579 list2->length * sizeof(ListCell));
580 list1->length = new_len;
581
583 return list1;
584}
static void enlarge_list(List *list, int min_size)
Definition list.c:155
List * list_copy(const List *oldlist)
Definition list.c:1573

References Assert, check_list_invariants, enlarge_list(), fb(), list_copy(), and NIL.

Referenced by accumulate_append_subpath(), add_predicate_to_index_quals(), addRangeTableEntryForJoin(), addRangeTableEntryForTableFunc(), ATParseTransformCmd(), ATPostAlterTypeParse(), AtSubCommit_Notify(), build_joinrel_restrictlist(), build_paths_for_OR(), calculate_partition_bound_for_merge(), check_index_predicates(), choose_bitmap_and(), clean_up_removed_plan_level(), CombineRangeTables(), consider_groupingsets_paths(), ConstraintImpliedByRelConstraint(), cost_index(), create_agg_clause_infos(), create_append_path(), create_append_plan(), create_bitmap_subplan(), create_index_paths(), create_join_plan(), deconstruct_distribute(), deconstruct_recurse(), DefineRelation(), deparseDirectDeleteSql(), deparseDirectUpdateSql(), deparseFromExprForRel(), ec_add_derived_clauses(), estimate_multivariate_bucketsize(), estimate_path_cost_size(), expand_groupingset_node(), ExpandAllTables(), expandRTE(), extract_or_clause(), extract_rollup_sets(), fileBeginForeignScan(), fileGetOptions(), find_indexpath_quals(), find_mergeclauses_for_outer_pathkeys(), fireRIRrules(), flatten_grouping_sets(), foreign_grouping_ok(), foreign_join_ok(), gen_partprune_steps_internal(), gen_prune_steps_from_opexps(), generate_bitmap_or_paths(), generate_join_implied_equalities(), generate_join_implied_equalities_for_ecs(), generate_join_implied_equalities_normal(), generate_partition_qual(), get_baserel_parampathinfo(), get_batch_size_option(), get_foreign_key_join_selectivity(), get_from_clause_item(), get_index_paths(), get_join_index_paths(), get_joinrel_parampathinfo(), get_relation_constraints(), get_rels_with_domain(), get_steps_using_prefix_recurse(), GetAllSchemaPublicationRelations(), GetPubPartitionOptionRelations(), is_parallel_safe(), objectsInSchemaToOids(), optimize_window_clauses(), paraminfo_get_equal_hashops(), PrepareForIncrementalBackup(), process_equivalence(), process_sublinks_mutator(), ProcessUtilitySlow(), pull_ands(), pull_ors(), pull_up_simple_subquery(), reduce_unique_semijoins(), remove_self_join_rel(), remove_self_joins_one_group(), remove_useless_results_recurse(), reorder_grouping_sets(), RewriteQuery(), rewriteRuleAction(), rewriteTargetListIU(), selectColorTrigrams(), set_joinrel_partition_key_exprs(), set_plan_refs(), split_pathtarget_at_srfs_extended(), split_pathtarget_walker(), subquery_planner(), TidQualFromRestrictInfoList(), transformAExprIn(), transformAlterTableStmt(), transformCreateSchemaStmtElements(), transformCreateStmt(), transformExpressionList(), transformFromClause(), transformFromClauseItem(), transformIndexConstraints(), transformTableLikeClause(), transformTargetList(), TS_execute_locations_recurse(), and vacuum().

◆ list_concat_copy()

pg_nodiscard List * list_concat_copy ( const List list1,
const List list2 
)
extern

◆ list_concat_unique()

pg_nodiscard List * list_concat_unique ( List list1,
const List list2 
)
extern

Definition at line 1405 of file list.c.

1406{
1407 ListCell *cell;
1408
1411
1412 foreach(cell, list2)
1413 {
1414 if (!list_member(list1, lfirst(cell)))
1415 list1 = lappend(list1, lfirst(cell));
1416 }
1417
1419 return list1;
1420}
#define lfirst(lc)
Definition pg_list.h:172

References Assert, check_list_invariants, fb(), IsPointerList, lappend(), lfirst, and list_member().

Referenced by create_bitmap_subplan(), and select_active_windows().

◆ list_concat_unique_int()

pg_nodiscard List * list_concat_unique_int ( List list1,
const List list2 
)
extern

Definition at line 1448 of file list.c.

1449{
1450 ListCell *cell;
1451
1454
1455 foreach(cell, list2)
1456 {
1457 if (!list_member_int(list1, lfirst_int(cell)))
1459 }
1460
1462 return list1;
1463}
#define lfirst_int(lc)
Definition pg_list.h:173

References Assert, check_list_invariants, fb(), IsIntegerList, lappend_int(), lfirst_int, and list_member_int().

◆ list_concat_unique_oid()

pg_nodiscard List * list_concat_unique_oid ( List list1,
const List list2 
)
extern

Definition at line 1469 of file list.c.

1470{
1471 ListCell *cell;
1472
1475
1476 foreach(cell, list2)
1477 {
1478 if (!list_member_oid(list1, lfirst_oid(cell)))
1480 }
1481
1483 return list1;
1484}
#define lfirst_oid(lc)
Definition pg_list.h:174

References Assert, check_list_invariants, fb(), IsOidList, lappend_oid(), lfirst_oid, and list_member_oid().

Referenced by AlterPublicationOptions(), GetSchemaPublicationRelations(), InvalidatePubRelSyncCache(), pg_get_publication_tables(), and RelationBuildPublicationDesc().

◆ list_concat_unique_ptr()

pg_nodiscard List * list_concat_unique_ptr ( List list1,
const List list2 
)
extern

Definition at line 1427 of file list.c.

1428{
1429 ListCell *cell;
1430
1433
1434 foreach(cell, list2)
1435 {
1436 if (!list_member_ptr(list1, lfirst(cell)))
1437 list1 = lappend(list1, lfirst(cell));
1438 }
1439
1441 return list1;
1442}

References Assert, check_list_invariants, fb(), IsPointerList, lappend(), lfirst, and list_member_ptr().

Referenced by get_useful_pathkeys_for_distinct(), and group_keys_reorder_by_pathkeys().

◆ list_copy()

pg_nodiscard List * list_copy ( const List oldlist)
extern

Definition at line 1573 of file list.c.

1574{
1575 List *newlist;
1576
1577 if (oldlist == NIL)
1578 return NIL;
1579
1580 newlist = new_list(oldlist->type, oldlist->length);
1581 memcpy(newlist->elements, oldlist->elements,
1582 newlist->length * sizeof(ListCell));
1583
1585 return newlist;
1586}

References check_list_invariants, fb(), new_list(), and NIL.

Referenced by addRangeTableEntryForCTE(), adjust_group_pathkeys_for_groupagg(), arrayconst_startup_fn(), arrayexpr_startup_fn(), build_subplan(), check_index_predicates(), check_publications(), consider_groupingsets_paths(), ConstraintImpliedByRelConstraint(), copy_pathtarget(), copyObjectImpl(), CopySearchPathMatcher(), create_nestloop_plan(), estimate_multivariate_bucketsize(), EventTriggerCollectGrant(), ExecuteTruncateGuts(), expression_tree_mutator_impl(), fetch_search_path(), foreign_join_ok(), generate_bitmap_or_paths(), generate_mergejoin_paths(), generateSerialExtraStmts(), get_eclass_for_sort_expr(), get_foreign_key_join_selectivity(), get_query_def(), get_required_extension(), get_steps_using_prefix_recurse(), get_switched_clauses(), get_useful_pathkeys_for_relation(), GetSearchPathMatcher(), heap_truncate_find_FKs(), list_concat(), list_concat_copy(), list_difference(), list_difference_int(), list_difference_oid(), list_difference_ptr(), list_union(), list_union_int(), list_union_oid(), list_union_ptr(), merge_publications(), plpgsql_parse_cwordtype(), preprocess_groupclause(), recomputeNamespacePath(), RelationGetIndexList(), RelationGetStatExtList(), remove_leftjoinrel_from_query(), remove_self_join_rel(), reorder_grouping_sets(), roles_is_member_of(), select_active_windows(), select_outer_pathkeys_for_merge(), set_joinrel_partition_key_exprs(), set_using_names(), SetReindexPending(), simplify_and_arguments(), simplify_or_arguments(), sort_inner_and_outer(), standard_qp_callback(), transformPLAssignStmt(), transformWithClause(), and WalSummariesAreComplete().

◆ list_copy_deep()

pg_nodiscard List * list_copy_deep ( const List oldlist)
extern

Definition at line 1639 of file list.c.

1640{
1641 List *newlist;
1642
1643 if (oldlist == NIL)
1644 return NIL;
1645
1646 /* This is only sensible for pointer Lists */
1648
1649 newlist = new_list(oldlist->type, oldlist->length);
1650 for (int i = 0; i < newlist->length; i++)
1651 lfirst(&newlist->elements[i]) =
1652 copyObjectImpl(lfirst(&oldlist->elements[i]));
1653
1655 return newlist;
1656}
void * copyObjectImpl(const void *from)
Definition copyfuncs.c:177
#define IsA(nodeptr, _type_)
Definition nodes.h:164

References Assert, check_list_invariants, copyObjectImpl(), fb(), i, IsA, lfirst, new_list(), and NIL.

Referenced by copyObjectImpl().

◆ list_copy_head()

◆ list_copy_tail()

pg_nodiscard List * list_copy_tail ( const List oldlist,
int  nskip 
)
extern

Definition at line 1613 of file list.c.

1614{
1615 List *newlist;
1616
1617 if (nskip < 0)
1618 nskip = 0; /* would it be better to elog? */
1619
1620 if (oldlist == NIL || nskip >= oldlist->length)
1621 return NIL;
1622
1623 newlist = new_list(oldlist->type, oldlist->length - nskip);
1624 memcpy(newlist->elements, &oldlist->elements[nskip],
1625 newlist->length * sizeof(ListCell));
1626
1628 return newlist;
1629}

References check_list_invariants, fb(), new_list(), and NIL.

Referenced by accumulate_append_subpath(), addRangeTableEntryForJoin(), addRangeTableEntryForTableFunc(), does_not_exist_skipping(), expandRTE(), get_name_for_var_field(), get_object_address_opcf(), ParseFuncOrColumn(), push_ancestor_plan(), and transformAggregateCall().

◆ list_deduplicate_oid()

void list_deduplicate_oid ( List list)
extern

Definition at line 1495 of file list.c.

1496{
1497 int len;
1498
1499 Assert(IsOidList(list));
1500 len = list_length(list);
1501 if (len > 1)
1502 {
1503 ListCell *elements = list->elements;
1504 int i = 0;
1505
1506 for (int j = 1; j < len; j++)
1507 {
1508 if (elements[i].oid_value != elements[j].oid_value)
1509 elements[++i].oid_value = elements[j].oid_value;
1510 }
1511 list->length = i + 1;
1512 }
1514}
int j
Definition isn.c:78
Oid oid_value
Definition pg_list.h:49

References Assert, check_list_invariants, i, IsOidList, j, len, list_length(), and ListCell::oid_value.

Referenced by GetPublicationRelations(), and heap_truncate_find_FKs().

◆ list_delete()

pg_nodiscard List * list_delete ( List list,
void datum 
)
extern

Definition at line 853 of file list.c.

854{
855 ListCell *cell;
856
857 Assert(IsPointerList(list));
859
860 foreach(cell, list)
861 {
862 if (equal(lfirst(cell), datum))
863 return list_delete_cell(list, cell);
864 }
865
866 /* Didn't find a match: return the list unmodified */
867 return list;
868}
bool equal(const void *a, const void *b)
Definition equalfuncs.c:223
List * list_delete_cell(List *list, ListCell *cell)
Definition list.c:841

References Assert, check_list_invariants, equal(), IsPointerList, lfirst, and list_delete_cell().

Referenced by check_publications(), generate_bitmap_or_paths(), injection_points_detach(), postgresGetForeignPlan(), and unregister_ENR().

◆ list_delete_cell()

pg_nodiscard List * list_delete_cell ( List list,
ListCell cell 
)
extern

Definition at line 841 of file list.c.

842{
843 return list_delete_nth_cell(list, cell - list->elements);
844}
List * list_delete_nth_cell(List *list, int n)
Definition list.c:767

References list_delete_nth_cell().

Referenced by deleteSplitPartitionContext(), list_delete(), list_delete_int(), list_delete_oid(), list_delete_ptr(), MergePartitionsMoveRows(), remove_useless_joins(), simplify_EXISTS_query(), and transformGenericOptions().

◆ list_delete_first()

◆ list_delete_first_n()

pg_nodiscard List * list_delete_first_n ( List list,
int  n 
)
extern

Definition at line 983 of file list.c.

984{
986
987 /* No-op request? */
988 if (n <= 0)
989 return list;
990
991 /* Delete whole list? */
992 if (n >= list_length(list))
993 {
994 list_free(list);
995 return NIL;
996 }
997
998 /*
999 * Otherwise, we normally just collapse out the removed elements. But for
1000 * debugging purposes, move the whole list contents someplace else.
1001 *
1002 * (Note that we *must* keep the contents in the same memory context.)
1003 */
1004#ifndef DEBUG_LIST_MEMORY_USAGE
1005 memmove(&list->elements[0], &list->elements[n],
1006 (list->length - n) * sizeof(ListCell));
1007 list->length -= n;
1008#else
1009 {
1011 int newmaxlen = list->length - n;
1012
1013 newelems = (ListCell *)
1015 newmaxlen * sizeof(ListCell));
1016 memcpy(newelems, &list->elements[n], newmaxlen * sizeof(ListCell));
1017 if (list->elements != list->initial_elements)
1018 pfree(list->elements);
1019 else
1020 {
1021 /*
1022 * As in enlarge_list(), clear the initial_elements[] space and/or
1023 * mark it inaccessible.
1024 */
1025#ifdef CLOBBER_FREED_MEMORY
1026 wipe_mem(list->initial_elements,
1027 list->max_length * sizeof(ListCell));
1028#else
1029 VALGRIND_MAKE_MEM_NOACCESS(list->initial_elements,
1030 list->max_length * sizeof(ListCell));
1031#endif
1032 }
1033 list->elements = newelems;
1034 list->max_length = newmaxlen;
1035 list->length = newmaxlen;
1037 }
1038#endif
1039
1040 return list;
1041}
void list_free(List *list)
Definition list.c:1546
void * MemoryContextAlloc(MemoryContext context, Size size)
Definition mcxt.c:1232
void pfree(void *pointer)
Definition mcxt.c:1616
MemoryContext GetMemoryChunkContext(void *pointer)
Definition mcxt.c:756
#define VALGRIND_MAKE_MEM_NOACCESS(addr, size)
Definition memdebug.h:27

References check_list_invariants, fb(), GetMemoryChunkContext(), list_free(), list_length(), MemoryContextAlloc(), NIL, pfree(), and VALGRIND_MAKE_MEM_NOACCESS.

Referenced by add_function_defaults(), func_get_detail(), and SyncPostCheckpoint().

◆ list_delete_int()

pg_nodiscard List * list_delete_int ( List list,
int  datum 
)
extern

Definition at line 891 of file list.c.

892{
893 ListCell *cell;
894
895 Assert(IsIntegerList(list));
897
898 foreach(cell, list)
899 {
900 if (lfirst_int(cell) == datum)
901 return list_delete_cell(list, cell);
902 }
903
904 /* Didn't find a match: return the list unmodified */
905 return list;
906}

References Assert, check_list_invariants, IsIntegerList, lfirst_int, and list_delete_cell().

Referenced by reorder_grouping_sets().

◆ list_delete_last()

pg_nodiscard List * list_delete_last ( List list)
extern

Definition at line 957 of file list.c.

958{
960
961 if (list == NIL)
962 return NIL; /* would an error be better? */
963
964 /* list_truncate won't free list if it goes to empty, but this should */
965 if (list_length(list) <= 1)
966 {
967 list_free(list);
968 return NIL;
969 }
970
971 return list_truncate(list, list_length(list) - 1);
972}
List * list_truncate(List *list, int new_size)
Definition list.c:631

References check_list_invariants, list_free(), list_length(), list_truncate(), and NIL.

Referenced by agg_refill_hash_table(), CheckAttributeType(), create_unique_paths(), fireRIRrules(), inline_function(), LockViewRecurse(), plpgsql_parse_cwordtype(), relation_is_updatable(), RewriteQuery(), transformMultiAssignRef(), and transformOnConflictClause().

◆ list_delete_nth_cell()

pg_nodiscard List * list_delete_nth_cell ( List list,
int  n 
)
extern

Definition at line 767 of file list.c.

768{
770
771 Assert(n >= 0 && n < list->length);
772
773 /*
774 * If we're about to delete the last node from the list, free the whole
775 * list instead and return NIL, which is the only valid representation of
776 * a zero-length list.
777 */
778 if (list->length == 1)
779 {
780 list_free(list);
781 return NIL;
782 }
783
784 /*
785 * Otherwise, we normally just collapse out the removed element. But for
786 * debugging purposes, move the whole list contents someplace else.
787 *
788 * (Note that we *must* keep the contents in the same memory context.)
789 */
790#ifndef DEBUG_LIST_MEMORY_USAGE
791 memmove(&list->elements[n], &list->elements[n + 1],
792 (list->length - 1 - n) * sizeof(ListCell));
793 list->length--;
794#else
795 {
797 int newmaxlen = list->length - 1;
798
799 newelems = (ListCell *)
801 newmaxlen * sizeof(ListCell));
802 memcpy(newelems, list->elements, n * sizeof(ListCell));
803 memcpy(&newelems[n], &list->elements[n + 1],
804 (list->length - 1 - n) * sizeof(ListCell));
805 if (list->elements != list->initial_elements)
806 pfree(list->elements);
807 else
808 {
809 /*
810 * As in enlarge_list(), clear the initial_elements[] space and/or
811 * mark it inaccessible.
812 */
813#ifdef CLOBBER_FREED_MEMORY
814 wipe_mem(list->initial_elements,
815 list->max_length * sizeof(ListCell));
816#else
817 VALGRIND_MAKE_MEM_NOACCESS(list->initial_elements,
818 list->max_length * sizeof(ListCell));
819#endif
820 }
821 list->elements = newelems;
822 list->max_length = newmaxlen;
823 list->length--;
825 }
826#endif
827
828 return list;
829}

References Assert, check_list_invariants, fb(), GetMemoryChunkContext(), list_free(), MemoryContextAlloc(), NIL, pfree(), and VALGRIND_MAKE_MEM_NOACCESS.

Referenced by AddRelationNotNullConstraints(), list_delete_cell(), list_delete_first(), MergeAttributes(), process_equivalence(), reconsider_full_join_clause(), and sort_inner_and_outer().

◆ list_delete_oid()

pg_nodiscard List * list_delete_oid ( List list,
Oid  datum 
)
extern

Definition at line 910 of file list.c.

911{
912 ListCell *cell;
913
914 Assert(IsOidList(list));
916
917 foreach(cell, list)
918 {
919 if (lfirst_oid(cell) == datum)
920 return list_delete_cell(list, cell);
921 }
922
923 /* Didn't find a match: return the list unmodified */
924 return list;
925}

References Assert, check_list_invariants, IsOidList, lfirst_oid, and list_delete_cell().

Referenced by RemoveReindexPending().

◆ list_delete_ptr()

pg_nodiscard List * list_delete_ptr ( List list,
void datum 
)
extern

Definition at line 872 of file list.c.

873{
874 ListCell *cell;
875
876 Assert(IsPointerList(list));
878
879 foreach(cell, list)
880 {
881 if (lfirst(cell) == datum)
882 return list_delete_cell(list, cell);
883 }
884
885 /* Didn't find a match: return the list unmodified */
886 return list;
887}

References Assert, check_list_invariants, IsPointerList, lfirst, and list_delete_cell().

Referenced by FreeExprContext(), pa_free_worker_info(), remove_join_clause_from_rels(), and remove_self_join_rel().

◆ list_difference()

List * list_difference ( const List list1,
const List list2 
)
extern

Definition at line 1237 of file list.c.

1238{
1239 const ListCell *cell;
1240 List *result = NIL;
1241
1244
1245 if (list2 == NIL)
1246 return list_copy(list1);
1247
1248 foreach(cell, list1)
1249 {
1250 if (!list_member(list2, lfirst(cell)))
1251 result = lappend(result, lfirst(cell));
1252 }
1253
1254 check_list_invariants(result);
1255 return result;
1256}

References Assert, check_list_invariants, fb(), IsPointerList, lappend(), lfirst, list_copy(), list_member(), and NIL.

Referenced by create_hashjoin_plan(), create_mergejoin_plan(), create_tidscan_plan(), get_useful_group_keys_orderings(), infer_arbiter_indexes(), IsIndexCompatibleAsArbiter(), and process_duplicate_ors().

◆ list_difference_int()

List * list_difference_int ( const List list1,
const List list2 
)
extern

Definition at line 1288 of file list.c.

1289{
1290 const ListCell *cell;
1291 List *result = NIL;
1292
1295
1296 if (list2 == NIL)
1297 return list_copy(list1);
1298
1299 foreach(cell, list1)
1300 {
1301 if (!list_member_int(list2, lfirst_int(cell)))
1302 result = lappend_int(result, lfirst_int(cell));
1303 }
1304
1305 check_list_invariants(result);
1306 return result;
1307}

References Assert, check_list_invariants, fb(), IsIntegerList, lappend_int(), lfirst_int, list_copy(), list_member_int(), and NIL.

Referenced by reorder_grouping_sets().

◆ list_difference_oid()

List * list_difference_oid ( const List list1,
const List list2 
)
extern

Definition at line 1313 of file list.c.

1314{
1315 const ListCell *cell;
1316 List *result = NIL;
1317
1320
1321 if (list2 == NIL)
1322 return list_copy(list1);
1323
1324 foreach(cell, list1)
1325 {
1326 if (!list_member_oid(list2, lfirst_oid(cell)))
1327 result = lappend_oid(result, lfirst_oid(cell));
1328 }
1329
1330 check_list_invariants(result);
1331 return result;
1332}

References Assert, check_list_invariants, fb(), IsOidList, lappend_oid(), lfirst_oid, list_copy(), list_member_oid(), and NIL.

Referenced by AlterPublicationSchemas().

◆ list_difference_ptr()

List * list_difference_ptr ( const List list1,
const List list2 
)
extern

Definition at line 1263 of file list.c.

1264{
1265 const ListCell *cell;
1266 List *result = NIL;
1267
1270
1271 if (list2 == NIL)
1272 return list_copy(list1);
1273
1274 foreach(cell, list1)
1275 {
1276 if (!list_member_ptr(list2, lfirst(cell)))
1277 result = lappend(result, lfirst(cell));
1278 }
1279
1280 check_list_invariants(result);
1281 return result;
1282}

References Assert, check_list_invariants, fb(), IsPointerList, lappend(), lfirst, list_copy(), list_member_ptr(), and NIL.

Referenced by create_bitmap_scan_plan(), ExecuteTruncateGuts(), and get_useful_group_keys_orderings().

◆ list_free()

void list_free ( List list)
extern

Definition at line 1546 of file list.c.

1547{
1548 list_free_private(list, false);
1549}
static void list_free_private(List *list, bool deep)
Definition list.c:1520

References list_free_private().

Referenced by AfterTriggerSetState(), AlterIndexNamespaces(), arrayconst_cleanup_fn(), arrayexpr_cleanup_fn(), ATCheckPartitionsNotInUse(), ATExecChangeOwner(), ATExecMergePartitions(), ATExecSetTableSpace(), build_base_rel_tlists(), build_remote_returning(), BuildRelationExtStatistics(), cachedNamespacePath(), calc_joinrel_size_estimate(), calculate_indexes_size(), calculate_partition_bound_for_merge(), calculate_toast_table_size(), check_createrole_self_grant(), check_datestyle(), check_debug_io_direct(), check_log_connections(), check_log_destination(), check_restrict_nonsystem_relation_kind(), check_search_path(), check_synchronized_standby_slots(), check_temp_tablespaces(), check_wal_consistency_checking(), choose_bitmap_and(), compute_semi_anti_join_factors(), CopyFrom(), CopyMultiInsertBufferFlush(), CopyMultiInsertInfoCleanup(), create_agg_clause_infos(), CreateExtensionInternal(), CreateTriggerFiringOn(), current_schema(), current_schemas(), DefineIndex(), DefineRelation(), deparseFromExprForRel(), dependencies_object_end(), distribute_qual_to_rels(), do_analyze_rel(), do_autovacuum(), DropSubscription(), ec_clear_derived_clauses(), EndCopy(), estimate_multivariate_bucketsize(), EventTriggerDDLCommandEnd(), EventTriggerDDLCommandStart(), EventTriggerOnLogin(), EventTriggerSQLDrop(), EventTriggerTableRewrite(), ExecInitPartitionInfo(), ExecInsert(), ExecOpenIndices(), ExecPendingInserts(), ExecResetTupleTable(), ExecSimpleRelationInsert(), ExecSimpleRelationUpdate(), ExecUpdateEpilogue(), expandTableLikeClause(), extract_lateral_references(), extract_lateral_vars_from_PHVs(), ExtractExtensionList(), find_all_inheritors(), find_compatible_agg(), find_computable_ec_member(), find_hash_columns(), find_placeholders_in_expr(), fix_placeholder_input_needed_levels(), generate_base_implied_equalities_no_const(), generate_bitmap_or_paths(), generate_partitionwise_join_paths(), get_rel_sync_entry(), get_relation_info(), get_relation_statistics(), get_steps_using_prefix_recurse(), get_windowclause_startup_tuples(), getIdentitySequence(), GetTopMostAncestorInPublication(), group_keys_reorder_by_pathkeys(), heap_truncate_find_FKs(), index_concurrently_swap(), index_get_partition(), index_unchanged_by_update(), infer_arbiter_indexes(), is_var_in_aggref_only(), list_delete_first_n(), list_delete_last(), list_delete_nth_cell(), llvm_release_context(), logicalrep_worker_detach(), make_group_input_target(), make_partial_grouping_target(), make_SAOP_expr(), make_sort_input_target(), make_window_input_target(), match_orclause_to_indexcol(), max_parallel_hazard_walker(), merge_list_bounds(), merge_range_bounds(), ndistinct_object_end(), ObjectsInPublicationToOids(), OpenTableList(), paraminfo_get_equal_hashops(), parse_hba_auth_opt(), pg_dependencies_in(), pg_ndistinct_in(), pg_partition_root(), plpgsql_extra_checks_check_hook(), pop_ancestor_plan(), PostmasterMain(), PrepareTempTablespaces(), preprocess_targetlist(), preprocessNamespacePath(), process_implied_equality(), ProcessGUCArray(), processState(), ProcessUtilitySlow(), PutMemoryContextsStatsTupleStore(), qual_is_pushdown_safe(), rebuild_eclass_attr_needed(), rebuild_joinclause_attr_needed(), rebuild_placeholder_attr_needed(), recomputeNamespacePath(), refresh_by_match_merge(), RefreshMatViewByOid(), RelationCacheInvalidate(), RelationDestroyRelation(), RelationGetIndexAttrBitmap(), RelationGetIndexList(), RelationGetPrimaryKeyIndex(), RelationGetReplicaIndex(), RelationGetStatExtList(), relationHasPrimaryKey(), remove_dbtablespaces(), remove_self_join_rel(), reorder_grouping_sets(), reparameterize_pathlist_by_child(), roles_is_member_of(), sepgsql_dml_privileges(), simplify_and_arguments(), simplify_or_arguments(), statext_mcv_clauselist_selectivity(), stringToQualifiedNameList(), test_bms_overlap_list(), textToQualifiedNameList(), toast_open_indexes(), transformFkeyCheckAttrs(), transformFkeyGetPrimaryKey(), transformValuesClause(), triggered_change_notification(), typeInheritsFrom(), update_eclasses(), vac_open_indexes(), and WaitForLockers().

◆ list_free_deep()

◆ list_head()

static ListCell * list_head ( const List l)
inlinestatic

Definition at line 128 of file pg_list.h.

129{
130 return l ? &l->elements[0] : NULL;
131}

References List::elements, and fb().

Referenced by add_setop_child_rel_equivalences(), analyzeCTE(), appendTypeNameToBuffer(), arrayexpr_startup_fn(), assign_hypothetical_collations(), ATAddForeignKeyConstraint(), boolexpr_startup_fn(), build_index_tlist(), buildRelationAliases(), CheckRADIUSAuth(), checkWellFormedRecursionWalker(), coerce_record_to_complex(), compare_tlist_datatypes(), ComputeIndexAttrs(), consider_groupingsets_paths(), ConstructTupleDescriptor(), cost_bitmap_and_node(), cost_bitmap_or_node(), create_ctas_nodata(), create_mergejoin_plan(), DefineView(), deparseSubscriptingRef(), deparseTruncateSql(), do_analyze_rel(), dump_getdiag(), eclass_member_iterator_next(), examine_variable(), exec_stmt_raise(), ExecInitJunkFilterConversion(), expand_insert_targetlist(), expandRTE(), extract_rollup_sets(), fix_indexqual_operand(), flatten_set_variable_args(), FormIndexDatum(), FormPartitionKeyDatum(), funcname_signature_string(), gen_prune_steps_from_opexps(), generate_append_tlist(), generate_setop_child_grouplist(), generate_setop_grouplist(), generateClonedIndexStmt(), get_param_path_clause_serials(), get_qual_for_hash(), get_qual_for_range(), get_range_nulltest(), get_steps_using_prefix(), get_update_query_targetlist_def(), GetIndexInputType(), has_partition_attrs(), InitPartitionPruneContext(), intorel_startup(), jsonb_path_query_internal(), list_startup_fn(), make_inner_pathkeys_for_merge(), match_index_to_operand(), NameListToQuotedString(), NameListToString(), parse_hba_line(), parse_ident_line(), perform_pruning_base_step(), pg_get_indexdef_worker(), pg_get_partkeydef_worker(), postprocess_setop_tlist(), PreCommit_Notify(), print_function_arguments(), printSubscripts(), process_startup_options(), query_is_distinct_for(), RelationBuildPartitionKey(), SearchPathMatchesCurrentEnvironment(), SendRowDescriptionMessage(), set_baserel_partition_key_exprs(), setup_eclass_member_iterator(), sort_inner_and_outer(), SplitPartitionMoveRows(), statatt_get_index_expr(), tfuncLoadRows(), tlist_matches_tupdesc(), tlist_same_collations(), tlist_same_datatypes(), transformAssignedExpr(), transformPLAssignStmtTarget(), transformUpdateTargetList(), trim_mergeclauses_for_inner_pathkeys(), try_partitionwise_join(), TypeNameListToString(), and WalkInnerWith().

◆ list_insert_nth()

pg_nodiscard List * list_insert_nth ( List list,
int  pos,
void datum 
)
extern

Definition at line 439 of file list.c.

440{
441 if (list == NIL)
442 {
443 Assert(pos == 0);
444 return list_make1(datum);
445 }
446 Assert(IsPointerList(list));
447 lfirst(insert_new_cell(list, pos)) = datum;
449 return list;
450}
static ListCell * insert_new_cell(List *list, int pos)
Definition list.c:415
#define list_make1(x1)
Definition pg_list.h:212

References Assert, check_list_invariants, insert_new_cell(), IsPointerList, lfirst, list_make1, and NIL.

Referenced by add_partial_path(), add_path(), and merge_clump().

◆ list_insert_nth_int()

pg_nodiscard List * list_insert_nth_int ( List list,
int  pos,
int  datum 
)
extern

Definition at line 453 of file list.c.

454{
455 if (list == NIL)
456 {
457 Assert(pos == 0);
458 return list_make1_int(datum);
459 }
460 Assert(IsIntegerList(list));
461 lfirst_int(insert_new_cell(list, pos)) = datum;
463 return list;
464}
#define list_make1_int(x1)
Definition pg_list.h:227

References Assert, check_list_invariants, insert_new_cell(), IsIntegerList, lfirst_int, list_make1_int, and NIL.

◆ list_insert_nth_oid()

pg_nodiscard List * list_insert_nth_oid ( List list,
int  pos,
Oid  datum 
)
extern

Definition at line 467 of file list.c.

468{
469 if (list == NIL)
470 {
471 Assert(pos == 0);
472 return list_make1_oid(datum);
473 }
474 Assert(IsOidList(list));
475 lfirst_oid(insert_new_cell(list, pos)) = datum;
477 return list;
478}
#define list_make1_oid(x1)
Definition pg_list.h:242

References Assert, check_list_invariants, insert_new_cell(), IsOidList, lfirst_oid, list_make1_oid, and NIL.

◆ list_int_cmp()

int list_int_cmp ( const ListCell p1,
const ListCell p2 
)
extern

Definition at line 1691 of file list.c.

1692{
1693 int v1 = lfirst_int(p1);
1694 int v2 = lfirst_int(p2);
1695
1696 return pg_cmp_s32(v1, v2);
1697}
static int pg_cmp_s32(int32 a, int32 b)
Definition int.h:713

References fb(), lfirst_int, and pg_cmp_s32().

Referenced by expand_grouping_sets().

◆ list_intersection()

List * list_intersection ( const List list1,
const List list2 
)
extern

Definition at line 1174 of file list.c.

1175{
1176 List *result;
1177 const ListCell *cell;
1178
1179 if (list1 == NIL || list2 == NIL)
1180 return NIL;
1181
1184
1185 result = NIL;
1186 foreach(cell, list1)
1187 {
1188 if (list_member(list2, lfirst(cell)))
1189 result = lappend(result, lfirst(cell));
1190 }
1191
1192 check_list_invariants(result);
1193 return result;
1194}

References Assert, check_list_invariants, fb(), IsPointerList, lappend(), lfirst, list_member(), and NIL.

◆ list_intersection_int()

List * list_intersection_int ( const List list1,
const List list2 
)
extern

Definition at line 1200 of file list.c.

1201{
1202 List *result;
1203 const ListCell *cell;
1204
1205 if (list1 == NIL || list2 == NIL)
1206 return NIL;
1207
1210
1211 result = NIL;
1212 foreach(cell, list1)
1213 {
1214 if (list_member_int(list2, lfirst_int(cell)))
1215 result = lappend_int(result, lfirst_int(cell));
1216 }
1217
1218 check_list_invariants(result);
1219 return result;
1220}

References Assert, check_list_invariants, fb(), IsIntegerList, lappend_int(), lfirst_int, list_member_int(), and NIL.

Referenced by parseCheckAggregates().

◆ list_last_cell()

static ListCell * list_last_cell ( const List list)
inlinestatic

Definition at line 288 of file pg_list.h.

289{
290 Assert(list != NIL);
291 return &list->elements[list->length - 1];
292}

References Assert, and NIL.

Referenced by transformIndexConstraint().

◆ list_length()

static int list_length ( const List l)
inlinestatic

Definition at line 152 of file pg_list.h.

153{
154 return l ? l->length : 0;
155}

References List::length.

Referenced by _outForeignKeyOptInfo(), _SPI_execute_plan(), acquire_inherited_sample_rows(), add_column_to_pathtarget(), add_function_defaults(), add_paths_to_append_rel(), add_paths_to_grouping_rel(), add_paths_with_pathkeys_for_rel(), add_row_identity_var(), add_rte_to_flat_rtable(), add_security_quals(), add_setop_child_rel_equivalences(), add_sp_item_to_pathtarget(), add_to_flat_tlist(), add_with_check_options(), AddEventToPendingNotifies(), addNSItemForReturning(), addRangeTableEntry(), addRangeTableEntryForCTE(), addRangeTableEntryForENR(), addRangeTableEntryForFunction(), addRangeTableEntryForGroup(), addRangeTableEntryForJoin(), addRangeTableEntryForRelation(), addRangeTableEntryForSubquery(), addRangeTableEntryForTableFunc(), addRangeTableEntryForValues(), AddRelationNewConstraints(), AddRelationNotNullConstraints(), AddRoleMems(), addRTEPermissionInfo(), adjust_appendrel_attrs_mutator(), adjust_inherited_attnums(), adjust_paths_for_srfs(), AlterDatabase(), AlterSubscription_refresh(), analyzeCTETargetList(), apply_tlist_labeling(), ApplyRetrieveRule(), array_subscript_transform(), assign_hypothetical_collations(), assign_ordered_set_collations(), assign_param_for_placeholdervar(), assign_param_for_var(), assign_special_exec_param(), ATAddCheckNNConstraint(), ATAddForeignKeyConstraint(), ATExecAlterColumnType(), AttachPartitionEnsureIndexes(), basebackup_progress_wait_wal_archive(), bbsink_end_backup(), bbsink_progress_begin_backup(), bbsink_progress_end_archive(), BeginCopyTo(), btvalidate(), build_expr_data(), build_index_paths(), build_local_reloptions(), build_merged_partition_bounds(), build_mvdependencies(), build_mvndistinct(), build_pertrans_for_aggref(), build_remote_returning(), build_simple_rel(), build_subplan(), build_tlist_index(), build_tlist_index_other_vars(), BuildDescForRelation(), BuildDescFromLists(), buildNSItemFromLists(), buildNSItemFromTupleDesc(), buildRelationAliases(), BuildRelationExtStatistics(), cached_plan_cost(), calculate_partition_bound_for_merge(), CallStmtResultDesc(), can_minmax_aggs(), check_and_push_window_quals(), check_hashjoinable(), check_memoizable(), check_mergejoinable(), check_partitions_for_split(), check_partitions_not_overlap_list(), check_publications(), check_publications_origin_sequences(), check_publications_origin_tables(), check_selective_binary_conversion(), check_sql_stmt_retval(), check_synchronized_standby_slots(), check_temp_tablespaces(), CheckAndReportConflict(), CheckIndexCompatible(), CheckRADIUSAuth(), choose_best_statistics(), choose_bitmap_and(), ChoosePortalStrategy(), classify_index_clause_usage(), clause_is_strict_for(), clauselist_selectivity_ext(), cmp_list_len_asc(), coerce_fn_result_column(), CombineRangeTables(), common_prefix_cmp(), commute_restrictinfo(), CommuteOpExpr(), compute_partition_bounds(), compute_semijoin_info(), ComputeIndexAttrs(), connect_pg_server(), consider_groupingsets_paths(), consider_index_join_clauses(), consider_index_join_outer_rels(), conversion_error_callback(), convert_ANY_sublink_to_join(), convert_EXISTS_sublink_to_join(), convert_requires_to_datum(), convert_subquery_pathkeys(), convert_testexpr_mutator(), convert_VALUES_to_ANY(), cookConstraint(), copy_pathtarget(), copy_sequences(), CopyAttributeOutCSV(), CopyFrom(), CopyFromBinaryOneRow(), CopyFromTextLikeOneRow(), CopyFromTextLikeStart(), CopyMultiInsertInfoFlush(), CopyReadAttributesCSV(), CopyReadAttributesText(), CopyToBinaryOneRow(), cost_agg(), cost_incremental_sort(), cost_tidscan(), cost_windowagg(), count_rowexpr_columns(), CountJsonPathVars(), create_agg_path(), create_agg_plan(), create_append_path(), create_append_plan(), create_bitmap_subplan(), create_ctescan_plan(), create_degenerate_grouping_paths(), create_final_distinct_paths(), create_final_unique_paths(), create_foreign_modify(), create_group_path(), create_group_plan(), create_groupingsets_path(), create_groupingsets_plan(), create_hashjoin_plan(), create_indexscan_plan(), create_limit_plan(), create_memoize_plan(), create_merge_append_path(), create_merge_append_plan(), create_mergejoin_plan(), create_modifytable_path(), create_nestloop_plan(), create_one_window_path(), create_partial_distinct_paths(), create_partial_grouping_paths(), create_partial_unique_paths(), create_setop_path(), create_tidscan_plan(), create_unique_paths(), create_windowagg_plan(), CreateFunction(), CreatePartitionPruneState(), CreateStatistics(), createTableConstraints(), CreateTriggerFiringOn(), current_schemas(), currtid_for_view(), deconstruct_recurse(), DeconstructQualifiedName(), DefineAggregate(), DefineCollation(), DefineDomain(), DefineIndex(), DefineQueryRewrite(), DefineRelation(), DefineVirtualRelation(), DelRoleMems(), deparse_context_for_plan_tree(), deparseDistinctExpr(), deparseOpExpr(), deparseRangeTblRef(), deparseScalarArrayOpExpr(), dependencies_array_end(), dependencies_clauselist_selectivity(), dependencies_object_end(), dependency_is_compatible_clause(), dependency_is_compatible_expression(), do_analyze_rel(), does_not_exist_skipping(), ec_build_derives_hash(), ec_search_derived_clause_for_ems(), eclass_useful_for_merging(), elem_contained_by_range_support(), EnumValuesCreate(), equalRSDesc(), estimate_array_length(), estimate_hashagg_tablesize(), estimate_multivariate_bucketsize(), estimate_multivariate_ndistinct(), estimate_path_cost_size(), EstimateReindexStateSpace(), eval_const_expressions_mutator(), EvalPlanQualBegin(), EvalPlanQualStart(), EvaluateParams(), examine_opclause_args(), examine_simple_variable(), exec_eval_using_params(), exec_is_simple_query(), exec_parse_message(), exec_save_simple_expr(), exec_simple_query(), ExecBuildAggTrans(), ExecBuildHash32Expr(), ExecBuildParamSetEqual(), ExecBuildUpdateProjection(), ExecCheckPermissions(), ExecCreateTableAs(), ExecEvalXmlExpr(), ExecIndexBuildScanKeys(), ExecInitAgg(), ExecInitAppend(), ExecInitBitmapAnd(), ExecInitBitmapOr(), ExecInitExprRec(), ExecInitFunc(), ExecInitFunctionScan(), ExecInitHashJoin(), ExecInitIndexScan(), ExecInitMerge(), ExecInitMergeAppend(), ExecInitMergeJoin(), ExecInitModifyTable(), ExecInitPartitionInfo(), ExecInitProjectSet(), ExecInitRangeTable(), ExecInitSubPlan(), ExecInitSubPlanExpr(), ExecInitSubscriptingRef(), ExecInitValuesScan(), ExecInitWindowAgg(), ExecMakeTableFunctionResult(), ExecOpenIndices(), ExecRelGenVirtualNotNull(), ExecSecLabelStmt(), ExecSupportsMarkRestore(), ExecTargetListLength(), ExecTypeFromExprList(), execute_extension_script(), ExecuteCallStmt(), ExecuteQuery(), ExecuteTruncateGuts(), expand_function_arguments(), expand_generated_columns_internal(), expand_grouping_sets(), expand_groupingset_node(), expand_indexqual_rowcompare(), expand_inherited_rtentry(), expand_single_inheritance_child(), expand_virtual_generated_columns(), ExpandColumnRefStar(), ExpandIndirectionStar(), expandRecordVariable(), expandRTE(), expandTupleDesc(), ExplainCustomChildren(), ExplainNode(), ExplainOneUtility(), ExplainPrintPlan(), ExplainPrintTriggers(), ExplainTargetRel(), ExportSnapshot(), exprIsLengthCoercion(), extended_statistics_update(), extract_grouping_collations(), extract_grouping_cols(), extract_grouping_ops(), extract_jsp_path_expr(), extract_rollup_sets(), filter_list_to_array(), final_cost_mergejoin(), finalize_plan(), find_all_inheritors(), find_duplicate_ors(), find_expr_references_walker(), find_install_path(), find_join_rel(), find_minmax_agg_replacement_param(), find_modifytable_subplan(), findTargetlistEntrySQL92(), fireRIRrules(), fix_indexqual_clause(), fix_param_node(), flatten_join_alias_vars_mutator(), flatten_set_variable_args(), flatten_simple_union_all(), for_both_cell_setup(), for_each_cell_setup(), foreign_expr_walker(), foreign_grouping_ok(), foreign_join_ok(), func_get_detail(), funcname_signature_string(), gather_grouping_paths(), gen_partprune_steps_internal(), gen_prune_step_op(), generate_append_tlist(), generate_base_implied_equalities(), generate_base_implied_equalities_const(), generate_implied_equalities_for_column(), generate_join_implied_equalities(), generate_join_implied_equalities_for_ecs(), generate_mergejoin_paths(), generate_new_exec_param(), generate_orderedappend_paths(), generate_series_int4_support(), generate_series_int8_support(), generate_series_numeric_support(), generate_union_paths(), genericcostestimate(), geqo_eval(), get_agg_expr_helper(), get_aggregate_argtypes(), get_call_expr_arg_stable(), get_call_expr_argtype(), get_eclass_for_sort_expr(), get_expr_result_type(), get_foreign_key_join_selectivity(), get_from_clause_item(), get_func_expr(), get_func_sql_syntax(), get_join_variables(), get_matching_partitions(), get_name_for_var_field(), get_nullingrels(), get_number_of_groups(), get_object_address_attrdef(), get_object_address_attribute(), get_object_address_defacl(), get_object_address_opf_member(), get_object_address_relobject(), get_oper_expr(), get_partition_qual_relid(), get_qual_for_range(), get_query_def(), get_rel_sync_entry(), get_relation_foreign_keys(), get_restriction_variable(), get_rightop(), get_rtable_name(), get_rte_attribute_is_dropped(), get_rte_attribute_name(), get_rule_expr(), get_rule_groupingset(), get_simple_binary_op_name(), get_simple_values_rte(), get_singleton_append_subpath(), get_steps_using_prefix_recurse(), get_update_query_targetlist_def(), get_useful_group_keys_orderings(), get_useful_pathkeys_for_distinct(), get_useful_pathkeys_for_relation(), get_useful_pathkeys_for_relation(), get_variable(), get_view_query(), get_windowfunc_expr_helper(), getIdentitySequence(), getInsertSelectQuery(), GetOldestUnsummarizedLSN(), GetRTEByRangeTablePosn(), getRTEPermissionInfo(), getTokenTypes(), gimme_tree(), gincostestimate(), gistbufferinginserttuples(), gistfinishsplit(), gistRelocateBuildBuffersOnSplit(), group_keys_reorder_by_pathkeys(), group_similar_or_args(), grouping_planner(), has_relevant_eclass_joinclause(), hash_ok_operator(), hashvalidate(), have_relevant_eclass_joinclause(), have_relevant_joinclause(), hstore_subscript_transform(), identify_join_columns(), init_execution_state(), init_sexpr(), initial_cost_hashjoin(), initialize_peragg(), InitPartitionPruneContext(), initPendingListenActions(), inline_function(), inline_function_in_from(), inline_sql_function_in_from(), int8inc_support(), int_list_to_array(), interpret_AS_clause(), interpret_function_parameter_list(), interval_support(), InvalidatePublicationRels(), is_safe_append_member(), is_simple_values(), is_strict_saop(), IsBinaryTidClause(), IsSquashableConstantList(), IsTidEqualAnyClause(), IsTransactionExitStmtList(), IsTransactionStmtList(), JsonTableInitOpaque(), JsonValueListLength(), like_regex_support(), list_deduplicate_oid(), list_delete_first_n(), list_delete_last(), list_sort(), list_truncate(), lookup_var_attr_stats(), LookupFuncWithArgs(), LookupOperWithArgs(), LookupTypeNameExtended(), make_ands_explicit(), make_build_data(), make_callstmt_target(), make_jsp_expr_node_args(), make_memoize(), make_modifytable(), make_partition_op_expr(), make_partition_pruneinfo(), make_path_rowexpr(), make_pathtarget_from_tlist(), make_plain_restrictinfo(), make_recursive_union(), make_rel_from_joinlist(), make_row_comparison_op(), make_row_distinct_op(), make_ruledef(), make_SAOP_expr(), make_setop(), make_setop_translation_list(), make_sort_from_groupcols(), make_sort_from_sortclauses(), make_sort_input_target(), make_unique_from_pathkeys(), make_viewdef(), MakeConfigurationMapping(), makeRangeVarFromNameList(), makeWholeRowVar(), markNullableIfNeeded(), markRelsAsNulledBy(), markRTEForSelectPriv(), markTargetListOrigin(), match_clause_to_partition_key(), match_foreign_keys_to_quals(), match_opclause_to_indexcol(), match_orclause_to_indexcol(), MatchNamedCall(), mbms_add_member(), mbms_add_members(), mbms_int_members(), mbms_is_member(), mcv_get_match_bitmap(), merge_clump(), merge_list_bounds(), merge_range_bounds(), MergeAttributes(), MJExamineQuals(), ndistinct_array_end(), ndistinct_object_end(), ndistinct_scalar(), network_subset_support(), NextCopyFromRawFieldsInternal(), numeric_support(), operator_predicate_proof(), optimize_window_clauses(), order_qual_clauses(), ordered_set_startup(), overexplain_range_table(), owningrel_does_not_exist_skipping(), pa_free_worker(), pa_stream_abort(), paraminfo_get_equal_hashops(), parse_hba_line(), parse_tsquery(), parseCheckAggregates(), ParseFuncOrColumn(), parseLocalRelOptions(), pathkeys_count_contained_in(), perform_pruning_base_step(), PerformCursorOpen(), pg_get_function_arg_default(), pg_get_object_address(), pg_get_publication_sequences(), pg_get_publication_tables(), pg_get_statisticsobj_worker(), pg_partition_ancestors(), pg_partition_tree(), pgoutput_column_list_init(), plpgsql_parse_cwordtype(), PLy_abort_open_subtransactions(), PLy_procedure_call(), policy_role_list_to_array(), postgresBeginDirectModify(), postgresBeginForeignScan(), postgresExplainForeignScan(), postgresGetForeignModifyBatchSize(), predicate_classify(), predicate_implied_by(), predicate_implied_by_simple_clause(), predicate_refuted_by(), prepare_next_query(), prepare_sort_from_pathkeys(), PrepareForIncrementalBackup(), PrepareQuery(), PrepareTempTablespaces(), preprocess_aggref(), preprocess_groupclause(), preprocess_grouping_sets(), preprocess_minmax_aggregates(), preprocess_relation_rtes(), preprocess_targetlist(), print_expr(), print_function_arguments(), ProcedureCreate(), process_duplicate_ors(), process_owned_by(), processIndirection(), processTypesSpec(), ProcessUtilitySlow(), prune_append_rel_partitions(), publicationListToArray(), pull_up_constant_function(), pull_up_simple_subquery(), pull_up_simple_union_all(), pull_up_simple_values(), pull_up_sublinks_qual_recurse(), pullup_replace_vars_callback(), PutMemoryContextsStatsTupleStore(), query_is_distinct_for(), query_planner(), range_contains_elem_support(), rebuild_eclass_attr_needed(), rebuild_fdw_scan_tlist(), ReceiveCopyBegin(), recheck_cast_function_args(), reconsider_full_join_clause(), reduce_outer_joins_pass2(), refresh_matview_datafill(), RefreshMatViewByOid(), regdatabasein(), register_partpruneinfo(), regnamespacein(), regrolein(), RelationBuildPartitionDesc(), remap_groupColIdx(), remove_dbtablespaces(), remove_self_joins_one_group(), remove_useless_groupby_columns(), remove_useless_results_recurse(), remove_useless_self_joins(), RemoveInheritance(), RemoveRelations(), reorder_function_arguments(), reorder_grouping_sets(), replace_domain_constraint_value(), replace_empty_jointree(), replace_outer_agg(), replace_outer_grouping(), replace_outer_merge_support(), replace_outer_returning(), report_sequence_errors(), resolve_column_ref(), resolve_special_varno(), RewriteQuery(), rewriteRuleAction(), rewriteSearchAndCycle(), rewriteTargetView(), rewriteValuesRTE(), RI_Initial_Check(), roles_list_append(), scalararraysel(), SearchCatCacheList(), select_active_windows(), select_outer_pathkeys_for_merge(), selectColorTrigrams(), SendCopyBegin(), SendNegotiateProtocolVersion(), SerializeReindexState(), set_append_references(), set_cte_pathlist(), set_deparse_context_plan(), set_deparse_for_query(), set_join_column_names(), set_mergeappend_references(), set_plan_references(), set_plan_refs(), set_relation_column_names(), set_rtable_names(), set_simple_column_names(), set_subquery_pathlist(), set_using_names(), set_values_size_estimates(), setup_simple_rel_arrays(), show_incremental_sort_group_info(), simplify_boolean_equality(), sort_inner_and_outer(), SPI_cursor_open_internal(), SPI_is_cursor_plan(), SPI_plan_get_cached_plan(), split_pathtarget_walker(), split_selfjoin_quals(), sql_compile_callback(), sql_fn_post_column_ref(), SS_make_initplan_from_plan(), SS_process_ctes(), standard_ExecutorStart(), standard_join_search(), standard_planner(), standard_qp_callback(), statext_is_compatible_clause_internal(), statext_mcv_clauselist_selectivity(), StoreRelCheck(), strlist_to_textarray(), subquery_planner(), substitute_grouped_columns_mutator(), tablesample_init(), TemporalSimplify(), test_inline_in_from_support_func(), test_opexpr_is_hashable(), test_predtest(), TidExprListCreate(), TidListEval(), TidQualFromRestrictInfoList(), tlist_same_exprs(), toast_open_indexes(), tokenize_auth_file(), transform_MERGE_to_join(), transformAExprBetween(), transformAExprIn(), transformAExprOp(), transformAggregateCall(), transformAlterTableStmt(), transformCallStmt(), transformColumnDefinition(), transformColumnRef(), transformFromClauseItem(), transformGroupingFunc(), transformGroupingSet(), transformIndexConstraint(), transformIndexStmt(), transformInsertRow(), transformInsertStmt(), transformJoinUsingClause(), transformJsonTableColumns(), transformMergeStmt(), transformMultiAssignRef(), transformPartitionBound(), transformPartitionRangeBounds(), transformPartitionSpec(), transformPLAssignStmtTarget(), transformRangeFunction(), transformRangeTableFunc(), transformRangeTableSample(), transformReturningClause(), transformRowExpr(), transformRuleStmt(), transformSetOperationStmt(), transformSetOperationTree(), transformStatsStmt(), transformSubLink(), transformValuesClause(), transformWholeRowRef(), transformWindowDefinitions(), transformWindowFuncCall(), transformWithClause(), trivial_subqueryscan(), truncate_useless_pathkeys(), tsvector_update_trigger(), TypeGetTupleDesc(), typenameTypeMod(), typeStringToTypeName(), unify_hypothetical_args(), vac_open_indexes(), vacuum(), validate_log_connections_options(), ValuesNext(), varbit_support(), varchar_support(), view_cols_are_auto_updatable(), and view_query_is_auto_updatable().

◆ list_make1_impl()

List * list_make1_impl ( NodeTag  t,
ListCell  datum1 
)
extern

Definition at line 236 of file list.c.

237{
238 List *list = new_list(t, 1);
239
240 list->elements[0] = datum1;
242 return list;
243}

References check_list_invariants, and new_list().

◆ list_make2_impl()

List * list_make2_impl ( NodeTag  t,
ListCell  datum1,
ListCell  datum2 
)
extern

Definition at line 246 of file list.c.

247{
248 List *list = new_list(t, 2);
249
250 list->elements[0] = datum1;
251 list->elements[1] = datum2;
253 return list;
254}

References check_list_invariants, fb(), and new_list().

◆ list_make3_impl()

List * list_make3_impl ( NodeTag  t,
ListCell  datum1,
ListCell  datum2,
ListCell  datum3 
)
extern

Definition at line 257 of file list.c.

259{
260 List *list = new_list(t, 3);
261
262 list->elements[0] = datum1;
263 list->elements[1] = datum2;
264 list->elements[2] = datum3;
266 return list;
267}

References check_list_invariants, fb(), and new_list().

◆ list_make4_impl()

List * list_make4_impl ( NodeTag  t,
ListCell  datum1,
ListCell  datum2,
ListCell  datum3,
ListCell  datum4 
)
extern

Definition at line 270 of file list.c.

272{
273 List *list = new_list(t, 4);
274
275 list->elements[0] = datum1;
276 list->elements[1] = datum2;
277 list->elements[2] = datum3;
278 list->elements[3] = datum4;
280 return list;
281}

References check_list_invariants, fb(), and new_list().

◆ list_make5_impl()

List * list_make5_impl ( NodeTag  t,
ListCell  datum1,
ListCell  datum2,
ListCell  datum3,
ListCell  datum4,
ListCell  datum5 
)
extern

Definition at line 284 of file list.c.

286{
287 List *list = new_list(t, 5);
288
289 list->elements[0] = datum1;
290 list->elements[1] = datum2;
291 list->elements[2] = datum3;
292 list->elements[3] = datum4;
293 list->elements[4] = datum5;
295 return list;
296}

References check_list_invariants, fb(), and new_list().

◆ list_member()

◆ list_member_int()

◆ list_member_oid()

bool list_member_oid ( const List list,
Oid  datum 
)
extern

Definition at line 722 of file list.c.

723{
724 const ListCell *cell;
725
726 Assert(IsOidList(list));
728
729 foreach(cell, list)
730 {
731 if (lfirst_oid(cell) == datum)
732 return true;
733 }
734
735 return false;
736}

References Assert, check_list_invariants, IsOidList, and lfirst_oid.

Referenced by AfterTriggerSaveEvent(), AlterTableMoveAll(), apply_handle_truncate(), ATExecAddInherit(), ATExecAttachPartition(), ATExecMergePartitions(), BeginCopyTo(), CheckAndReportConflict(), CheckAttributeType(), CloneFkReferenced(), CloneFkReferencing(), CollationIsVisibleExt(), ConversionIsVisibleExt(), DefineRelation(), DetachPartitionFinalize(), ec_member_matches_indexcol(), ExecAlterObjectDependsStmt(), ExecCheckIndexConstraints(), ExecInitPartitionInfo(), ExecInsertIndexTuples(), ExecuteTruncate(), exprs_known_equal(), finalNamespacePath(), fireRIRrules(), FunctionIsVisibleExt(), get_rel_sync_entry(), get_transform_fromsql(), get_transform_tosql(), GetTopMostAncestorInPublication(), has_privs_of_role(), hashvalidate(), have_partkey_equi_join(), heap_truncate_check_FKs(), heap_truncate_find_FKs(), inline_function(), is_member_of_role(), is_member_of_role_nosuper(), list_append_unique_oid(), list_concat_unique_oid(), list_difference_oid(), list_union_oid(), LockViewRecurse_walker(), lookup_shippable(), member_can_set_role(), OpclassIsVisibleExt(), OpenTableList(), OperatorIsVisibleExt(), OpfamilyIsVisibleExt(), PlanCacheRelCallback(), ReindexIsProcessingIndex(), relation_has_unique_index_for(), relation_is_updatable(), RelationIsVisibleExt(), RememberConstraintForRebuilding(), RememberIndexForRebuilding(), RememberStatisticsForRebuilding(), roles_list_append(), StatisticsObjIsVisibleExt(), TSConfigIsVisibleExt(), TSDictionaryIsVisibleExt(), TSParserIsVisibleExt(), TSTemplateIsVisibleExt(), typeInheritsFrom(), and TypeIsVisibleExt().

◆ list_member_ptr()

◆ list_member_xid()

bool list_member_xid ( const List list,
TransactionId  datum 
)
extern

Definition at line 742 of file list.c.

743{
744 const ListCell *cell;
745
746 Assert(IsXidList(list));
748
749 foreach(cell, list)
750 {
751 if (lfirst_xid(cell) == datum)
752 return true;
753 }
754
755 return false;
756}
#define lfirst_xid(lc)
Definition pg_list.h:175

References Assert, check_list_invariants, IsXidList, and lfirst_xid.

Referenced by get_schema_sent_in_streamed_txn(), and pa_start_subtrans().

◆ list_nth()

static void * list_nth ( const List list,
int  n 
)
inlinestatic

Definition at line 299 of file pg_list.h.

300{
301 Assert(IsA(list, List));
302 return lfirst(list_nth_cell(list, n));
303}
static ListCell * list_nth_cell(const List *list, int n)
Definition pg_list.h:277

References Assert, IsA, lfirst, and list_nth_cell().

Referenced by add_child_join_rel_equivalences(), add_child_rel_equivalences(), AddRelationNotNullConstraints(), adjust_appendrel_attrs_mutator(), adjust_inherited_attnums(), apply_handle_update(), ATAddForeignKeyConstraint(), bbsink_copystream_begin_archive(), build_joinrel_tlist(), build_mvdependencies(), build_mvndistinct(), calculate_partition_bound_for_merge(), CallStmtResultDesc(), check_and_push_window_quals(), check_new_partition_bound(), check_partition_bounds_for_split_range(), consider_index_join_outer_rels(), conversion_error_callback(), convert_subquery_pathkeys(), convert_testexpr_mutator(), copy_sequences(), dependencies_clauselist_selectivity(), errorMissingColumn(), eval_const_expressions_mutator(), examine_simple_variable(), exec_rt_fetch(), ExecInitAppend(), ExecInitCteScan(), ExecInitMemoize(), ExecInitMerge(), ExecInitMergeAppend(), ExecInitModifyTable(), ExecInitPartitionExecPruning(), ExecInitSubPlan(), ExecInitUpdateProjection(), expand_indexqual_rowcompare(), expand_single_inheritance_child(), expandRecordVariable(), expandRTE(), ExplainTargetRel(), extended_statistics_update(), finalize_plan(), find_expr_references_walker(), find_hash_columns(), find_modifytable_subplan(), find_window_run_conditions(), fix_param_node(), flatten_group_exprs_mutator(), flatten_join_alias_vars_mutator(), generate_implied_equalities_for_column(), generate_join_implied_equalities(), get_and_validate_seq_info(), get_call_expr_arg_stable(), get_call_expr_argtype(), get_name_for_var_field(), get_rtable_name(), get_rte_attribute_is_dropped(), get_rte_attribute_name(), get_sequences_string(), get_tupdesc_for_join_scan_tuples(), get_variable(), GetOldestUnsummarizedLSN(), gettuple_eval_partition(), gimme_tree(), gistfinishsplit(), group_similar_or_args(), has_dangerous_join_using(), has_relevant_eclass_joinclause(), have_relevant_eclass_joinclause(), ignorenulls_getfuncarginframe(), infer_collation_opclass_match(), init_execution_state(), interpret_AS_clause(), JsonTableGetValue(), make_callstmt_target(), make_path_rowexpr(), markNullableIfNeeded(), match_eclasses_to_foreign_key_col(), merge_clump(), pg_get_function_arg_default(), pg_get_publication_tables(), postgresBeginDirectModify(), postgresBeginForeignModify(), postgresBeginForeignScan(), postgresExplainDirectModify(), postgresExplainForeignModify(), postgresExplainForeignScan(), postgresGetForeignPlan(), postgresPlanDirectModify(), postgresPlanForeignModify(), PrepareForIncrementalBackup(), remove_self_join_rel(), reorder_grouping_sets(), resolve_special_varno(), rewriteSearchAndCycle(), set_cte_pathlist(), set_deparse_plan(), set_join_column_names(), set_relation_column_names(), set_using_names(), show_modifytable_info(), show_result_replacement_info(), substitute_actual_parameters_in_from_mutator(), substitute_actual_parameters_mutator(), SyncPostCheckpoint(), transformInsertRow(), transformMultiAssignRef(), transformPartitionCmdForSplit(), transformPartitionRangeBounds(), transformSetOperationStmt(), TypeGetTupleDesc(), validateFkOnDeleteSetColumns(), WinGetFuncArgCurrent(), and WinGetFuncArgInFrame().

◆ list_nth_cell()

static ListCell * list_nth_cell ( const List list,
int  n 
)
inlinestatic

◆ list_nth_int()

◆ list_nth_oid()

◆ list_oid_cmp()

int list_oid_cmp ( const ListCell p1,
const ListCell p2 
)
extern

Definition at line 1703 of file list.c.

1704{
1705 Oid v1 = lfirst_oid(p1);
1706 Oid v2 = lfirst_oid(p2);
1707
1708 return pg_cmp_u32(v1, v2);
1709}
static int pg_cmp_u32(uint32 a, uint32 b)
Definition int.h:719

References fb(), lfirst_oid, and pg_cmp_u32().

Referenced by GetPublicationRelations(), heap_truncate_find_FKs(), RelationGetIndexList(), and RelationGetStatExtList().

◆ list_second_cell()

static ListCell * list_second_cell ( const List l)
inlinestatic

Definition at line 142 of file pg_list.h.

143{
144 if (l && l->length >= 2)
145 return &l->elements[1];
146 else
147 return NULL;
148}

References List::elements, fb(), and List::length.

Referenced by JsonValueListInitIterator(), and select_common_type().

◆ list_sort()

void list_sort ( List list,
list_sort_comparator  cmp 
)
extern

Definition at line 1674 of file list.c.

1675{
1676 typedef int (*qsort_comparator) (const void *a, const void *b);
1677 int len;
1678
1680
1681 /* Nothing to do if there's less than two elements */
1682 len = list_length(list);
1683 if (len > 1)
1684 qsort(list->elements, len, sizeof(ListCell), (qsort_comparator) cmp);
1685}
#define qsort(a, b, c, d)
Definition port.h:495

References a, b, check_list_invariants, cmp(), fb(), len, list_length(), and qsort.

Referenced by create_append_path(), expand_grouping_sets(), GetPublicationRelations(), heap_truncate_find_FKs(), perform_base_backup(), RelationGetIndexList(), RelationGetStatExtList(), sort_policies_by_name(), UpdateLogicalMappings(), and WalSummariesAreComplete().

◆ list_tail()

static ListCell * list_tail ( const List l)
inlinestatic

Definition at line 135 of file pg_list.h.

136{
137 return l ? &l->elements[l->length - 1] : NULL;
138}

References List::elements, fb(), and List::length.

◆ list_truncate()

pg_nodiscard List * list_truncate ( List list,
int  new_size 
)
extern

Definition at line 631 of file list.c.

632{
633 if (new_size <= 0)
634 return NIL; /* truncate to zero length */
635
636 /* If asked to effectively extend the list, do nothing */
637 if (new_size < list_length(list))
638 list->length = new_size;
639
640 /*
641 * Note: unlike the individual-list-cell deletion functions, we don't move
642 * the list cells to new storage, even in DEBUG_LIST_MEMORY_USAGE mode.
643 * This is because none of them can move in this operation, so just like
644 * in the old cons-cell-based implementation, this function doesn't
645 * invalidate any pointers to cells of the list. This is also the reason
646 * for not wiping the memory of the deleted cells: the old code didn't
647 * free them either. Perhaps later we'll tighten this up.
648 */
649
650 return list;
651}

References fb(), list_length(), and NIL.

Referenced by choose_bitmap_and(), expand_indexqual_rowcompare(), ExpandIndirectionStar(), expandRTE(), generate_mergejoin_paths(), geqo_eval(), list_delete_last(), mbms_int_members(), pa_stream_abort(), ParseFuncOrColumn(), transformAggregateCall(), transformFromClauseItem(), transformReturningClause(), transformSetOperationStmt(), and transformWholeRowRef().

◆ list_union()

List * list_union ( const List list1,
const List list2 
)
extern

Definition at line 1066 of file list.c.

1067{
1068 List *result;
1069 const ListCell *cell;
1070
1073
1074 result = list_copy(list1);
1075 foreach(cell, list2)
1076 {
1077 if (!list_member(result, lfirst(cell)))
1078 result = lappend(result, lfirst(cell));
1079 }
1080
1081 check_list_invariants(result);
1082 return result;
1083}

References Assert, check_list_invariants, fb(), IsPointerList, lappend(), lfirst, list_copy(), and list_member().

Referenced by AddRelationNewConstraints(), and process_duplicate_ors().

◆ list_union_int()

List * list_union_int ( const List list1,
const List list2 
)
extern

Definition at line 1113 of file list.c.

1114{
1115 List *result;
1116 const ListCell *cell;
1117
1120
1121 result = list_copy(list1);
1122 foreach(cell, list2)
1123 {
1124 if (!list_member_int(result, lfirst_int(cell)))
1125 result = lappend_int(result, lfirst_int(cell));
1126 }
1127
1128 check_list_invariants(result);
1129 return result;
1130}

References Assert, check_list_invariants, fb(), IsIntegerList, lappend_int(), lfirst_int, list_copy(), and list_member_int().

Referenced by expand_grouping_sets().

◆ list_union_oid()

List * list_union_oid ( const List list1,
const List list2 
)
extern

Definition at line 1136 of file list.c.

1137{
1138 List *result;
1139 const ListCell *cell;
1140
1143
1144 result = list_copy(list1);
1145 foreach(cell, list2)
1146 {
1147 if (!list_member_oid(result, lfirst_oid(cell)))
1148 result = lappend_oid(result, lfirst_oid(cell));
1149 }
1150
1151 check_list_invariants(result);
1152 return result;
1153}

References Assert, check_list_invariants, fb(), IsOidList, lappend_oid(), lfirst_oid, list_copy(), and list_member_oid().

◆ list_union_ptr()

List * list_union_ptr ( const List list1,
const List list2 
)
extern

Definition at line 1090 of file list.c.

1091{
1092 List *result;
1093 const ListCell *cell;
1094
1097
1098 result = list_copy(list1);
1099 foreach(cell, list2)
1100 {
1101 if (!list_member_ptr(result, lfirst(cell)))
1102 result = lappend(result, lfirst(cell));
1103 }
1104
1105 check_list_invariants(result);
1106 return result;
1107}

References Assert, check_list_invariants, fb(), IsPointerList, lappend(), lfirst, list_copy(), and list_member_ptr().

◆ lnext()

static ListCell * lnext ( const List l,
const ListCell c 
)
inlinestatic

Definition at line 343 of file pg_list.h.

344{
345 Assert(c >= &l->elements[0] && c < &l->elements[l->length]);
346 c++;
347 if (c < &l->elements[l->length])
348 return (ListCell *) c;
349 else
350 return NULL;
351}

References Assert, List::elements, fb(), and List::length.

Referenced by _outList(), add_setop_child_rel_equivalences(), analyzeCTE(), arrayexpr_next_fn(), assign_hypothetical_collations(), asyncQueueAddEntries(), ATAddForeignKeyConstraint(), build_index_tlist(), buildRelationAliases(), CheckRADIUSAuth(), coerce_record_to_complex(), compare_tlist_datatypes(), ComputeIndexAttrs(), consider_groupingsets_paths(), ConstructTupleDescriptor(), create_ctas_nodata(), create_mergejoin_plan(), create_one_window_path(), DefineView(), deparseAggref(), deparseFuncExpr(), deparseSubscriptingRef(), do_analyze_rel(), eclass_member_iterator_next(), examine_variable(), exec_simple_query(), exec_stmt_raise(), ExecInitJunkFilterConversion(), ExecLockRows(), expand_insert_targetlist(), expandRTE(), expandTupleDesc(), ExplainExecuteQuery(), ExplainQuery(), extract_rollup_sets(), find_param_referent(), fix_indexqual_operand(), FormIndexDatum(), FormPartitionKeyDatum(), funcname_signature_string(), generate_append_tlist(), generate_setop_child_grouplist(), generate_setop_grouplist(), generateClonedIndexStmt(), get_func_expr(), get_qual_for_hash(), get_qual_for_range(), get_range_key_properties(), get_range_nulltest(), get_rule_expr(), get_update_query_targetlist_def(), GetIndexInputType(), has_partition_attrs(), InitPartitionPruneContext(), intorel_startup(), JsonValueListNext(), list_next_fn(), make_inner_pathkeys_for_merge(), match_index_to_operand(), parse_hba_line(), parse_ident_line(), perform_base_backup(), perform_pruning_base_step(), pg_get_functiondef(), pg_get_indexdef_worker(), pg_get_partkeydef_worker(), PortalRunMulti(), postprocess_setop_tlist(), print_expr(), print_function_arguments(), print_pathkeys(), printSubscripts(), ProcedureCreate(), process_startup_options(), query_is_distinct_for(), RelationBuildPartitionKey(), SearchPathMatchesCurrentEnvironment(), SendRowDescriptionMessage(), serialize_deflist(), set_baserel_partition_key_exprs(), split_pathtarget_at_srfs_extended(), statatt_get_index_expr(), tfuncLoadRows(), tlist_matches_tupdesc(), tlist_same_collations(), tlist_same_datatypes(), transformAssignmentIndirection(), transformPartitionCmdForMerge(), transformPartitionCmdForSplit(), transformUpdateTargetList(), transformWithClause(), trim_mergeclauses_for_inner_pathkeys(), and try_partitionwise_join().