87 root->join_cur_level = level;
259 !
root->hasLateralRTEs)
260 elog(
ERROR,
"failed to build any %d-way joins", level);
382 foreach(l,
root->join_info_list)
554 if (
root->hasLateralRTEs)
624 foreach(l,
root->join_info_list)
847 foreach(
lc,
root->join_info_list)
931 if (
root->agg_clause_list ==
NIL ||
944 if (grouped_rel ==
NULL)
953 if (agg_info ==
NULL)
981 sjinfo, restrictlist);
1048 sjinfo, restrictlist);
1153 errmsg(
"FULL JOIN is only supported with merge-joinable or hash-joinable join conditions")));
1257 bool result =
false;
1275 foreach(l,
root->placeholder_list)
1292 foreach(l,
root->join_info_list)
1374 foreach(l,
root->placeholder_list)
1383 foreach(l,
root->join_info_list)
1427 foreach(
lc,
root->initial_rels)
1568 foreach(
lc, restrictlist)
1580 if (con->constisnull)
1626 if (joinrel->part_scheme ==
NULL || joinrel->
nparts == 0)
1643 rel2->consider_partitionwise_join);
1649 Assert(joinrel->part_scheme ==
rel1->part_scheme &&
1650 joinrel->part_scheme ==
rel2->part_scheme);
1722 elog(
ERROR,
"unrecognized join type: %d",
1786 nappinfos, appinfos);
1804 nappinfos, appinfos)));
1942 if (joinrel->
nparts == -1)
1961 if (!
rel1->partbounds_merged &&
1962 !
rel2->partbounds_merged &&
1969 boundinfo =
rel1->boundinfo;
1970 nparts =
rel1->nparts;
1981 if (boundinfo ==
NULL)
1991 joinrel->boundinfo = boundinfo;
1992 joinrel->
nparts = nparts;
1998 Assert(joinrel->boundinfo);
1999 Assert(joinrel->part_rels);
2062 rel1->all_partrels);
2089 rel2->all_partrels);
AppendRelInfo ** find_appinfos_by_relids(PlannerInfo *root, Relids relids, int *nappinfos)
Node * adjust_appendrel_attrs(PlannerInfo *root, Node *node, int nappinfos, AppendRelInfo **appinfos)
Relids adjust_child_relids(Relids relids, int nappinfos, AppendRelInfo **appinfos)
Bitmapset * bms_intersect(const Bitmapset *a, const Bitmapset *b)
bool bms_equal(const Bitmapset *a, const Bitmapset *b)
bool bms_is_subset(const Bitmapset *a, const Bitmapset *b)
int bms_singleton_member(const Bitmapset *a)
void bms_free(Bitmapset *a)
int bms_num_members(const Bitmapset *a)
bool bms_is_member(int x, const Bitmapset *a)
Bitmapset * bms_add_member(Bitmapset *a, int x)
Bitmapset * bms_add_members(Bitmapset *a, const Bitmapset *b)
Bitmapset * bms_union(const Bitmapset *a, const Bitmapset *b)
bool bms_overlap(const Bitmapset *a, const Bitmapset *b)
Bitmapset * bms_copy(const Bitmapset *a)
#define Assert(condition)
void set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel, RelOptInfo *outer_rel, RelOptInfo *inner_rel, SpecialJoinInfo *sjinfo, List *restrictlist)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define palloc0_array(type, count)
bool have_relevant_joinclause(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
void add_paths_to_joinrel(PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *outerrel, RelOptInfo *innerrel, JoinType jointype, SpecialJoinInfo *sjinfo, List *restrictlist)
static void populate_joinrel_with_paths(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2, RelOptInfo *joinrel, SpecialJoinInfo *sjinfo, List *restrictlist)
static void try_partitionwise_join(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2, RelOptInfo *joinrel, SpecialJoinInfo *parent_sjinfo, List *parent_restrictlist)
static void make_rels_by_clauseless_joins(PlannerInfo *root, RelOptInfo *old_rel, List *other_rels)
bool is_dummy_rel(RelOptInfo *rel)
void join_search_one_level(PlannerInfo *root, int level)
static bool restriction_is_constant_false(List *restrictlist, RelOptInfo *joinrel, bool only_pushed_down)
static void get_matching_part_pairs(PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *rel1, RelOptInfo *rel2, List **parts1, List **parts2)
RelOptInfo * make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
static bool has_legal_joinclause(PlannerInfo *root, RelOptInfo *rel)
static void compute_partition_bounds(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2, RelOptInfo *joinrel, SpecialJoinInfo *parent_sjinfo, List **parts1, List **parts2)
Relids add_outer_joins_to_relids(PlannerInfo *root, Relids input_relids, SpecialJoinInfo *sjinfo, List **pushed_down_joins)
static SpecialJoinInfo * build_child_join_sjinfo(PlannerInfo *root, SpecialJoinInfo *parent_sjinfo, Relids left_relids, Relids right_relids)
void mark_dummy_rel(RelOptInfo *rel)
bool have_join_order_restriction(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
static bool has_join_restriction(PlannerInfo *root, RelOptInfo *rel)
void init_dummy_sjinfo(SpecialJoinInfo *sjinfo, Relids left_relids, Relids right_relids)
static void free_child_join_sjinfo(SpecialJoinInfo *child_sjinfo, SpecialJoinInfo *parent_sjinfo)
static void make_grouped_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2, RelOptInfo *joinrel, SpecialJoinInfo *sjinfo, List *restrictlist)
static bool join_is_legal(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2, Relids joinrelids, SpecialJoinInfo **sjinfo_p, bool *reversed_p)
static void make_rels_by_clause_joins(PlannerInfo *root, RelOptInfo *old_rel, List *other_rels, int first_rel_idx)
List * lappend(List *list, void *datum)
Datum subpath(PG_FUNCTION_ARGS)
void pfree(void *pointer)
MemoryContext GetMemoryChunkContext(void *pointer)
#define IsA(nodeptr, _type_)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
bool partition_bounds_equal(int partnatts, int16 *parttyplen, bool *parttypbyval, PartitionBoundInfo b1, PartitionBoundInfo b2)
PartitionBoundInfo partition_bounds_merge(int partnatts, FmgrInfo *partsupfunc, Oid *partcollation, RelOptInfo *outer_rel, RelOptInfo *inner_rel, JoinType jointype, List **outer_parts, List **inner_parts)
void set_cheapest(RelOptInfo *parent_rel)
AppendPath * create_append_path(PlannerInfo *root, RelOptInfo *rel, List *subpaths, List *partial_subpaths, List *pathkeys, Relids required_outer, int parallel_workers, bool parallel_aware, double rows)
void add_path(RelOptInfo *parent_rel, Path *new_path)
#define IS_DUMMY_APPEND(p)
#define RINFO_IS_PUSHED_DOWN(rinfo, joinrelids)
#define IS_SIMPLE_REL(rel)
#define IS_PARTITIONED_REL(rel)
#define IS_GROUPED_REL(rel)
#define REL_HAS_ALL_PART_PROPS(rel)
@ RELOPT_OTHER_MEMBER_REL
#define lfirst_node(type, lc)
static int list_length(const List *l)
#define foreach_current_index(var_or_cell)
#define for_each_from(cell, lst, N)
static ListCell * list_head(const List *l)
static ListCell * lnext(const List *l, const ListCell *c)
RelOptInfo * create_unique_paths(PlannerInfo *root, RelOptInfo *rel, SpecialJoinInfo *sjinfo)
static bool DatumGetBool(Datum X)
RelOptInfo * find_base_rel(PlannerInfo *root, int relid)
RelOptInfo * build_grouped_rel(PlannerInfo *root, RelOptInfo *rel)
RelOptInfo * build_child_join_rel(PlannerInfo *root, RelOptInfo *outer_rel, RelOptInfo *inner_rel, RelOptInfo *parent_joinrel, List *restrictlist, SpecialJoinInfo *sjinfo, int nappinfos, AppendRelInfo **appinfos)
Relids min_join_parameterization(PlannerInfo *root, Relids joinrelids, RelOptInfo *outer_rel, RelOptInfo *inner_rel)
RelOptInfo * find_join_rel(PlannerInfo *root, Relids relids)
RelOptInfo * build_join_rel(PlannerInfo *root, Relids joinrelids, RelOptInfo *outer_rel, RelOptInfo *inner_rel, SpecialJoinInfo *sjinfo, List *pushed_down_joins, List **restrictlist_ptr)
RelAggInfo * create_rel_agg_info(PlannerInfo *root, RelOptInfo *rel, bool calculate_grouped_rows)
void check_stack_depth(void)
struct PathTarget * target
struct PathTarget * reltarget
struct RelAggInfo * agg_info
Relids lateral_referencers
struct RelOptInfo * grouped_rel
bool consider_partitionwise_join