pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Inconsistent syntax for NumericOnly grammar production
2+ messages / 2 participants
[nested] [flat]

Commits from this thread:
  2017-05-29 ce50945295 dd1daa03bc 096221e85d 4051dfe596 7d9309fca5 a653606709  Allow NumericOnly to be "+ FCONST".
* Inconsistent syntax for NumericOnly grammar production
@ 2017-05-28 21:16  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: Tom Lane @ 2017-05-28 21:16 UTC (permalink / raw)
  To: pgsql-hackers

I noticed that gram.y has

NumericOnly:
            FCONST                              { $$ = makeFloat($1); }
            | '-' FCONST
                {
                    $$ = makeFloat($2);
                    doNegateFloat($$);
                }
            | SignedIconst                      { $$ = makeInteger($1); }
        ;

but

SignedIconst: Iconst                                { $$ = $1; }
            | '+' Iconst                            { $$ = + $2; }
            | '-' Iconst                            { $$ = - $2; }
        ;

The inconsistency here means that you can do, for example,

regression=# set random_page_cost = +4;
SET
regression=# set random_page_cost = 4.2;
SET

but not

regression=# set random_page_cost = +4.2;
ERROR:  syntax error at or near "4.2"
LINE 1: set random_page_cost = +4.2;
                                ^

That's weird enough in itself, and the problem is about to get more
widespread because the partbound_datum production depends on NumericOnly.

Any objections to allowing "+ FCONST" here?  I'm inclined to
fix this and back-patch it as well.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Inconsistent syntax for NumericOnly grammar production
@ 2017-05-29 13:31  Vik Fearing <vik.fearing@2ndquadrant.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Vik Fearing @ 2017-05-29 13:31 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-hackers

On 05/28/2017 11:16 PM, Tom Lane wrote:
> The inconsistency here means that you can do, for example,
> 
> regression=# set random_page_cost = +4;
> SET
> regression=# set random_page_cost = 4.2;
> SET
> 
> but not
> 
> regression=# set random_page_cost = +4.2;
> ERROR:  syntax error at or near "4.2"
> LINE 1: set random_page_cost = +4.2;
>                                 ^
> Any objections to allowing "+ FCONST" here?  I'm inclined to
> fix this and back-patch it as well.

Seems like the right thing to do; no objections here.
-- 
Vik Fearing                                          +33 6 46 75 15 36
http://2ndQuadrant.fr     PostgreSQL : Expertise, Formation et Support


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2017-05-29 13:31 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-05-28 21:16 Inconsistent syntax for NumericOnly grammar production Tom Lane <tgl@sss.pgh.pa.us>
2017-05-29 13:31 ` Vik Fearing <vik.fearing@2ndquadrant.com>

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