From 4ecd3b08d760617f7cd5da79c491c25f76f298e1 Mon Sep 17 00:00:00 2001
From: Mohamed Ali <moali.pg@gmail.com>
Date: Fri, 15 May 2026 11:12:53 -0700
Subject: [PATCH v1] doc: Document that invalid indexes are skipped during
 ATTACH PARTITION

When ALTER TABLE ... ATTACH PARTITION matches partition indexes to
the parent table's indexes, invalid indexes on the partition are
silently skipped.  This behavior was added by commit fc55c7ff8d1
but was not documented.

Add a sentence to the ALTER TABLE reference page noting that invalid
indexes are skipped during this matching and that a new index is
created when no valid equivalent is found.

Backpatch-through: 13
---
 doc/src/sgml/ref/alter_table.sgml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml
index 1f9a456fd33..c6572fa809b 100644
--- a/doc/src/sgml/ref/alter_table.sgml
+++ b/doc/src/sgml/ref/alter_table.sgml
@@ -1058,6 +1058,8 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
       one will be created in the attached table; or, if an equivalent
       index already exists, it will be attached to the target table's index,
       as if <command>ALTER INDEX ATTACH PARTITION</command> had been executed.
+      Invalid indexes on the partition are skipped during this matching;
+      if no valid equivalent index is found, a new one is created.
       Note that if the existing table is a foreign table, it is currently not
       allowed to attach the table as a partition of the target table if there
       are <literal>UNIQUE</literal> indexes on the target table.  (See also
-- 
2.50.1 (Apple Git-155)

