pgsql: Improve display of GUCs that are customarily written in octal.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Improve display of GUCs that are customarily written in octal.
Date: 2026-09-07 20:05:28
Message-ID: E1x3fap-00000003tDW-14lE@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Improve display of GUCs that are customarily written in octal.

A few integer-valued GUCs representing Unix file permission masks
are customarily written and shown in octal. However, we implemented
the "shown" part via show_hook functions, which is problematic
because it only affects display of the current value. It's confusing
that, for example, the pg_settings view renders the current value in
octal but the min, max, reset, and boot values in decimal.

To improve matters, get rid of these custom show_hooks in favor of
inventing a per-GUC flag GUC_SHOW_IN_OCTAL, which can be inspected in
appropriate places. I've implemented that in places that respond to
units flags, but not in places that don't, such as GetConfigOption().

It's tempting to consider going further, in particular adjusting
input parsing so that we read the values of these variables in
octal even without a leading zero. I've refrained from doing so
here because I'm afraid that it'd break more usages than it fixes,
but perhaps there's a case to be made for that.

Bug: #19540
Reported-by: Jobin Augustine <jobinau(at)gmail(dot)com>
Author: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Reviewed-by: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
Reviewed-by: Tatsuya Kawata <kawatatatsuya0913(at)gmail(dot)com>
Reviewed-by: Rui Zhao <zhaorui126(at)gmail(dot)com>
Reviewed-by: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
Discussion: https://postgr.es/m/3006313.1782851535@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/23c07b4604387b98efd25246b185b57be237d7ca

Modified Files
--------------
src/backend/commands/variable.c | 40 -----------------------
src/backend/utils/misc/README | 6 ++++
src/backend/utils/misc/guc.c | 53 +++++++++++++++++++++++--------
src/backend/utils/misc/guc_funcs.c | 15 ++++++---
src/backend/utils/misc/guc_parameters.dat | 7 ++--
src/include/utils/guc.h | 1 +
src/include/utils/guc_hooks.h | 3 --
src/test/regress/expected/guc.out | 14 ++++++++
src/test/regress/sql/guc.sql | 7 ++++
9 files changed, 82 insertions(+), 64 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Richard Guo 2026-09-08 01:14:55 pgsql: Fix nestloop parameter handling for PlaceHolderVars in child joi
Previous Message Peter Eisentraut 2026-09-07 19:33:39 pgsql: Revert SQL Property Graph Queries (SQL/PGQ)