| From: | Rui Zhao <zhaorui126(at)gmail(dot)com> |
|---|---|
| To: | Andrey Borodin <x4mmm(at)yandex-team(dot)ru> |
| Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Tatsuya Kawata <kawatatatsuya0913(at)gmail(dot)com>, fabriziomello(at)gmail(dot)com, pgsql-hackers mailing list <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Jobin Augustine <jobinau(at)gmail(dot)com> |
| Subject: | Re: Improving display of octal GUCs |
| Date: | 2026-09-06 15:04:12 |
| Message-ID: | CAHWVJhEYMM1Fu_BdKq9PPkFLWs0D9z036Df7nNxdVTkhXQKatQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> What do you think of Rui's suggestion for a HINT if we're throwing
> out-of-range for an octal GUC? I think it's a little more complicated
> than he paints it, because the syntax rules are different in
> postgresql.conf than in SQL, but we could make it happen if we thought
> it was worth the trouble.
Having looked at what the hint would actually have to say, I'd drop it.
The hint I sketched ("quote it, e.g. '0640'") is only right for SQL.
Each way a value can arrive has its own rule:
postgresql.conf: 0640 is octal (parse_int() uses strtol with base 0),
640 fails with the 01200 message, and 0o640 is a
syntax error in the file
ALTER SYSTEM: 0640 is decimal 640 and fails with 01200;
'0640' and 0o640 are octal
postgres -c: 0640 is octal, 640 fails with 01200, and 0o640 is
rejected as an invalid value
And the error site cannot tell these apart: ALTER SYSTEM validates
through parse_and_validate_value() with PGC_S_FILE, the same source as
the file, and by then the value is the string "640" either way. A hint
that is correct everywhere would have to state both rules ("start with
a 0; in SQL also quote it or write 0o640"), which is longer than the
clue the octal echo already gives. I agree with Andrey that 01200 next
to (0000 .. 0777) is enough.
v1 still applies and builds cleanly on today's master (798bdcae89).
LGTM as is.
Regards,
Rui
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2026-09-06 15:48:12 | Re: Improving display of octal GUCs |
| Previous Message | Zsolt Parragi | 2026-09-06 13:10:14 | Re: Add TG_* vars for FOR PORTION OF |