PS_guc_show_hook.txt
text/plain
Filename: PS_guc_show_hook.txt
Type: text/plain
Part: 0
diff --git a/src/backend/replication/logical/logicalxlog.c b/src/backend/replication/logical/logicalxlog.c
index d409eff..7defe97 100644
--- a/src/backend/replication/logical/logicalxlog.c
+++ b/src/backend/replication/logical/logicalxlog.c
@@ -27,6 +27,7 @@
#include "storage/procarray.h"
#include "storage/procsignal.h"
#include "utils/builtins.h"
+#include "utils/guc_hooks.h"
#include "utils/wait_event.h"
typedef struct XLogLogicalInfoCtlData
@@ -138,6 +139,23 @@ XLogLogicalInfoEnabled(void)
}
/*
+ * The show_hook for GUC wal_level.
+ */
+const char *show_wal_level(void)
+{
+ switch (wal_level)
+ {
+ case WAL_LEVEL_MINIMAL:
+ return "minimal";
+ case WAL_LEVEL_REPLICA:
+ return IsLogicalDecodingActive() ? "replica-logical" : "replica";
+ case WAL_LEVEL_LOGICAL:
+ return "logical";
+ }
+ return "???";
+}
+
+/*
* Is logical decoding active?
*/
bool inline
diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c
index c9d8cd7..b7e2b9f 100644
--- a/src/backend/utils/misc/guc_tables.c
+++ b/src/backend/utils/misc/guc_tables.c
@@ -5068,7 +5068,7 @@ struct config_enum ConfigureNamesEnum[] =
},
&wal_level,
WAL_LEVEL_REPLICA, wal_level_options,
- NULL, NULL, NULL
+ NULL, NULL, show_wal_level
},
{
diff --git a/src/include/utils/guc_hooks.h b/src/include/utils/guc_hooks.h
index 8799921..53fa454 100644
--- a/src/include/utils/guc_hooks.h
+++ b/src/include/utils/guc_hooks.h
@@ -174,5 +174,5 @@ extern void assign_wal_sync_method(int new_wal_sync_method, void *extra);
extern bool check_synchronized_standby_slots(char **newval, void **extra,
GucSource source);
extern void assign_synchronized_standby_slots(const char *newval, void *extra);
-
+extern const char *show_wal_level(void);
#endif /* GUC_HOOKS_H */