Skip to content

Commit 2dac382

Browse files
knizhnikkelvich
authored andcommitted
Support case of adding predicate in ALTER INDEX ... WHERE ...
1 parent e1ca281 commit 2dac382

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/backend/commands/indexcmds.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,9 @@ AlterIndex(Oid indexRelationId, IndexStmt *stmt)
361361
relationName = quote_qualified_identifier(get_namespace_name(namespaceId),
362362
get_rel_name(heapRelationId)),
363363
newIndexPredicate = deparse_expression(stmt->whereClause, deparseCtx, false, false);
364-
oldIndexPredicate = deparse_expression((Node*)make_ands_explicit(indexInfo->ii_Predicate), deparseCtx, false, false);
364+
oldIndexPredicate = indexInfo->ii_Predicate
365+
? deparse_expression((Node*)make_ands_explicit(indexInfo->ii_Predicate), deparseCtx, false, false)
366+
: "true";
365367

366368
SPI_connect();
367369

0 commit comments

Comments
 (0)