pgsql: Accept "B" in all memory-unit GUCs, and improve error messages.

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Accept "B" in all memory-unit GUCs, and improve error messages.
Date: 2018-05-23 07:24:32
Message-ID: E1fLO8O-0002ZH-Ux@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Accept "B" in all memory-unit GUCs, and improve error messages.

Commit 6e7baa3227 added support for "B" unit, for specifying config options
in bytes. However, it was only accepted in GUC_UNIT_BYTE settings,
wal_segment_size and track_activity_query_size, and not e.g. in work_mem.
This patch makes it consistent, so that "B" accepted in all the same
contexts where "kB", "MB", and so forth are accepted.

Add "B" to the list of accepted units in the error hint, along with "kB",
"MB", etc.

Add an entry in the conversion table for "TB" to "B" conversion. A terabyte
is out of range for any GUC_UNIT_BYTE option, so you always get an "out of
range" error with that, but without it, you get a confusing error message
that claims that "TB" is not an accepted unit, with a hint that nevertheless
lists "TB" as an accepted unit.

Reviewed-by: Alexander Korotkov, Andres Freund
Discussion: https://www.postgresql.org/message-id/1bfe7f4a-7e22-aa6e-7b37-f4d222ed2d67@iki.fi

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b06d8e58b5ac257c2119312c47c4a0f233c5e0ca

Modified Files
--------------
src/backend/utils/misc/guc.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2018-05-23 15:00:02 pgsql: Fix incorrect ordering of operations in pg_resetwal and pg_rewin
Previous Message Bruce Momjian 2018-05-23 02:39:57 pgsql: doc: PG 11 release notes fix for pg_dump --create, author