mirror of https://github.com/citusdata/citus.git
Introduces get_partition_parent_compat and RelationGetPartitionDesc_compat macros
get_partition_parent and RelationGetPartitionDesc functions now have new parameters to also include detached partitions Thess new macros give us the ability to use these new parameter for PG14 and they don't give the parameters for previous versions Existing parameters are set to not accept detached partitions Relevant PG commit: 71f4c8c6f74ba021e55d35b1128d22fb8c6e1629talha_pg14_support
parent
68f896ac0f
commit
2d97bbc25a
|
@ -539,7 +539,7 @@ IsParentTable(Oid relationId)
|
||||||
Oid
|
Oid
|
||||||
PartitionParentOid(Oid partitionOid)
|
PartitionParentOid(Oid partitionOid)
|
||||||
{
|
{
|
||||||
Oid partitionParentOid = get_partition_parent(partitionOid);
|
Oid partitionParentOid = get_partition_parent_compat(partitionOid, false);
|
||||||
|
|
||||||
return partitionParentOid;
|
return partitionParentOid;
|
||||||
}
|
}
|
||||||
|
@ -590,7 +590,7 @@ PartitionList(Oid parentRelationId)
|
||||||
|
|
||||||
ereport(ERROR, (errmsg("\"%s\" is not a parent table", relationName)));
|
ereport(ERROR, (errmsg("\"%s\" is not a parent table", relationName)));
|
||||||
}
|
}
|
||||||
PartitionDesc partDesc = RelationGetPartitionDesc(rel);
|
PartitionDesc partDesc = RelationGetPartitionDesc_compat(rel, true);
|
||||||
Assert(partDesc != NULL);
|
Assert(partDesc != NULL);
|
||||||
|
|
||||||
int partitionCount = partDesc->nparts;
|
int partitionCount = partDesc->nparts;
|
||||||
|
@ -623,7 +623,7 @@ GenerateDetachPartitionCommand(Oid partitionTableId)
|
||||||
ereport(ERROR, (errmsg("\"%s\" is not a partition", relationName)));
|
ereport(ERROR, (errmsg("\"%s\" is not a partition", relationName)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Oid parentId = get_partition_parent(partitionTableId);
|
Oid parentId = get_partition_parent_compat(partitionTableId, false);
|
||||||
char *tableQualifiedName = generate_qualified_relation_name(partitionTableId);
|
char *tableQualifiedName = generate_qualified_relation_name(partitionTableId);
|
||||||
char *parentTableQualifiedName = generate_qualified_relation_name(parentId);
|
char *parentTableQualifiedName = generate_qualified_relation_name(parentId);
|
||||||
|
|
||||||
|
@ -717,7 +717,7 @@ GenerateAlterTableAttachPartitionCommand(Oid partitionTableId)
|
||||||
ereport(ERROR, (errmsg("\"%s\" is not a partition", relationName)));
|
ereport(ERROR, (errmsg("\"%s\" is not a partition", relationName)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Oid parentId = get_partition_parent(partitionTableId);
|
Oid parentId = get_partition_parent_compat(partitionTableId, false);
|
||||||
char *tableQualifiedName = generate_qualified_relation_name(partitionTableId);
|
char *tableQualifiedName = generate_qualified_relation_name(partitionTableId);
|
||||||
char *parentTableQualifiedName = generate_qualified_relation_name(parentId);
|
char *parentTableQualifiedName = generate_qualified_relation_name(parentId);
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,8 @@
|
||||||
#define SetTuplestoreDestReceiverParams_compat(a, b, c, d, e, f) \
|
#define SetTuplestoreDestReceiverParams_compat(a, b, c, d, e, f) \
|
||||||
SetTuplestoreDestReceiverParams(a, b, c, d, e, f)
|
SetTuplestoreDestReceiverParams(a, b, c, d, e, f)
|
||||||
#define pgproc_statusflags_compat(pgproc) ((pgproc)->statusFlags)
|
#define pgproc_statusflags_compat(pgproc) ((pgproc)->statusFlags)
|
||||||
|
#define get_partition_parent_compat(a, b) get_partition_parent(a, b)
|
||||||
|
#define RelationGetPartitionDesc_compat(a, b) RelationGetPartitionDesc(a, b)
|
||||||
#else
|
#else
|
||||||
#define AlterTableStmtObjType(a) ((a)->relkind)
|
#define AlterTableStmtObjType(a) ((a)->relkind)
|
||||||
#define F_NEXTVAL_COMPAT F_NEXTVAL_OID
|
#define F_NEXTVAL_COMPAT F_NEXTVAL_OID
|
||||||
|
@ -89,6 +91,8 @@
|
||||||
SetTuplestoreDestReceiverParams(a, b, c, d)
|
SetTuplestoreDestReceiverParams(a, b, c, d)
|
||||||
#define pgproc_statusflags_compat(pgproc) \
|
#define pgproc_statusflags_compat(pgproc) \
|
||||||
((&ProcGlobal->allPgXact[(pgproc)->pgprocno])->vacuumFlags)
|
((&ProcGlobal->allPgXact[(pgproc)->pgprocno])->vacuumFlags)
|
||||||
|
#define get_partition_parent_compat(a, b) get_partition_parent(a)
|
||||||
|
#define RelationGetPartitionDesc_compat(a, b) RelationGetPartitionDesc(a)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if PG_VERSION_NUM >= PG_VERSION_13
|
#if PG_VERSION_NUM >= PG_VERSION_13
|
||||||
|
|
Loading…
Reference in New Issue