Re: Improving display of octal GUCs

From: Rui Zhao <zhaorui126(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Tatsuya Kawata <kawatatatsuya0913(at)gmail(dot)com>, fabriziomello(at)gmail(dot)com, pgsql-hackers(at)lists(dot)postgresql(dot)org, Jobin Augustine <jobinau(at)gmail(dot)com>
Subject: Re: Improving display of octal GUCs
Date: 2026-07-06 06:24:41
Message-ID: CAHWVJhHZVBzQEijhNENpm0t1Yk0kCJ8Xso2854HOeDBZROxdVA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Tom,

I built v1 on current master and tested it -- the display is consistent now:
pg_settings shows setting/min_val/max_val/boot_val/reset_val all in octal for
the three mode GUCs, and SHOW / current_setting agree. The out-of-range error
comes out in octal too (ALTER SYSTEM SET log_file_mode = 0640 -> "01200 is
outside the valid range ... (0000 .. 0777)"). The new flag bit (0x010000) is
the first free one below the unit flags, no collision. make check is green.

I also checked that dropping the show_hooks doesn't change "postgres -C": it
still prints decimal (511), but that's not a regression -- GetConfigOption()
already formatted PGC_INT with %d and never went through the show_hook, so -C
was decimal before too. Matches your note about GetConfigOption() being out
of scope.

One optional thought on that range error: since an unquoted 0640 is decimal
640 in SQL (not octal), the "01200" can be a little surprising to someone who
meant octal -- the value they typed and the value echoed back don't visibly
line up. A small errhint might smooth that over without reintroducing decimal
into the message, e.g.

ERROR: 01200 is outside the valid range for parameter "log_file_mode"
(0000 .. 0777)
HINT: To specify an octal value, quote it, e.g. '0640'.

Fully optional, and it does edge toward input handling rather than display, so
feel free to ignore.

LGTM.

Regards,
Rui

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Anthonin Bonnefoy 2026-07-06 06:30:06 Re: hang during shutdown
Previous Message torikoshia 2026-07-06 06:21:44 Re: RFC: Logging plan of the running query