29 #include "utils/fmgroids.h"
35 bool *detach_pending);
65 elog(
ERROR,
"could not find tuple for parent of relation %u", relid);
67 if (detach_pending && !even_if_detached)
68 elog(
ERROR,
"relation %u has no parent because it's being detached",
92 *detach_pending =
false;
95 Anum_pg_inherits_inhrelid,
99 Anum_pg_inherits_inhseqno,
111 if (form->inhdetachpending)
112 *detach_pending =
true;
113 result = form->inhparent;
163 if (parentOid ==
InvalidOid || detach_pending)
190 elog(
ERROR,
"cache lookup failed for relation %u", partIdx);
192 ispartition = classForm->relispartition;
228 bool found_whole_row;
263 if (attnums == NULL || rel->
rd_rel->relkind != RELKIND_PARTITIONED_TABLE)
271 for (
i = 0;
i < partnatts;
i++)
281 *used_in_expr =
false;
293 partexprs_item =
lnext(partexprs, partexprs_item);
298 *used_in_expr =
true;
327 defaultPartId = part_table_form->partdefid;
331 return defaultPartId;
351 elog(
ERROR,
"cache lookup failed for partition key of relation %u",
355 part_table_form->partdefid = defaultPartId;
372 Expr *defPartConstraint;
388 (
Node *) defPartConstraint);
AttrMap * build_attrmap_by_name(TupleDesc indesc, TupleDesc outdesc, bool missing_ok)
bool bms_is_member(int x, const Bitmapset *a)
bool bms_overlap(const Bitmapset *a, const Bitmapset *b)
#define OidIsValid(objectId)
Node * eval_const_expressions(PlannerInfo *root, Node *node)
void systable_endscan(SysScanDesc sysscan)
HeapTuple systable_getnext(SysScanDesc sysscan)
SysScanDesc systable_beginscan(Relation heapRelation, Oid indexId, bool indexOK, Snapshot snapshot, int nkeys, ScanKey key)
void heap_freetuple(HeapTuple htup)
#define HeapTupleIsValid(tuple)
void CatalogTupleUpdate(Relation heapRel, ItemPointer otid, HeapTuple tup)
List * lappend_oid(List *list, Oid datum)
void list_free(List *list)
List * make_ands_implicit(Expr *clause)
Expr * make_ands_explicit(List *andclauses)
Expr * makeBoolExpr(BoolExprType boolop, List *args, int location)
PartitionKey RelationGetPartitionKey(Relation rel)
static int16 get_partition_col_attnum(PartitionKey key, int col)
static int get_partition_natts(PartitionKey key)
static List * get_partition_exprs(PartitionKey key)
List * get_partition_ancestors(Oid relid)
bool has_partition_attrs(Relation rel, Bitmapset *attnums, bool *used_in_expr)
List * map_partition_varattnos(List *expr, int fromrel_varno, Relation to_rel, Relation from_rel)
List * get_proposed_default_constraint(List *new_part_constraints)
void update_default_partition_oid(Oid parentId, Oid defaultPartId)
Oid get_default_partition_oid(Oid parentId)
Oid index_get_partition(Relation partition, Oid indexId)
Oid get_partition_parent(Oid relid, bool even_if_detached)
static Oid get_partition_parent_worker(Relation inhRel, Oid relid, bool *detach_pending)
static void get_partition_ancestors_worker(Relation inhRel, Oid relid, List **ancestors)
FormData_pg_class * Form_pg_class
FormData_pg_inherits * Form_pg_inherits
static ListCell * list_head(const List *l)
static ListCell * lnext(const List *l, const ListCell *c)
FormData_pg_partitioned_table * Form_pg_partitioned_table
static Datum ObjectIdGetDatum(Oid X)
static Datum Int32GetDatum(int32 X)
Expr * canonicalize_qual(Expr *qual, bool is_check)
#define RelationGetForm(relation)
#define RelationGetDescr(relation)
List * RelationGetIndexList(Relation relation)
Node * map_variable_attnos(Node *node, int target_varno, int sublevels_up, const AttrMap *attno_map, Oid to_rowtype, bool *found_whole_row)
void ScanKeyInit(ScanKey entry, AttrNumber attributeNumber, StrategyNumber strategy, RegProcedure procedure, Datum argument)
#define BTEqualStrategyNumber
#define FirstLowInvalidHeapAttributeNumber
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
#define SearchSysCacheCopy1(cacheId, key1)
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)
void pull_varattnos(Node *node, Index varno, Bitmapset **varattnos)