pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@postgreSQL.org
Subject: Inconsistent syntax for NumericOnly grammar production
Date: Sun, 28 May 2017 17:16:24 -0400
Message-ID: <30908.1496006184@sss.pgh.pa.us> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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



view thread (2+ messages)  latest in thread

Message-ID: <30908.1496006184@sss.pgh.pa.us>
Permalink:  ../30908.1496006184@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/30908.1496006184@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: Inconsistent syntax for NumericOnly grammar production
  In-Reply-To: <30908.1496006184@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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