Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mbY8j-0000Dc-Vu for pgsql-hackers@arkaria.postgresql.org; Sat, 16 Oct 2021 01:05:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mbY8g-0003xb-Ps for pgsql-hackers@arkaria.postgresql.org; Sat, 16 Oct 2021 01:05:30 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mbY8g-0003xS-HX for pgsql-hackers@lists.postgresql.org; Sat, 16 Oct 2021 01:05:30 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mbY8e-0003Mg-87 for pgsql-hackers@lists.postgresql.org; Sat, 16 Oct 2021 01:05:29 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 19G15RUg1018206 for ; Fri, 15 Oct 2021 21:05:27 -0400 From: Tom Lane To: pgsql-hackers@lists.postgresql.org Subject: pg_dump fails to lock partitioned tables MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <1018163.1634346276.0@sss.pgh.pa.us> Date: Fri, 15 Oct 2021 21:05:27 -0400 Message-ID: <1018205.1634346327@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1018163.1634346276.1@sss.pgh.pa.us> While fooling with something else, I happened to notice $SUBJECT. The reason turns out to be that it's checking the wrong element of the tblinfo[] array; see one-liner fix attached. I had a feeling of deja vu about this bug, and indeed a dig in the git history shows that we fixed it in passing in 403a3d91c. But that later got reverted, and we forgot to keep the bug fix. regards, tom lane ------- =_aaaaaaaaaa0 Content-Type: text/x-diff; name="make-pg-dump-lock-partition-parents-too.patch"; charset="us-ascii" Content-ID: <1018163.1634346276.2@sss.pgh.pa.us> Content-Description: make-pg-dump-lock-partition-parents-too.patch diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index a485fb2d07..5deb347f34 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -7016,7 +7016,7 @@ getTables(Archive *fout, int *numTables) */ if (tblinfo[i].dobj.dump && (tblinfo[i].relkind == RELKIND_RELATION || - tblinfo->relkind == RELKIND_PARTITIONED_TABLE) && + tblinfo[i].relkind == RELKIND_PARTITIONED_TABLE) && (tblinfo[i].dobj.dump & DUMP_COMPONENTS_REQUIRING_LOCK)) { resetPQExpBuffer(query); ------- =_aaaaaaaaaa0--