pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gilles Darold <gilles@darold.net>
To: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: [BUG] pg_dump blocked
Date: Thu, 17 Nov 2022 17:43:38 +0100
Message-ID: <45c93d57-9973-248e-d2df-e02ca9af48d4@darold.net> (raw)

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

view thread (5+ messages)  latest in thread

Message-ID: <45c93d57-9973-248e-d2df-e02ca9af48d4@darold.net>
Permalink:  ../45c93d57-9973-248e-d2df-e02ca9af48d4@darold.net/
Also on:    postgresql.org/message-id/45c93d57-9973-248e-d2df-e02ca9af48d4@darold.net

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: gilles@darold.net
  Subject: Re: [BUG] pg_dump blocked
  In-Reply-To: <45c93d57-9973-248e-d2df-e02ca9af48d4@darold.net>

* 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