On Wed, May 16, 2018 at 3:19 PM, Heikki Linnakangas <hlinnaka@iki.fi> wrote:
I played around with the GUC memory units, specifically to test the new GUC_UNIT_BYTES flag (commit 6e7baa32):
$ postmaster -c track_activity_query_size=1024kB FATAL: 1048576 is outside the valid range for parameter "track_activity_query_size" (100 .. 102400)
$ postmaster -c track_activity_query_size=1024MB FATAL: 1073741824 is outside the valid range for parameter "track_activity_query_size" (100 .. 102400)
$ postmaster -c track_activity_query_size=1024GB FATAL: invalid value for parameter "track_activity_query_size": "1024GB" HINT: Value exceeds integer range.
$ postmaster -c track_activity_query_size=1024TB FATAL: invalid value for parameter "track_activity_query_size": "1024TB" HINT: Valid units for this parameter are "kB", "MB", "GB", and "TB".
The first two look OK, but the last two cases seem a bit weird. With 1024 GB, it would be nice to print the valid range, like in the first two cases.
+1,
I also think it would be nice to show units in the valid range. I image that if I would see such message at the first time, then I would try to reverse-engineer units from input value representation in the error message. Displaying units in the valid range would be clarifying for me.
The HINT in the last message seems wrong: the hint claims that "TB" is accepted, yet "1024 TB" was not accepted.
Yes, this seems like a bug. I think it should be fixed.
And shouldn't the hint also mention "B", since we accept that now?
Yes, I think "B" should be mentioned in hint.
Testing a setting with GUC_UNIT_KB:
$ postmaster -c work_mem=102400B FATAL: invalid value for parameter "work_mem": "100000B" HINT: Valid units for this parameter are "kB", "MB", "GB", and "TB".
This time the hint is accurate, but why is "B" not accepted here? Seems inconsistent.