Non-decimal integer literals

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Non-decimal integer literals
Date: 2021-08-16 09:51:50
Message-ID: b239564c-cad0-b23e-c57e-166d883cb97d@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Here is a patch to add support for hexadecimal, octal, and binary
integer literals:

0x42E
0o112
0b100101

per SQL:202x draft.

This adds support in the lexer as well as in the integer type input
functions.

Those core parts are straightforward enough, but there are a bunch of
other places where integers are parsed, and one could consider in each
case whether they should get the same treatment, for example the
replication syntax lexer, or input function for oid, numeric, and
int2vector. There are also some opportunities to move some code around,
for example scanint8() could be in numutils.c. I have also looked with
some suspicion at some details of the number lexing in ecpg, but haven't
found anything I could break yet. Suggestions are welcome.

Attachment Content-Type Size
v1-0001-Non-decimal-integer-literals.patch text/plain 22.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Meskes 2021-08-16 10:06:16 Re: ECPG bug fix: DECALRE STATEMENT and DEALLOCATE, DESCRIBE
Previous Message Wenjing 2021-08-16 09:15:05 Is it worth pushing conditions to sublink/subplan?