From b67abdd28c56c97014cab0d85b5b8ff958e86429 Mon Sep 17 00:00:00 2001 From: aykut-bozkurt <51649454+aykut-bozkurt@users.noreply.github.com> Date: Thu, 4 Aug 2022 15:49:14 +0300 Subject: [PATCH] we should not log error in preprocess if attached partition is missing. (#6131) --- src/backend/distributed/commands/table.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/backend/distributed/commands/table.c b/src/backend/distributed/commands/table.c index d8fb4f59d..1cf1e54a5 100644 --- a/src/backend/distributed/commands/table.c +++ b/src/backend/distributed/commands/table.c @@ -439,9 +439,18 @@ PreprocessAlterTableStmtAttachPartition(AlterTableStmt *alterTableStatement, Oid parentRelationId = AlterTableLookupRelation(alterTableStatement, lockmode); PartitionCmd *partitionCommand = (PartitionCmd *) alterTableCommand->def; - bool partitionMissingOk = false; + bool partitionMissingOk = true; Oid partitionRelationId = RangeVarGetRelid(partitionCommand->name, lockmode, partitionMissingOk); + if (!OidIsValid(partitionRelationId)) + { + /* + * We can stop propagation here instead of logging error. Pg will complain + * in standard_utility, so we are safe to stop here. We pass missing_ok + * as true to not diverge from pg output. + */ + return NIL; + } if (!IsCitusTable(parentRelationId)) {