summaryrefslogtreecommitdiff
path: root/src/include/postgres.h
diff options
context:
space:
mode:
authorÁlvaro Herrera <alvherre@kurilemu.de>2026-01-21 20:06:01 +0100
committerÁlvaro Herrera <alvherre@kurilemu.de>2026-01-21 20:06:01 +0100
commit4d6a66f675815a5d40a650d4dcfb5ddb89c6ad2f (patch)
tree37bc0eae0dae62dc4ed2011b3e2bc0b3cc78d5a2 /src/include/postgres.h
parentcec5fe0d1e192b3b0005063011f113ac99f6908c (diff)
Allow Boolean reloptions to have ternary values
From the user's point of view these are just Boolean values; from the implementation side we can now distinguish an option that hasn't been set. Reimplement the vacuum_truncate reloption using this type. This could also be used for reloptions vacuum_index_cleanup and buffering, but those additionally need a per-option "alias" for the state where the variable is unset (currently the value "auto"). Author: Nikolay Shaplov <dhyan@nataraj.su> Reviewed-by: Timur Magomedov <t.magomedov@postgrespro.ru> Reviewed-by: Nathan Bossart <nathandbossart@gmail.com> Discussion: https://postgr.es/m/3474141.usfYGdeWWP@thinkpad-pgpro
Diffstat (limited to 'src/include/postgres.h')
-rw-r--r--src/include/postgres.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/include/postgres.h b/src/include/postgres.h
index 7d93fbce709..8b92f453e7a 100644
--- a/src/include/postgres.h
+++ b/src/include/postgres.h
@@ -544,6 +544,20 @@ Float8GetDatum(float8 X)
*/
/*
+ * pg_ternary
+ * Boolean value with an extra "unset" value
+ *
+ * This enum can be used for values that want to distinguish between true,
+ * false, and unset.
+*/
+typedef enum pg_ternary
+{
+ PG_TERNARY_FALSE = 0,
+ PG_TERNARY_TRUE = 1,
+ PG_TERNARY_UNSET = -1
+} pg_ternary;
+
+/*
* NON_EXEC_STATIC: It's sometimes useful to define a variable or function
* that is normally static but extern when using EXEC_BACKEND (see
* pg_config_manual.h). There would then typically be some code in