27 #include "utils/fmgroids.h"
74 Assert(rel->
rd_rel->relkind == RELKIND_PARTITIONED_TABLE);
142 bool *is_leaf = NULL;
160 detached_exist =
false;
173 is_leaf = (
bool *)
palloc(nparts *
sizeof(
bool));
179 foreach(cell, inhoids)
193 Anum_pg_class_relpartbound,
214 if (boundspec == NULL)
240 elog(
ERROR,
"missing relpartbound for relation %u", inhrelid);
242 elog(
ERROR,
"invalid relpartbound for relation %u", inhrelid);
254 if (partdefid != inhrelid)
255 elog(
ERROR,
"expected partdefid %u, but got %u",
256 inhrelid, partdefid);
262 boundspecs[
i] = boundspec;
279 "partition descriptor",
286 partdesc->
nparts = nparts;
309 for (
i = 0;
i < nparts;
i++)
#define TextDatumGetCString(d)
elog(ERROR, "%s: %s", p2, msg)
void * hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, bool *foundPtr)
HTAB * hash_create(const char *tabname, long nelem, const HASHCTL *info, int flags)
void * hash_seq_search(HASH_SEQ_STATUS *status)
void hash_seq_init(HASH_SEQ_STATUS *status, HTAB *hashp)
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)
#define HeapTupleIsValid(tuple)
static Datum heap_getattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
Assert(fmt[strlen(fmt) - 1] !='\n')
char get_rel_relkind(Oid relid)
void MemoryContextSetParent(MemoryContext context, MemoryContext new_parent)
void * MemoryContextAllocZero(MemoryContext context, Size size)
MemoryContext CurTransactionContext
MemoryContext CacheMemoryContext
#define AllocSetContextCreate
#define ALLOCSET_SMALL_SIZES
#define MemoryContextCopyAndSetIdentifier(cxt, id)
#define IsA(nodeptr, _type_)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
PartitionBoundInfo partition_bounds_create(PartitionBoundSpec **boundspecs, int nparts, PartitionKey key, int **mapping)
PartitionBoundInfo partition_bounds_copy(PartitionBoundInfo src, PartitionKey key)
#define partition_bound_has_default(bi)
PartitionKey RelationGetPartitionKey(Relation rel)
PartitionDirectory CreatePartitionDirectory(MemoryContext mcxt, bool omit_detached)
void DestroyPartitionDirectory(PartitionDirectory pdir)
PartitionDesc PartitionDirectoryLookup(PartitionDirectory pdir, Relation rel)
PartitionDesc RelationGetPartitionDesc(Relation rel, bool omit_detached)
static PartitionDesc RelationBuildPartitionDesc(Relation rel, bool omit_detached)
Oid get_default_oid_from_partdesc(PartitionDesc partdesc)
struct PartitionDirectoryEntry PartitionDirectoryEntry
struct PartitionDirectoryData PartitionDirectoryData
Oid get_default_partition_oid(Oid parentId)
List * find_inheritance_children_extended(Oid parentrelId, bool omit_detached, LOCKMODE lockmode, bool *detached_exist, TransactionId *detached_xmin)
static int list_length(const List *l)
static Datum ObjectIdGetDatum(Oid X)
void * stringToNode(const char *str)
#define RelationGetRelid(relation)
#define RelationGetDescr(relation)
#define RelationGetRelationName(relation)
void RelationDecrementReferenceCount(Relation rel)
void RelationIncrementReferenceCount(Relation rel)
void ScanKeyInit(ScanKey entry, AttrNumber attributeNumber, StrategyNumber strategy, RegProcedure procedure, Datum argument)
bool XidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
bool ActiveSnapshotSet(void)
Snapshot GetActiveSnapshot(void)
#define BTEqualStrategyNumber
int last_found_datum_index
PartitionBoundInfo boundinfo
int last_found_part_index
TransactionId rd_partdesc_nodetached_xmin
PartitionDesc rd_partdesc
PartitionDesc rd_partdesc_nodetached
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
Datum SysCacheGetAttr(int cacheId, HeapTuple tup, AttrNumber attributeNumber, bool *isNull)
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)
#define InvalidTransactionId
#define TransactionIdIsValid(xid)