0004-review.patch

text/x-patch

Filename: 0004-review.patch
Type: text/x-patch
Part: 3
Message: Re: Statistics Import and Export

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: format-patch
Series: patch 0004
Subject: review
File+
src/bin/pg_dump/pg_dump.c 4 1
src/fe_utils/stats_export.c 3 0
From 567edfd8b77272af9d4320ecf7274cff26343bca Mon Sep 17 00:00:00 2001
From: Tomas Vondra <tv@fuzzy.cz>
Date: Mon, 25 Mar 2024 22:06:49 +0100
Subject: [PATCH 4/4] review

---
 src/bin/pg_dump/pg_dump.c   | 5 ++++-
 src/fe_utils/stats_export.c | 3 +++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 621bfa12337..6e772264509 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -10303,7 +10303,7 @@ dumpRelationStats(Archive *fout, const DumpableObject *dobj,
 		pg_fatal("error in statistics extraction: %s", PQerrorMessage(conn));
 
 	if (PQntuples(res) != 1)
-		pg_fatal("statistics extraction expected one row, but got %d rows", 
+		pg_fatal("statistics extraction expected one row, but got %d rows",
 				 PQntuples(res));
 
 	query = createPQExpBuffer();
@@ -16764,6 +16764,8 @@ dumpTableSchema(Archive *fout, const TableInfo *tbinfo)
 
 	/* Statistics are dependent on the definition, not the data */
 	/* Views don't have stats */
+	/* XXX is this check needed? we'd find there's no stats, no? */
+	/* XXX the condition is wrong, though */
 	if ((tbinfo->dobj.dump & DUMP_COMPONENT_STATISTICS) &&
 		(tbinfo->relkind == RELKIND_VIEW))
 		dumpRelationStats(fout, &tbinfo->dobj, reltypename,
@@ -17084,6 +17086,7 @@ dumpIndex(Archive *fout, const IndxInfo *indxinfo)
 	}
 
 	/* Comments and stats share same .dep */
+	/* XXX what's ".dep"? */
 	dumpid = is_constraint ? indxinfo->indexconstraint :
 							 indxinfo->dobj.dumpId;
 
diff --git a/src/fe_utils/stats_export.c b/src/fe_utils/stats_export.c
index fd09e6ea8af..bcaaf200c24 100644
--- a/src/fe_utils/stats_export.c
+++ b/src/fe_utils/stats_export.c
@@ -78,6 +78,9 @@ exportStatsSupported(int server_version_num)
  * (e.g. pg_statistic_ext, pg_statitic_ext_data) statistics.
  *
  * Currently, none do.
+ *
+ * XXX Why do we even have this? Nothing is using it, even if it called
+ * this function we wouldn't know how to export stats.
  */
 bool
 exportExtStatsSupported(int server_version_num)
-- 
2.44.0