v3-0001-pg_dump-Remove-redundant-relkind-checks.patch

text/plain

Filename: v3-0001-pg_dump-Remove-redundant-relkind-checks.patch
Type: text/plain
Part: 0
Message: Re: Some RELKIND macro refactoring

Patch

Format: format-patch
Series: patch v3-0001
Subject: pg_dump: Remove redundant relkind checks
File+
src/bin/pg_dump/common.c 1 7
src/bin/pg_dump/pg_dump.c 1 6
From a5ecfa6cfb3963ff069b591254975525ac91b2e1 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Mon, 16 Aug 2021 14:25:59 +0200
Subject: [PATCH v3 1/2] pg_dump: Remove redundant relkind checks

It is checked in flagInhTables() which relkinds can have parents.
After that, those entries will have numParents==0, so we don't need to
check the relkind again.
---
 src/bin/pg_dump/common.c  | 8 +-------
 src/bin/pg_dump/pg_dump.c | 7 +------
 2 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/src/bin/pg_dump/common.c b/src/bin/pg_dump/common.c
index ecab0a9e4e..c01555d8e4 100644
--- a/src/bin/pg_dump/common.c
+++ b/src/bin/pg_dump/common.c
@@ -476,13 +476,7 @@ flagInhAttrs(DumpOptions *dopt, TableInfo *tblinfo, int numTables)
 		int			numParents;
 		TableInfo **parents;
 
-		/* Some kinds never have parents */
-		if (tbinfo->relkind == RELKIND_SEQUENCE ||
-			tbinfo->relkind == RELKIND_VIEW ||
-			tbinfo->relkind == RELKIND_MATVIEW)
-			continue;
-
-		/* Don't bother computing anything for non-target tables, either */
+		/* Don't bother computing anything for non-target tables */
 		if (!tbinfo->dobj.dump)
 			continue;
 
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index b9635a95b6..f3c6c28480 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -2727,12 +2727,7 @@ guessConstraintInheritance(TableInfo *tblinfo, int numTables)
 		TableInfo **parents;
 		TableInfo  *parent;
 
-		/* Sequences and views never have parents */
-		if (tbinfo->relkind == RELKIND_SEQUENCE ||
-			tbinfo->relkind == RELKIND_VIEW)
-			continue;
-
-		/* Don't bother computing anything for non-target tables, either */
+		/* Don't bother computing anything for non-target tables */
 		if (!(tbinfo->dobj.dump & DUMP_COMPONENT_DEFINITION))
 			continue;
 

base-commit: 0f9b9938a0367313fcf6a32fcb7fb5be9e281198
-- 
2.33.1