From a218198e8faa27333e7113653bb97f1271130a01 Mon Sep 17 00:00:00 2001 From: aykut-bozkurt <51649454+aykut-bozkurt@users.noreply.github.com> Date: Thu, 28 Jul 2022 15:31:49 +0300 Subject: [PATCH] reindex object address should return invalid addresses for unsepported object types in reindex stmt (#6096) --- src/backend/distributed/commands/index.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/backend/distributed/commands/index.c b/src/backend/distributed/commands/index.c index d424d6a3c..8fef77dc0 100644 --- a/src/backend/distributed/commands/index.c +++ b/src/backend/distributed/commands/index.c @@ -654,14 +654,21 @@ PreprocessReindexStmt(Node *node, const char *reindexCommand, /* * ReindexStmtObjectAddress returns list of object addresses in the reindex - * statement. + * statement. We add the address if the object is either index or table; + * else, we add invalid address. */ List * ReindexStmtObjectAddress(Node *stmt, bool missing_ok) { ReindexStmt *reindexStatement = castNode(ReindexStmt, stmt); - Oid relationId = ReindexStmtFindRelationOid(reindexStatement, missing_ok); + Oid relationId = InvalidOid; + if (reindexStatement->relation != NULL) + { + /* we currently only support reindex commands on tables */ + relationId = ReindexStmtFindRelationOid(reindexStatement, missing_ok); + } + ObjectAddress *objectAddress = palloc0(sizeof(ObjectAddress)); ObjectAddressSet(*objectAddress, RelationRelationId, relationId);