pgsql: Allow Boolean reloptions to have ternary values

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Allow Boolean reloptions to have ternary values
Date: 2026-01-21 19:07:57
Message-ID: E1vidYa-001qhJ-11@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(at)nataraj(dot)su>
Reviewed-by: Timur Magomedov <t(dot)magomedov(at)postgrespro(dot)ru>
Reviewed-by: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Discussion: https://postgr.es/m/3474141.usfYGdeWWP@thinkpad-pgpro

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4d6a66f675815a5d40a650d4dcfb5ddb89c6ad2f

Modified Files
--------------
src/backend/access/common/reloptions.c | 138 +++++++++++++++++----
src/backend/commands/vacuum.c | 4 +-
src/include/access/reloptions.h | 26 ++--
src/include/postgres.h | 14 +++
src/include/utils/rel.h | 3 +-
src/test/modules/dummy_index_am/README | 2 +-
src/test/modules/dummy_index_am/dummy_index_am.c | 55 +++++---
.../modules/dummy_index_am/expected/reloptions.out | 24 +++-
src/test/modules/dummy_index_am/sql/reloptions.sql | 10 ++
src/test/regress/expected/reloptions.out | 18 +++
src/test/regress/sql/reloptions.sql | 11 ++
src/tools/pgindent/typedefs.list | 2 +
12 files changed, 242 insertions(+), 65 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2026-01-21 20:08:49 pgsql: Force standard_conforming_strings to always be ON.
Previous Message Tom Lane 2026-01-21 18:26:33 pgsql: Remove useless flag PVC_INCLUDE_CONVERTROWTYPES.