]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Allow NumericOnly to be "+ FCONST".
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 29 May 2017 19:19:07 +0000 (15:19 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 29 May 2017 19:19:07 +0000 (15:19 -0400)
commit7d9309fca51b0a50734ae9d83a668e422e46a997
treed62c6e4089ddb81d46faf00e3c437e9d4a26e149
parent525780c6221b8635f9b1fcb1e9e2b455af93ac21
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
src/backend/parser/gram.y