Обсуждение: pg_dump fails to lock partitioned tables

Поиск
Список
Период
Сортировка

pg_dump fails to lock partitioned tables

От
Tom Lane
Дата:
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);