summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorPeter Geoghegan <pg@bowt.ie>2023-04-07 16:08:52 -0700
committerPeter Geoghegan <pg@bowt.ie>2023-04-07 16:08:52 -0700
commit7d8219a444bd917d21234c97e2417a410f10ebd3 (patch)
treea4bf646294fb51f5bef2d7595dafab66a0fe9e2c /src/include
parent76c111a7f16659f9018391f655764c8226461ca4 (diff)
downloadpostgresql-7d8219a444bd917d21234c97e2417a410f10ebd3.tar.gz
Show more detail in heapam rmgr descriptions.
Add helper functions that output arrays in a standard format, and use the functions inside heapdesc routines. This allows tools like pg_walinspect to show a detailed description of the page offset number arrays for records like PRUNE and VACUUM (unless there was an FPI). Also document the conventions that desc routines should follow. Only the heapdesc routines follow the conventions for now, so they're just guidelines for the time being. Based on a suggestion from Andres Freund. Author: Melanie Plageman <melanieplageman@gmail.com> Reviewed-By: Peter Geoghegan <pg@bowt.ie> Discussion: https://postgr.es/m/flat/20230109215842.fktuhesvayno6o4g%40awork3.anarazel.de
Diffstat (limited to 'src/include')
-rw-r--r--src/include/access/rmgrdesc_utils.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/include/access/rmgrdesc_utils.h b/src/include/access/rmgrdesc_utils.h
new file mode 100644
index 0000000000..aa6d0290d9
--- /dev/null
+++ b/src/include/access/rmgrdesc_utils.h
@@ -0,0 +1,22 @@
+/*-------------------------------------------------------------------------
+ *
+ * rmgrdesc_utils.h
+ * Support functions for rmgrdesc routines
+ *
+ * Copyright (c) 2023, PostgreSQL Global Development Group
+ *
+ * src/include/access/rmgrdesc_utils.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef RMGRDESC_UTILS_H_
+#define RMGRDESC_UTILS_H_
+
+extern void array_desc(StringInfo buf, void *array, size_t elem_size, int count,
+ void (*elem_desc) (StringInfo buf, void *elem, void *data),
+ void *data);
+extern void offset_elem_desc(StringInfo buf, void *offset, void *data);
+extern void redirect_elem_desc(StringInfo buf, void *offset, void *data);
+extern void relid_desc(StringInfo buf, void *relid, void *data);
+
+#endif /* RMGRDESC_UTILS_H */