diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2017-05-29 15:19:07 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2017-05-29 15:19:07 -0400 |
commit | 096221e85d36ccf66aa5e9e867acd00385b1d9d8 (patch) | |
tree | fda18f3e5cec0d32fe0fc52d24a88a46dc7f52b4 /src | |
parent | 9ded5171951e9ac8a30d221b2b21e8408f101170 (diff) | |
download | postgresql-096221e85d36ccf66aa5e9e867acd00385b1d9d8.tar.gz postgresql-096221e85d36ccf66aa5e9e867acd00385b1d9d8.zip |
Allow NumericOnly to be "+ FCONST".
The NumericOnly grammar production accepted ICONST, + ICONST, - ICONST,
FCONST, and - FCONST, but for some reason not + FCONST. This led to
strange inconsistencies like
regression=# set random_page_cost = +4;
SET
regression=# set random_page_cost = 4000000000;
SET
regression=# set random_page_cost = +4000000000;
ERROR: syntax error at or near "4000000000"
(because 4000000000 is too large to be an ICONST). While there's
no actual functional reason to need to write a "+", if we allow
it for integers it seems like we should allow it for numerics too.
It's been like that forever, so back-patch to all supported branches.
Discussion: https://postgr.es/m/30908.1496006184@sss.pgh.pa.us
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/parser/gram.y | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index 411dbe2a6d2..67e9a1a0c7d 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -3670,6 +3670,7 @@ opt_by: BY {} NumericOnly: FCONST { $$ = makeFloat($1); } + | '+' FCONST { $$ = makeFloat($2); } | '-' FCONST { $$ = makeFloat($2); |