pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Noah Misch <noah@leadboat.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix crash in REINDEX CONCURRENTLY due to DDLs run in index funct
Date: Mon, 09 Nov 2026 14:21:58 +0000
Message-ID: <E1xQQFy-000000003d0-1sAU@gemulon.postgresql.org> (raw)

Fix crash in REINDEX CONCURRENTLY due to DDLs run in index functions

ReindexRelationConcurrently() keeps track of the OIDs of the relations
it processes across all its phases, relying on session locks to protect
them.  A function called from an index predicate or expression could
drop one of the indexes being processed by a REINDEX CONCURRENTLY,
causing a crash during the swap phase due to a relation gone missing.

The relations being reindexed, on which are taken the session locks, are
now pinned during the build and validation phases so as no manipulation
of their definition can happen in the session running a REINDEX
CONCURRENTLY.

Reported-by: Florent Saudel <fsaudel@protonmail.com>
Author: Michael Paquier <michael@paquier.xyz>
Backpatch-through: 14
Security: CVE-2026-116336

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/061cc0ee6f017ba6b937c61a50c91a758b9a95a8
Author: Michael Paquier <michael@paquier.xyz>

Modified Files
--------------
src/backend/commands/indexcmds.c           | 62 ++++++++++++++++++++++++++++++
src/test/regress/expected/create_index.out | 27 +++++++++++++
src/test/regress/sql/create_index.sql      | 21 ++++++++++
3 files changed, 110 insertions(+)



view thread (3+ messages)

Message-ID: <E1xQQFy-000000003d0-1sAU@gemulon.postgresql.org>
Permalink:  ../E1xQQFy-000000003d0-1sAU@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xQQFy-000000003d0-1sAU@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: noah@leadboat.com
  Subject: Re: pgsql: Fix crash in REINDEX CONCURRENTLY due to DDLs run in index funct
  In-Reply-To: <E1xQQFy-000000003d0-1sAU@gemulon.postgresql.org>
  References: <E1xQQFy-000000003d0-1sAU@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox