From 164f25122bc2170218828606b9466b873b1ce67b Mon Sep 17 00:00:00 2001
From: Mohamed ALi <moali.pg@gmail.com>
Date: Wed, 29 Apr 2026 13:54:40 -0700
Subject: [PATCH] doc: Document parent index validation in ALTER INDEX ATTACH
 PARTITION

Commit 9d3e094f12 added the ability for ALTER INDEX ... ATTACH
PARTITION to validate a parent partitioned index when the partition
index is already attached but the parent is still invalid.  This
provides a recovery path when a previously invalid partition index
has been repaired via REINDEX.

However, the documentation for ALTER INDEX ATTACH PARTITION was not
updated to describe this behavior.  Users have no way to discover
this recovery path from the docs alone.

Add a paragraph to the ALTER INDEX documentation explaining that
re-running ATTACH PARTITION on an already-attached index will
attempt to validate the parent if it is currently invalid.

Discussion: https://www.postgresql.org/message-id/CAGnOmWqi1D9ycBgUeOGf6mOCd2Dcf%3D6sKhbf4sHLs5xAcKVCMQ%40mail.gmail.com
---
 doc/src/sgml/ref/alter_index.sgml | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/doc/src/sgml/ref/alter_index.sgml b/doc/src/sgml/ref/alter_index.sgml
index 1d42d05..2a119f5 100644
--- a/doc/src/sgml/ref/alter_index.sgml
+++ b/doc/src/sgml/ref/alter_index.sgml
@@ -97,6 +97,14 @@ ALTER INDEX ALL IN TABLESPACE <replaceable class="parameter">name</replaceable>
       index cannot be dropped by itself, and will automatically be dropped
       if its parent index is dropped.
      </para>
+     <para>
+      If the named index is already attached to the altered index, the
+      command will attempt to validate the parent index if the parent is
+      currently invalid.
+     </para>
     </listitem>
    </varlistentry>
 
-- 
2.50.1 (Apple Git-155)

