Re: Non-decimal integer literals - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Non-decimal integer literals
Date
Msg-id 3260805.1631106874@sss.pgh.pa.us
Whole thread Raw
In response to Re: Non-decimal integer literals  (Vik Fearing <vik@postgresfriends.org>)
Responses Re: Non-decimal integer literals
List pgsql-hackers
Vik Fearing <vik@postgresfriends.org> writes:
> On 8/16/21 11:51 AM, Peter Eisentraut wrote:
>> Here is a patch to add support for hexadecimal, octal, and binary
>> integer literals:
>> 
>>     0x42E
>>     0o112
>>     0b100101
>> 
>> per SQL:202x draft.

> Is there any hope of adding the optional underscores?  I see a potential
> problem there as SELECT 1_a; is currently parsed as SELECT 1 AS _a; when
> it should be parsed as SELECT 1_ AS a; or perhaps even as an error since
> 0x1_a would be a valid number with no alias.

Even without that point, this patch *is* going to break valid queries,
because every one of those cases is a valid number-followed-by-identifier
today, e.g.

regression=# select 0x42e;
 x42e 
------
    0
(1 row)

AFAIR we've seen exactly zero field demand for this feature,
so I kind of wonder why we're in such a hurry to adopt something
that hasn't even made it past draft-standard status.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Daniel Gustafsson
Date:
Subject: Re: On login trigger: take three
Next
From: Fujii Masao
Date:
Subject: Re: Possible missing segments in archiving on standby