Drop sequence metadata from workers explicitly

pull/5415/head
Burak Velioglu 2021-12-02 00:09:19 +03:00
parent 21194c3b9d
commit e8534c1dd5
No known key found for this signature in database
GPG Key ID: F6827E620F6549C6
1 changed files with 15 additions and 0 deletions

View File

@ -81,6 +81,21 @@ worker_drop_distributed_table(PG_FUNCTION_ARGS)
distributedTableObject.objectId = relationId;
distributedTableObject.objectSubId = 0;
/* Drop dependent sequences from pg_dist_object */
#if PG_VERSION_NUM >= PG_VERSION_13
List *ownedSequences = getOwnedSequences(relationId);
#else
List *ownedSequences = getOwnedSequences(relationId, InvalidAttrNumber);
#endif
Oid ownedSequenceOid = InvalidOid;
foreach_oid(ownedSequenceOid, ownedSequences)
{
ObjectAddress ownedSequenceAddress = { 0 };
ObjectAddressSet(ownedSequenceAddress, RelationRelationId, ownedSequenceOid);
UnmarkObjectDistributed(&ownedSequenceAddress);
}
/* drop the server for the foreign relations */
if (relationKind == RELKIND_FOREIGN_TABLE)
{