pgsql: Retain locks after marking the partitioned index valid

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Retain locks after marking the partitioned index valid
Date: 2026-10-25 09:24:35
Message-ID: E1xKuSx-00000000gFG-2XD8@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Retain locks after marking the partitioned index valid

Commit 8b08f7d4820f (pg11-era), for no apparent reason, made
validatePartitionedIndex() release the locks on the parent partitioned
index and table when marking the parent index valid after marking the
index partition as valid. This leads to race condition, which
particularly manifest when restoring from pg_dump in parallel mode, for
instance causing restore of FKs to fail if the PK that they depend on is
being concurrently validated. Fix by retaining those locks until
transaction commit, as we normally do everywhere in DDL code.

Per buildfarm failures.

Author: Andrey Borodin <x4mmm(at)yandex-team(dot)ru> (in absentia)
Diagnosed-by: Kirill Reshke <reshkekirill(at)gmail(dot)com>
Backpatch-through: 14
Discussion: https://postgr.es/m/l4joqljvbou26unhplkdj7m5olxn7rsy2loqlcta44nie5k3bs@zudmva7han7g

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/57a2e2cf51c65d8a84a81d7cb083ebcefab721b1

Modified Files
--------------
src/backend/commands/tablecmds.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2026-10-25 09:31:52 pgsql: ci: Convert CompilerWarnings job to meson
Previous Message Daniel Gustafsson 2026-10-24 21:06:41 pgsql: doc: Fix removal of FreeBSD mention in DocBook section