mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	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
This commit is contained in:
		@@ -4121,6 +4121,7 @@ opt_by:		BY				{}
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
NumericOnly:
 | 
					NumericOnly:
 | 
				
			||||||
			FCONST								{ $$ = makeFloat($1); }
 | 
								FCONST								{ $$ = makeFloat($1); }
 | 
				
			||||||
 | 
								| '+' FCONST						{ $$ = makeFloat($2); }
 | 
				
			||||||
			| '-' FCONST
 | 
								| '-' FCONST
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					$$ = makeFloat($2);
 | 
										$$ = makeFloat($2);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user