[BUG] pg_dump blocked
Gilles DAROLD <gilles@darold.net>
From: Gilles Darold <gilles@darold.net>
To: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2022-11-17T16:43:38Z
Lists: pgsql-hackers
Hi,
I have an incorrect behavior with pg_dump prior PG version 15. With
PostgreSQL 15, thanks to commit e3fcbbd623b9ccc16cdbda374654d91a4727d173
the problem is gone but for older versions it persists with locks on
partitioned tables.
When we try to dump a database where a table is locked, pg_dump wait
until the lock is released, this is expected. Now if the table is
excluded from the dump using the -T option, obviously pg_dump is not
concerned by the lock. Unfortunately this is not the case when the table
is partitioned because of the call to pg_get_partkeydef(), pg_get_expr()
in the query generated in getTables(). Here is the use case to reproduce.
In a psql session execute:
BEGIN;
LOCK TABLE measurement;
then run a pg_dump command excluding the measurement partitions:
pg_dump -d test -T "measurement*" > /dev/null
it will not end until the lock on the partition is released.
I think the problem is the same if we use a schema exclusion where the
partitioned table is locked.
Is it possible to consider a backport fix? If yes, does adding the
table/schema filters in the query generated in getTables() is enough or
do you think about of a kind of backport of commit
e3fcbbd623b9ccc16cdbda374654d91a4727d173 ?
Best regards,
--
Gilles Darold
Commits
-
pg_dump: avoid unsafe function calls in getPolicies().
- b7333e826955 11.19 landed
- a5b26aaafe4f 13.10 landed
- 1ed6f1b9116c 12.14 landed
- 03ac48549438 14.7 landed
-
Postpone calls of unsafe server-side functions in pg_dump.
- e46e986baef0 13.10 landed
- b1f106420b1a 11.19 landed
- 55f30e6c7640 14.7 landed
- 344b7849200f 12.14 landed
- e3fcbbd623b9 15.0 cited