52 List *new_restrictlist);
133 Assert(child_relid < size);
136 elog(
ERROR,
"child relation already exists");
200 Assert(relid > 0 && relid < root->simple_rel_array_size);
202 elog(
ERROR,
"rel %d already exists", relid);
380 if (relid < root->simple_rel_array_size)
387 elog(
ERROR,
"no relation entry for relid %d", relid);
581 List **restrictlist_ptr)
600 if (restrictlist_ptr)
632 outer_rel, inner_rel);
709 outer_rel, inner_rel);
710 if (restrictlist_ptr)
711 *restrictlist_ptr = restrictlist;
728 sjinfo, restrictlist);
865 nappinfos, appinfos);
895 sjinfo, restrictlist);
912 parent_joinrel, joinrel);
996 elog(
ERROR,
"unexpected node type in rel targetlist: %d",
1106 List *joininfo_list,
1107 List *new_restrictlist)
1111 foreach(l, joininfo_list)
1135 return new_restrictlist;
1140 List *joininfo_list,
1148 foreach(l, joininfo_list)
1173 return new_joininfo;
1313 pclauses =
lappend(pclauses, rinfo);
1373 List **restrict_clauses)
1408 outer_and_req = NULL;
1413 inner_and_req = NULL;
1429 pclauses =
lappend(pclauses, rinfo);
1439 foreach(lc, eclauses)
1468 pclauses =
lappend(pclauses, rinfo);
1503 Relids real_outer_and_req;
1513 foreach(lc, eclauses)
1521 real_outer_and_req));
1526 pclauses =
lappend(pclauses, rinfo);
1535 *restrict_clauses =
list_concat(pclauses, *restrict_clauses);
1658 jointype, restrictlist))
1717 memset(pk_has_clause, 0,
sizeof(pk_has_clause));
1718 foreach(lc, restrictlist)
1799 pk_has_clause[ipk1] =
true;
1803 for (cnt_pks = 0; cnt_pks < part_scheme->
partnatts; cnt_pks++)
1805 if (!pk_has_clause[cnt_pks])
1890 for (
int cnt = 0; cnt < partnatts; cnt++)
1898 List *nullable_partexpr =
NIL;
1928 nullable_partexpr =
list_copy(outer_null_expr);
1942 nullable_partexpr =
list_concat(nullable_partexpr,
1955 nullable_partexpr =
list_concat(nullable_partexpr,
1957 nullable_partexpr =
list_concat(nullable_partexpr,
1993 nullable_partexpr =
lappend(nullable_partexpr, c);
1999 elog(
ERROR,
"unrecognized join type: %d", (
int) jointype);
2022 nappinfos, appinfos);
#define list_make2(x1, x2)
struct Path * cheapest_unique_path
PathTarget * create_empty_pathtarget(void)
bool op_in_opfamily(Oid opno, Oid opfamily)
ParamPathInfo * find_param_path_info(RelOptInfo *rel, Relids required_outer)
#define IsA(nodeptr, _type_)
Bitmapset * bms_copy(const Bitmapset *a)
ParamPathInfo * get_baserel_parampathinfo(PlannerInfo *root, RelOptInfo *baserel, Relids required_outer)
RelOptInfo * find_join_rel(PlannerInfo *root, Relids relids)
ParamPathInfo * get_joinrel_parampathinfo(PlannerInfo *root, RelOptInfo *joinrel, Path *outer_path, Path *inner_path, SpecialJoinInfo *sjinfo, Relids required_outer, List **restrict_clauses)
bool equal(const void *a, const void *b)
#define castNode(_type_, nodeptr)
static List * subbuild_joinrel_restrictlist(RelOptInfo *joinrel, List *joininfo_list, List *new_restrictlist)
static void set_joinrel_partition_key_exprs(RelOptInfo *joinrel, RelOptInfo *outer_rel, RelOptInfo *inner_rel, JoinType jointype)
#define IS_OTHER_REL(rel)
void set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel, RelOptInfo *outer_rel, RelOptInfo *inner_rel, SpecialJoinInfo *sjinfo, List *restrictlist)
struct Path * cheapest_startup_path
bool consider_param_startup
#define IS_OUTER_JOIN(jointype)
ParamPathInfo * param_info
List * list_copy(const List *oldlist)
List * list_concat(List *list1, const List *list2)
#define PARTITION_MAX_KEYS
#define MemSet(start, val, len)
EquivalenceClass * right_ec
List * cheapest_parameterized_paths
Index baserestrict_min_security
void * hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, bool *foundPtr)
List ** nullable_partexprs
#define OidIsValid(objectId)
void add_placeholders_to_joinrel(PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *outer_rel, RelOptInfo *inner_rel)
struct RelOptInfo ** simple_rel_array
void add_child_join_rel_equivalences(PlannerInfo *root, int nappinfos, AppendRelInfo **appinfos, RelOptInfo *parent_joinrel, RelOptInfo *child_joinrel)
bool apply_child_basequals(PlannerInfo *root, RelOptInfo *parentrel, RelOptInfo *childrel, RangeTblEntry *childRTE, AppendRelInfo *appinfo)
bool is_parallel_safe(PlannerInfo *root, Node *node)
static void set_foreign_rel_properties(RelOptInfo *joinrel, RelOptInfo *outer_rel, RelOptInfo *inner_rel)
struct JoinHashEntry JoinHashEntry
void pfree(void *pointer)
static void build_joinrel_tlist(PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *input_rel)
List * list_append_unique_ptr(List *list, void *datum)
List * generate_join_implied_equalities(PlannerInfo *root, Relids join_relids, Relids outer_relids, RelOptInfo *inner_rel)
Relids min_join_parameterization(PlannerInfo *root, Relids joinrelids, RelOptInfo *outer_rel, RelOptInfo *inner_rel)
RelOptInfo * build_child_join_rel(PlannerInfo *root, RelOptInfo *outer_rel, RelOptInfo *inner_rel, RelOptInfo *parent_joinrel, List *restrictlist, SpecialJoinInfo *sjinfo, JoinType jointype)
bool bms_is_subset(const Bitmapset *a, const Bitmapset *b)
RelOptInfo * fetch_upper_rel(PlannerInfo *root, UpperRelationKind kind, Relids relids)
#define lfirst_node(type, lc)
int bms_num_members(const Bitmapset *a)
double get_parameterized_joinrel_size(PlannerInfo *root, RelOptInfo *rel, Path *outer_path, Path *inner_path, SpecialJoinInfo *sjinfo, List *restrict_clauses)
struct Path * cheapest_total_path
static List * build_joinrel_restrictlist(PlannerInfo *root, RelOptInfo *joinrel, RelOptInfo *outer_rel, RelOptInfo *inner_rel)
#define PATH_REQ_OUTER(path)
Bitmapset * bms_make_singleton(int x)
static int match_expr_to_partition_keys(Expr *expr, RelOptInfo *rel, bool strict_op)
List * list_concat_copy(const List *list1, const List *list2)
struct FdwRoutine * fdwroutine
HTAB * hash_create(const char *tabname, long nelem, const HASHCTL *info, int flags)
RelOptInfo * build_simple_rel(PlannerInfo *root, int relid, RelOptInfo *parent)
MemoryContext CurrentMemoryContext
bool has_relevant_eclass_joinclause(PlannerInfo *root, RelOptInfo *rel1)
int simple_rel_array_size
List * non_unique_for_rels
bool join_clause_is_movable_into(RestrictInfo *rinfo, Relids currentrelids, Relids current_and_outer)
List * lappend(List *list, void *datum)
RangeTblEntry ** simple_rte_array
AppendRelInfo ** find_appinfos_by_relids(PlannerInfo *root, Relids relids, int *nappinfos)
Relids lateral_referencers
bool bms_is_empty(const Bitmapset *a)
Relids direct_lateral_relids
bool consider_partitionwise_join
int bitmap_match(const void *key1, const void *key2, Size keysize)
void * palloc0(Size size)
List * generate_join_implied_equalities_for_ecs(PlannerInfo *root, List *eclasses, Relids join_relids, Relids outer_relids, RelOptInfo *inner_rel)
void mark_dummy_rel(RelOptInfo *rel)
struct AppendRelInfo ** append_rel_array
Size add_size(Size s1, Size s2)
double get_parameterized_baserel_size(PlannerInfo *root, RelOptInfo *rel, List *param_clauses)
struct PartitionBoundInfoData * boundinfo
RelOptInfo * build_join_rel(PlannerInfo *root, Relids joinrelids, RelOptInfo *outer_rel, RelOptInfo *inner_rel, SpecialJoinInfo *sjinfo, List **restrictlist_ptr)
#define PARTITION_STRATEGY_HASH
Relids find_childrel_parents(PlannerInfo *root, RelOptInfo *rel)
#define RINFO_IS_PUSHED_DOWN(rinfo, joinrelids)
static void build_join_rel_hash(PlannerInfo *root)
bool list_member_oid(const List *list, Oid datum)
#define Assert(condition)
void setup_simple_rel_arrays(PlannerInfo *root)
struct RelOptInfo ** part_rels
Bitmapset * bms_union(const Bitmapset *a, const Bitmapset *b)
bool enable_partitionwise_join
Oid exprType(const Node *expr)
static int list_length(const List *l)
Oid exprCollation(const Node *expr)
struct HTAB * join_rel_hash
Bitmapset * bms_add_member(Bitmapset *a, int x)
void * repalloc(void *pointer, Size size)
Bitmapset * bms_del_members(Bitmapset *a, const Bitmapset *b)
bool bms_overlap(const Bitmapset *a, const Bitmapset *b)
void expand_planner_arrays(PlannerInfo *root, int add_size)
EquivalenceClass * left_ec
static List * subbuild_joinrel_joinlist(RelOptInfo *joinrel, List *joininfo_list, List *new_joininfo)
#define IS_PARTITIONED_REL(rel)
static void build_joinrel_partition_info(RelOptInfo *joinrel, RelOptInfo *outer_rel, RelOptInfo *inner_rel, List *restrictlist, JoinType jointype)
uint32 bitmap_hash(const void *key, Size keysize)
bool has_useful_pathkeys(PlannerInfo *root, RelOptInfo *rel)
PartitionScheme part_scheme
ParamPathInfo * get_appendrel_parampathinfo(RelOptInfo *appendrel, Relids required_outer)
RelOptInfo * find_base_rel(PlannerInfo *root, int relid)
struct PathTarget * reltarget
QualCost baserestrictcost
static void add_join_rel(PlannerInfo *root, RelOptInfo *joinrel)
static void build_child_join_reltarget(PlannerInfo *root, RelOptInfo *parentrel, RelOptInfo *childrel, int nappinfos, AppendRelInfo **appinfos)
Bitmapset * eclass_indexes
static void build_joinrel_joinlist(RelOptInfo *joinrel, RelOptInfo *outer_rel, RelOptInfo *inner_rel)
void get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent, RelOptInfo *rel)
bool bms_equal(const Bitmapset *a, const Bitmapset *b)
static bool have_partkey_equi_join(RelOptInfo *joinrel, RelOptInfo *rel1, RelOptInfo *rel2, JoinType jointype, List *restrictlist)
Node * adjust_appendrel_attrs(PlannerInfo *root, Node *node, int nappinfos, AppendRelInfo **appinfos)
bool bms_nonempty_difference(const Bitmapset *a, const Bitmapset *b)
List * upper_rels[UPPERREL_FINAL+1]