Tom Lane <[email protected]> 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


Reply via email to