Re: Improving display of octal GUCs - Mailing list pgsql-hackers

From Rui Zhao
Subject Re: Improving display of octal GUCs
Date
Msg-id CAHWVJhHZVBzQEijhNENpm0t1Yk0kCJ8Xso2854HOeDBZROxdVA@mail.gmail.com
Whole thread
In response to Re: Improving display of octal GUCs  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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



pgsql-hackers by date:

Previous
From: torikoshia
Date:
Subject: Re: RFC: Logging plan of the running query
Next
From: Anthonin Bonnefoy
Date:
Subject: Re: hang during shutdown