v1-0002-Don-t-create-useless-TableAttachInfo-objects.patch
text/x-diff
Filename: v1-0002-Don-t-create-useless-TableAttachInfo-objects.patch
Type: text/x-diff
Part: 1
Message:
Re: pg_dump versus hash partitioning
Patch
Format: format-patch
Series: patch v1-0002
Subject: Don't create useless TableAttachInfo objects.
| File | + | − |
|---|---|---|
| src/bin/pg_dump/common.c | 2 | 1 |
| src/bin/pg_dump/pg_dump.c | 0 | 3 |
From 5f73193c120ce04f4e5bb3530fe1ee84afc841f1 Mon Sep 17 00:00:00 2001
From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Tue, 14 Feb 2023 13:18:29 -0500
Subject: [PATCH v1 2/3] Don't create useless TableAttachInfo objects.
It's silly to create a TableAttachInfo object that we're not
going to dump, when we know perfectly well at creation time
that it won't be dumped.
Discussion: https://postgr.es/m/1376149.1675268279@sss.pgh.pa.us
---
src/bin/pg_dump/common.c | 3 ++-
src/bin/pg_dump/pg_dump.c | 3 ---
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c
index 3d0cfc1b8e..ce9d2a8ee8 100644
--- a/src/bin/pg_dump/common.c
+++ b/src/bin/pg_dump/common.c
@@ -336,7 +336,8 @@ flagInhTables(Archive *fout, TableInfo *tblinfo, int numTables,
}
/* Create TableAttachInfo object if needed */
- if (tblinfo[i].dobj.dump && tblinfo[i].ispartition)
+ if ((tblinfo[i].dobj.dump & DUMP_COMPONENT_DEFINITION) &&
+ tblinfo[i].ispartition)
{
TableAttachInfo *attachinfo;
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 51b317aa3d..35bba8765f 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -16082,9 +16082,6 @@ dumpTableAttach(Archive *fout, const TableAttachInfo *attachinfo)
if (dopt->dataOnly)
return;
- if (!(attachinfo->partitionTbl->dobj.dump & DUMP_COMPONENT_DEFINITION))
- return;
-
q = createPQExpBuffer();
if (!fout->is_prepared[PREPQUERY_DUMPTABLEATTACH])
--
2.31.1