Commit 1a83a80
committed
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.us1 parent fe0b2c1 commit 1a83a80
File tree
4 files changed
+74
-34
lines changed- doc/src/sgml
- src
- backend/utils/misc
- test/regress
- expected
- sql
4 files changed
+74
-34
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
60 | | - | |
61 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
62 | 69 | | |
63 | 70 | | |
64 | 71 | | |
| |||
99 | 106 | | |
100 | 107 | | |
101 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
102 | 116 | | |
103 | 117 | | |
104 | 118 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5995 | 5995 | | |
5996 | 5996 | | |
5997 | 5997 | | |
5998 | | - | |
| 5998 | + | |
| 5999 | + | |
| 6000 | + | |
| 6001 | + | |
| 6002 | + | |
| 6003 | + | |
| 6004 | + | |
| 6005 | + | |
| 6006 | + | |
| 6007 | + | |
| 6008 | + | |
| 6009 | + | |
| 6010 | + | |
5999 | 6011 | | |
6000 | 6012 | | |
6001 | 6013 | | |
| |||
6141 | 6153 | | |
6142 | 6154 | | |
6143 | 6155 | | |
6144 | | - | |
6145 | | - | |
| 6156 | + | |
| 6157 | + | |
| 6158 | + | |
| 6159 | + | |
6146 | 6160 | | |
6147 | 6161 | | |
6148 | 6162 | | |
| |||
6152 | 6166 | | |
6153 | 6167 | | |
6154 | 6168 | | |
6155 | | - | |
| 6169 | + | |
| 6170 | + | |
| 6171 | + | |
| 6172 | + | |
| 6173 | + | |
6156 | 6174 | | |
6157 | 6175 | | |
6158 | 6176 | | |
| |||
6161 | 6179 | | |
6162 | 6180 | | |
6163 | 6181 | | |
6164 | | - | |
| 6182 | + | |
| 6183 | + | |
| 6184 | + | |
| 6185 | + | |
| 6186 | + | |
| 6187 | + | |
| 6188 | + | |
6165 | 6189 | | |
6166 | 6190 | | |
6167 | | - | |
6168 | | - | |
6169 | | - | |
6170 | | - | |
6171 | | - | |
| 6191 | + | |
| 6192 | + | |
6172 | 6193 | | |
6173 | | - | |
6174 | | - | |
6175 | | - | |
| 6194 | + | |
| 6195 | + | |
6176 | 6196 | | |
6177 | 6197 | | |
6178 | | - | |
| 6198 | + | |
| 6199 | + | |
| 6200 | + | |
| 6201 | + | |
| 6202 | + | |
| 6203 | + | |
| 6204 | + | |
| 6205 | + | |
6179 | 6206 | | |
6180 | 6207 | | |
6181 | 6208 | | |
6182 | 6209 | | |
6183 | 6210 | | |
6184 | 6211 | | |
6185 | | - | |
6186 | | - | |
6187 | 6212 | | |
6188 | 6213 | | |
6189 | 6214 | | |
6190 | | - | |
| 6215 | + | |
6191 | 6216 | | |
6192 | | - | |
| 6217 | + | |
6193 | 6218 | | |
6194 | 6219 | | |
6195 | 6220 | | |
| |||
6201 | 6226 | | |
6202 | 6227 | | |
6203 | 6228 | | |
| 6229 | + | |
6204 | 6230 | | |
6205 | | - | |
6206 | | - | |
6207 | | - | |
6208 | | - | |
6209 | | - | |
6210 | | - | |
6211 | | - | |
6212 | | - | |
6213 | | - | |
| 6231 | + | |
| 6232 | + | |
| 6233 | + | |
| 6234 | + | |
| 6235 | + | |
| 6236 | + | |
| 6237 | + | |
| 6238 | + | |
6214 | 6239 | | |
6215 | 6240 | | |
6216 | 6241 | | |
6217 | 6242 | | |
6218 | 6243 | | |
6219 | 6244 | | |
6220 | 6245 | | |
6221 | | - | |
6222 | | - | |
6223 | 6246 | | |
6224 | 6247 | | |
| 6248 | + | |
| 6249 | + | |
6225 | 6250 | | |
6226 | 6251 | | |
6227 | 6252 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
0 commit comments