pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Allow fractional input values for integer GUCs, and improve roun
Date: Mon, 11 Mar 2019 23:14:07 +0000
Message-ID: <E1h3U7T-0001PV-7W@gemulon.postgresql.org> (raw)

Allow fractional input values for integer GUCs, and improve rounding logic.

Historically guc.c has just refused examples like set work_mem = '30.1GB',
but it seems more useful for it to take that and round off the value to
some reasonable approximation of what the user said.  Just rounding to
the parameter's native unit would work, but it would lead to rather
silly-looking settings, such as 31562138kB for this example.  Instead
let's round to the nearest multiple of the next smaller unit (if any),
producing 30822MB.

Also, do the units conversion math in floating point and round to integer
(if needed) only at the end.  This produces saner results for inputs that
aren't exact multiples of the parameter's native unit, and removes another
difference in the behavior for integer vs. float parameters.

In passing, document the ability to use hex or octal input where it
ought to be documented.

Discussion: https://postgr.es/m/1798.1552165479@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1a83a80a2fe5b559f85ed4830acb92d5124b7a9a

Modified Files
--------------
doc/src/sgml/config.sgml                 | 18 ++++++-
src/backend/utils/misc/guc.c             | 83 +++++++++++++++++++++-----------
src/test/regress/expected/reloptions.out |  5 +-
src/test/regress/sql/reloptions.sql      |  2 +-
4 files changed, 74 insertions(+), 34 deletions(-)



Message-ID: <E1h3U7T-0001PV-7W@gemulon.postgresql.org>
Permalink:  ../E1h3U7T-0001PV-7W@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1h3U7T-0001PV-7W@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Allow fractional input values for integer GUCs, and improve roun
  In-Reply-To: <E1h3U7T-0001PV-7W@gemulon.postgresql.org>
  References: <E1h3U7T-0001PV-7W@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox