pgsql: Fix handling of pg_class.relispartition at swap phase in REINDEX

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix handling of pg_class.relispartition at swap phase in REINDEX
Date: 2019-10-29 02:10:34
Message-ID: E1iPGxu-0006Qx-Gf@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix handling of pg_class.relispartition at swap phase in REINDEX CONCURRENTLY

When cancelling REINDEX CONCURRENTLY after swapping the old and new
indexes (for example interruption at step 5), the old index remains
around and is marked as invalid. The old index should also be manually
droppable to clean up the parent relation from any invalid indexes still
remaining. For a partition index reindexed, pg_class.relispartition was
not getting updated, causing the index to not be droppable as DROP INDEX
would look for dependencies in a partition tree, which do not exist
anymore after the swap phase is done.

The fix here is simple: when swapping the old and new indexes, make sure
that pg_class.relispartition is correctly switched, similarly to what is
done for the index name.

Reported-by: Justin Pryzby
Author: Michael Paquier
Discussion: https://postgr.es/m/20191015164047.GA22729@telsasoft.com
Backpatch-through: 12

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d80be6f2f6c9793b92fc87c61d9ae2bcea3db560

Modified Files
--------------
src/backend/catalog/index.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2019-10-29 08:38:32 pgsql: Fix compiler warnings in ecpg tests
Previous Message Tom Lane 2019-10-28 19:08:30 pgsql: Allow extracting fields from a ROW() expression in more cases.