mirror of https://github.com/citusdata/citus.git
Remove get_relation_constraint_oid_compat
parent
47e28a4faf
commit
a1e0511583
|
@ -76,7 +76,6 @@ static void ForeignConstraintFindDistKeys(HeapTuple pgConstraintTuple,
|
||||||
int *referencedAttrIndex);
|
int *referencedAttrIndex);
|
||||||
static List * GetForeignKeyIdsForColumn(char *columnName, Oid relationId,
|
static List * GetForeignKeyIdsForColumn(char *columnName, Oid relationId,
|
||||||
int searchForeignKeyColumnFlags);
|
int searchForeignKeyColumnFlags);
|
||||||
static Oid get_relation_constraint_oid_compat(HeapTuple heapTuple);
|
|
||||||
static List * GetForeignKeysWithLocalTables(Oid relationId);
|
static List * GetForeignKeysWithLocalTables(Oid relationId);
|
||||||
static bool IsTableTypeIncluded(Oid relationId, int flags);
|
static bool IsTableTypeIncluded(Oid relationId, int flags);
|
||||||
static void UpdateConstraintIsValid(Oid constraintId, bool isValid);
|
static void UpdateConstraintIsValid(Oid constraintId, bool isValid);
|
||||||
|
@ -600,9 +599,8 @@ GetForeignKeyIdsForColumn(char *columnName, Oid relationId,
|
||||||
if (HeapTupleOfForeignConstraintIncludesColumn(heapTuple, relationId,
|
if (HeapTupleOfForeignConstraintIncludesColumn(heapTuple, relationId,
|
||||||
pgConstraintKey, columnName))
|
pgConstraintKey, columnName))
|
||||||
{
|
{
|
||||||
Oid foreignKeyOid = get_relation_constraint_oid_compat(heapTuple);
|
|
||||||
foreignKeyIdsColumnAppeared = lappend_oid(foreignKeyIdsColumnAppeared,
|
foreignKeyIdsColumnAppeared = lappend_oid(foreignKeyIdsColumnAppeared,
|
||||||
foreignKeyOid);
|
constraintForm->oid);
|
||||||
}
|
}
|
||||||
|
|
||||||
heapTuple = systable_getnext(scanDescriptor);
|
heapTuple = systable_getnext(scanDescriptor);
|
||||||
|
@ -701,26 +699,6 @@ GetForeignConstraintCommandsInternal(Oid relationId, int flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* get_relation_constraint_oid_compat returns OID of the constraint represented
|
|
||||||
* by the constraintForm, which is passed as an heapTuple. OID of the contraint
|
|
||||||
* is already stored in the constraintForm struct if major PostgreSQL version is
|
|
||||||
* 12. However, in the older versions, we should utilize HeapTupleGetOid to deduce
|
|
||||||
* that OID with no cost.
|
|
||||||
*/
|
|
||||||
static Oid
|
|
||||||
get_relation_constraint_oid_compat(HeapTuple heapTuple)
|
|
||||||
{
|
|
||||||
Assert(heapTuple != NULL);
|
|
||||||
|
|
||||||
|
|
||||||
Form_pg_constraint constraintForm = (Form_pg_constraint) GETSTRUCT(heapTuple);
|
|
||||||
Oid constraintOid = constraintForm->oid;
|
|
||||||
|
|
||||||
return constraintOid;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* HasForeignKeyWithLocalTable returns true if relation has foreign key
|
* HasForeignKeyWithLocalTable returns true if relation has foreign key
|
||||||
* relationship with a local table.
|
* relationship with a local table.
|
||||||
|
@ -1050,7 +1028,7 @@ GetForeignKeyOids(Oid relationId, int flags)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Oid constraintId = get_relation_constraint_oid_compat(heapTuple);
|
Oid constraintId = constraintForm->oid;
|
||||||
|
|
||||||
bool isSelfReference = (constraintForm->conrelid == constraintForm->confrelid);
|
bool isSelfReference = (constraintForm->conrelid == constraintForm->confrelid);
|
||||||
if (excludeSelfReference && isSelfReference)
|
if (excludeSelfReference && isSelfReference)
|
||||||
|
|
Loading…
Reference in New Issue