53 if (rel->
rd_rel->relkind != RELKIND_PARTITIONED_TABLE)
98 elog(
ERROR,
"cache lookup failed for partition key of relation %u",
112 key->strategy = form->partstrat;
113 key->partnatts = form->partnatts;
119 elog(
ERROR,
"invalid partition strategy \"%c\"",
key->strategy);
126 attrs = form->partattrs.values;
131 Anum_pg_partitioned_table_partclass);
136 Anum_pg_partitioned_table_partcollation);
141 Anum_pg_partitioned_table_partexprs, &isnull);
179 key->parttypbyval = (
bool *)
palloc0(
key->partnatts *
sizeof(
bool));
180 key->parttypalign = (
char *)
palloc0(
key->partnatts *
sizeof(
char));
189 memcpy(
key->partattrs, attrs,
key->partnatts *
sizeof(
int16));
191 for (
i = 0;
i <
key->partnatts;
i++)
205 key->partopfamily[
i] = opclassform->opcfamily;
206 key->partopcintype[
i] = opclassform->opcintype;
210 opclassform->opcintype,
211 opclassform->opcintype,
215 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
216 errmsg(
"operator class \"%s\" of access method %s is missing support function %d for type %s",
233 key->parttypid[
i] = att->atttypid;
234 key->parttypmod[
i] = att->atttypmod;
235 key->parttypcoll[
i] = att->attcollation;
239 if (partexprs_item == NULL)
240 elog(
ERROR,
"wrong number of partition key expressions");
246 partexprs_item =
lnext(
key->partexprs, partexprs_item);
250 &
key->parttypbyval[
i],
251 &
key->parttypalign[
i]);
280 if (!rel->
rd_rel->relispartition)
368 elog(
ERROR,
"cache lookup failed for relation %u",
372 Anum_pg_class_relpartbound,
387 if (parent->
rd_rel->relispartition)
415 "partition constraint",
#define TextDatumGetCString(d)
#define Assert(condition)
#define OidIsValid(objectId)
Node * eval_const_expressions(PlannerInfo *root, Node *node)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
void fmgr_info_cxt(Oid functionId, FmgrInfo *finfo, MemoryContext mcxt)
#define HASHEXTENDED_PROC
#define HeapTupleIsValid(tuple)
List * list_concat(List *list1, const List *list2)
bool get_rel_relispartition(Oid relid)
void get_typlenbyvalalign(Oid typid, int16 *typlen, bool *typbyval, char *typalign)
Oid get_opfamily_proc(Oid opfamily, Oid lefttype, Oid righttype, int16 procnum)
Expr * makeBoolExpr(BoolExprType boolop, List *args, int location)
void MemoryContextSetParent(MemoryContext context, MemoryContext new_parent)
void pfree(void *pointer)
void * palloc0(Size size)
void * MemoryContextAllocZero(MemoryContext context, Size size)
MemoryContext CurTransactionContext
MemoryContext CacheMemoryContext
#define AllocSetContextCreate
#define ALLOCSET_SMALL_SIZES
#define MemoryContextCopyAndSetIdentifier(cxt, id)
Oid exprType(const Node *expr)
int32 exprTypmod(const Node *expr)
Oid exprCollation(const Node *expr)
void fix_opfuncids(Node *node)
#define castNode(_type_, nodeptr)
@ PARTITION_STRATEGY_HASH
@ PARTITION_STRATEGY_LIST
@ PARTITION_STRATEGY_RANGE
List * get_qual_from_partbound(Relation parent, PartitionBoundSpec *spec)
Expr * get_partition_qual_relid(Oid relid)
static List * generate_partition_qual(Relation rel)
static void RelationBuildPartitionKey(Relation relation)
List * RelationGetPartitionQual(Relation rel)
PartitionKey RelationGetPartitionKey(Relation rel)
struct PartitionKeyData * PartitionKey
List * map_partition_varattnos(List *expr, int fromrel_varno, Relation to_rel, Relation from_rel)
Oid get_partition_parent(Oid relid, bool even_if_detached)
FormData_pg_attribute * Form_pg_attribute
static int list_length(const List *l)
static ListCell * list_head(const List *l)
static ListCell * lnext(const List *l, const ListCell *c)
FormData_pg_opclass * Form_pg_opclass
FormData_pg_partitioned_table * Form_pg_partitioned_table
void check_stack_depth(void)
static Datum ObjectIdGetDatum(Oid X)
static Pointer DatumGetPointer(Datum X)
MemoryContextSwitchTo(old_ctx)
void * stringToNode(const char *str)
#define RelationGetRelid(relation)
#define RelationGetRelationName(relation)
void relation_close(Relation relation, LOCKMODE lockmode)
Relation relation_open(Oid relationId, LOCKMODE lockmode)
MemoryContext rd_partkeycxt
MemoryContext rd_partcheckcxt
Oid values[FLEXIBLE_ARRAY_MEMBER]
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache1(int cacheId, Datum key1)
Datum SysCacheGetAttr(int cacheId, HeapTuple tup, AttrNumber attributeNumber, bool *isNull)
Datum SysCacheGetAttrNotNull(int cacheId, HeapTuple tup, AttrNumber attributeNumber)
#define TupleDescAttr(tupdesc, i)