56 if (rel->
rd_rel->relkind != RELKIND_PARTITIONED_TABLE)
101 elog(
ERROR,
"cache lookup failed for partition key of relation %u",
115 key->strategy = form->partstrat;
116 key->partnatts = form->partnatts;
122 elog(
ERROR,
"invalid partition strategy \"%c\"",
key->strategy);
129 attrs = form->partattrs.values;
134 Anum_pg_partitioned_table_partclass, &isnull);
140 Anum_pg_partitioned_table_partcollation, &isnull);
146 Anum_pg_partitioned_table_partexprs, &isnull);
184 key->parttypbyval = (
bool *)
palloc0(
key->partnatts *
sizeof(
bool));
185 key->parttypalign = (
char *)
palloc0(
key->partnatts *
sizeof(
char));
194 memcpy(
key->partattrs, attrs,
key->partnatts *
sizeof(
int16));
196 for (
i = 0;
i <
key->partnatts;
i++)
210 key->partopfamily[
i] = opclassform->opcfamily;
211 key->partopcintype[
i] = opclassform->opcintype;
215 opclassform->opcintype,
216 opclassform->opcintype,
220 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
221 errmsg(
"operator class \"%s\" of access method %s is missing support function %d for type %s",
238 key->parttypid[
i] = att->atttypid;
239 key->parttypmod[
i] = att->atttypmod;
240 key->parttypcoll[
i] = att->attcollation;
244 if (partexprs_item == NULL)
245 elog(
ERROR,
"wrong number of partition key expressions");
251 partexprs_item =
lnext(
key->partexprs, partexprs_item);
255 &
key->parttypbyval[
i],
256 &
key->parttypalign[
i]);
285 if (!rel->
rd_rel->relispartition)
372 elog(
ERROR,
"cache lookup failed for relation %u",
376 Anum_pg_class_relpartbound,
391 if (parent->
rd_rel->relispartition)
419 "partition constraint",
#define TextDatumGetCString(d)
#define OidIsValid(objectId)
Node * eval_const_expressions(PlannerInfo *root, Node *node)
elog(ERROR, "%s: %s", p2, msg)
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)
Assert(fmt[strlen(fmt) - 1] !='\n')
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)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
@ 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)
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)
#define TupleDescAttr(tupdesc, i)