Move pre undistribute_table chekcs into C API (#4456)

pull/4474/head
Onur Tirtir 2021-01-06 10:49:35 +03:00 committed by GitHub
parent 1f36ff7c17
commit 0d7aea3a22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -291,9 +291,6 @@ undistribute_table(PG_FUNCTION_ARGS)
Oid relationId = PG_GETARG_OID(0);
CheckCitusVersion(ERROR);
EnsureCoordinator();
EnsureRelationExists(relationId);
EnsureTableOwner(relationId);
UndistributeTable(relationId);
@ -1557,7 +1554,12 @@ DistributionColumnUsesGeneratedStoredColumn(TupleDesc relationDesc,
void
UndistributeTable(Oid relationId)
{
Relation relation = try_relation_open(relationId, ExclusiveLock);
EnsureCoordinator();
EnsureRelationExists(relationId);
EnsureTableOwner(relationId);
LOCKMODE lockMode = ExclusiveLock;
Relation relation = try_relation_open(relationId, lockMode);
if (relation == NULL)
{
ereport(ERROR, (errmsg("cannot undistribute table"),