reindex object address should return invalid addresses for unsepported object types in reindex stmt (#6096)

pull/6101/head
aykut-bozkurt 2022-07-28 15:31:49 +03:00 committed by GitHub
parent e001ef76cf
commit a218198e8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 2 deletions

View File

@ -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);