[BUG] pg_dump blocked - Mailing list pgsql-hackers

From Gilles Darold
Subject [BUG] pg_dump blocked
Date
Msg-id 45c93d57-9973-248e-d2df-e02ca9af48d4@darold.net
Whole thread Raw
Responses Re: [BUG] pg_dump blocked
List 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

pgsql-hackers by date:

Previous
From: David Christensen
Date:
Subject: Re: Moving forward with TDE
Next
From: Tom Lane
Date:
Subject: Re: [BUG] pg_dump blocked