pgsql: Fix pg_dump --clean with partitioned indexes.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix pg_dump --clean with partitioned indexes.
Date: 2025-04-16 17:32:09
Message-ID: E1u56cK-000MMO-39@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix pg_dump --clean with partitioned indexes.

We'd try to drop the partitions of a partitioned index separately,
which is disallowed by the backend, leading to an error during
restore. While the error is harmless, it causes problems if you
try to use --single-transaction mode.

Fortunately, there seems no need to do a DROP at all, since the
partition will go away silently when we drop either the parent index
or the partition's table. So just make the DROP conditional on not
being a partition.

Reported-by: jian he <jian(dot)universality(at)gmail(dot)com>
Author: jian he <jian(dot)universality(at)gmail(dot)com>
Reviewed-by: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/CACJufxF0QSdkjFKF4di-JGWN6CSdQYEAhGPmQJJCdkSZtd=oLg@mail.gmail.com
Backpatch-through: 13

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1fc3403626d4aa99a81996435549e47c56c16897

Modified Files
--------------
src/bin/pg_dump/pg_dump.c | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Álvaro Herrera 2025-04-16 17:44:21 Re: pgsql: Non text modes for pg_dumpall, correspondingly change pg_restore
Previous Message Jacob Champion 2025-04-16 16:34:28 Re: pgsql: Add support for basic NUMA awareness