pg_dump fails to lock partitioned tables - Mailing list pgsql-hackers

From Tom Lane
Subject pg_dump fails to lock partitioned tables
Date
Msg-id 1018205.1634346327@sss.pgh.pa.us
Whole thread Raw
List pgsql-hackers
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

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);

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: [RFC] building postgres with meson
Next
From: Michael Paquier
Date:
Subject: Re: Trivial doc patch