Skip to content

Commit d181ab6

Browse files
committed
Support case of adding predicate in ALTER INDEX ... WHERE ...
1 parent 5555351 commit d181ab6

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
@@ -356,7 +356,9 @@ AlterIndex(Oid indexRelationId, IndexStmt *stmt)
356356
relationName = quote_qualified_identifier(get_namespace_name(namespaceId),
357357
get_rel_name(heapRelationId)),
358358
newIndexPredicate = deparse_expression(stmt->whereClause, deparseCtx, false, false);
359-
oldIndexPredicate = deparse_expression((Node*)make_ands_explicit(indexInfo->ii_Predicate), deparseCtx, false, false);
359+
oldIndexPredicate = indexInfo->ii_Predicate
360+
? deparse_expression((Node*)make_ands_explicit(indexInfo->ii_Predicate), deparseCtx, false, false)
361+
: "true";
360362

361363
SPI_connect();
362364

0 commit comments

Comments
 (0)