pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@lists.postgresql.org
Subject: pg_dump fails to lock partitioned tables
Date: Fri, 15 Oct 2021 21:05:27 -0400
Message-ID: <1018205.1634346327@sss.pgh.pa.us> (raw)

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

Attachments:

  [text/x-diff] make-pg-dump-lock-partition-parents-too.patch (521B, ../1018205.1634346327@sss.pgh.pa.us/2-make-pg-dump-lock-partition-parents-too.patch)
  download | inline diff:
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);

Message-ID: <1018205.1634346327@sss.pgh.pa.us>
Permalink:  ../1018205.1634346327@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1018205.1634346327@sss.pgh.pa.us

 ·  · 

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: tgl@sss.pgh.pa.us, pgsql-hackers@lists.postgresql.org
  Subject: Re: pg_dump fails to lock partitioned tables
  In-Reply-To: <1018205.1634346327@sss.pgh.pa.us>

* 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