PATCH: Issue with set_indexsafe_procflags in ReindexRelationConcurrently

From: Michail Nikolaev <michail(dot)nikolaev(at)gmail(dot)com>
To: alvherre(at)alvh(dot)no-ip(dot)org, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: PATCH: Issue with set_indexsafe_procflags in ReindexRelationConcurrently
Date: 2024-09-06 11:27:12
Message-ID: CANtu0oj9A3kZVduFTG0vrmGnKB+DCHgEpzOp0qAyOgmks84j0w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello!

While working on [1], I have found a small issue with correctness
of set_indexsafe_procflags usage in ReindexRelationConcurrently introduced
in [2].

> idx->safe = (indexRel->rd_indexprs == NIL && indexRel->rd_indpred == NIL);

It is always true because there are no RelationGetIndexExpressions
and RelationGetIndexPredicate before that check.

Two patches with reproducer + fix are attached.

The issue is simple, but I'll register this in commitfest just in case.

Best regards,
Mikhail.

[1]:
https://www.postgresql.org/message-id/flat/CANtu0ogBOtd9ravu1CUbuZWgq6qvn1rny38PGKDPk9zzQPH8_A%40mail.gmail.com#d4be02ff70f3002522f9fadbd165d631
[2]:
https://github.com/postgres/postgres/commit/f9900df5f94936067e6fa24a9df609863eb08da2

Attachment Content-Type Size
v1-0001-specification-to-reproduce-issue-with-incorrect-u.patch text/x-patch 3.9 KB
v1-0002-Ensure-the-correct-determination-of-index-safety-.patch text/x-patch 1.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michail Nikolaev 2024-09-06 11:39:54 Re: PATCH: Issue with set_indexsafe_procflags in ReindexRelationConcurrently
Previous Message vignesh C 2024-09-06 11:18:51 Re: Invalid Assert while validating REPLICA IDENTITY?