From cc4422002ad7e991db42a09710f68eff04980972 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Fri, 1 Apr 2022 13:43:49 -0700
Subject: [PATCH v68 08/31] pgstat: introduce PgStat_Kind enum.

Will be used by following commits to generalize stats infrastructure.
---
 src/include/pgstat.h             | 27 +++++++++++++++++++++++++++
 src/tools/pgindent/typedefs.list |  1 +
 2 files changed, 28 insertions(+)

diff --git a/src/include/pgstat.h b/src/include/pgstat.h
index ed37523ce17..1d03bd97de4 100644
--- a/src/include/pgstat.h
+++ b/src/include/pgstat.h
@@ -33,6 +33,33 @@
 /* Default directory to store temporary statistics data in */
 #define PG_STAT_TMP_DIR		"pg_stat_tmp"
 
+/* The types of statistics entries */
+typedef enum PgStat_Kind
+{
+	/*
+	 * Don't define an INVALID value so switch() statements can warn if some
+	 * cases aren't covered. But define the first member to 1 so that
+	 * uninitialized values can be detected more easily.
+	 */
+
+	/* stats with a variable number of entries */
+	PGSTAT_KIND_DATABASE = 1,	/* database-wide statistics */
+	PGSTAT_KIND_RELATION,		/* per-table statistics */
+	PGSTAT_KIND_FUNCTION,		/* per-function statistics */
+	PGSTAT_KIND_REPLSLOT,		/* per-slot statistics */
+	PGSTAT_KIND_SUBSCRIPTION,	/* per-subscription statistics */
+
+	/* stats with a constant number of entries */
+	PGSTAT_KIND_ARCHIVER,
+	PGSTAT_KIND_BGWRITER,
+	PGSTAT_KIND_CHECKPOINTER,
+	PGSTAT_KIND_SLRU,
+	PGSTAT_KIND_WAL,
+} PgStat_Kind;
+
+#define PGSTAT_KIND_FIRST PGSTAT_KIND_DATABASE
+#define PGSTAT_KIND_LAST PGSTAT_KIND_WAL
+#define PGSTAT_NUM_KINDS (PGSTAT_KIND_LAST + 1)
 
 /* Values for track_functions GUC variable --- order is significant! */
 typedef enum TrackFunctionsLevel
diff --git a/src/tools/pgindent/typedefs.list b/src/tools/pgindent/typedefs.list
index 72fafb795bb..a5c15a1d68f 100644
--- a/src/tools/pgindent/typedefs.list
+++ b/src/tools/pgindent/typedefs.list
@@ -1931,6 +1931,7 @@ PgStat_FunctionCallUsage
 PgStat_FunctionCounts
 PgStat_FunctionEntry
 PgStat_GlobalStats
+PgStat_Kind
 PgStat_Msg
 PgStat_MsgAnalyze
 PgStat_MsgAnlAncestors
-- 
2.35.1.677.gabf474a5dd

