pgsql: Non-decimal integer literals

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Non-decimal integer literals
Date: 2022-12-14 05:31:41
Message-ID: E1p5KMm-003Uhn-Nb@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Non-decimal integer literals

Add support for hexadecimal, octal, and binary integer literals:

0x42F
0o273
0b100101

per SQL:202x draft.

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

Reviewed-by: John Naylor <john(dot)naylor(at)enterprisedb(dot)com>
Reviewed-by: Zhihong Yu <zyu(at)yugabyte(dot)com>
Reviewed-by: David Rowley <dgrowleyml(at)gmail(dot)com>
Reviewed-by: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Discussion: https://www.postgresql.org/message-id/flat/b239564c-cad0-b23e-c57e-166d883cb97d(at)enterprisedb(dot)com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/6fcda9aba83449082124825b6d375c0a61e21c42

Modified Files
--------------
doc/src/sgml/syntax.sgml | 34 +++++
src/backend/catalog/information_schema.sql | 6 +-
src/backend/catalog/sql_features.txt | 1 +
src/backend/parser/parse_node.c | 37 +++++-
src/backend/parser/scan.l | 101 +++++++++++----
src/backend/utils/adt/numutils.c | 185 +++++++++++++++++++++++----
src/fe_utils/psqlscan.l | 78 +++++++++---
src/interfaces/ecpg/preproc/pgc.l | 106 +++++++++-------
src/test/regress/expected/int2.out | 92 ++++++++++++++
src/test/regress/expected/int4.out | 92 ++++++++++++++
src/test/regress/expected/int8.out | 92 ++++++++++++++
src/test/regress/expected/numerology.out | 193 ++++++++++++++++++++++++++++-
src/test/regress/sql/int2.sql | 26 ++++
src/test/regress/sql/int4.sql | 26 ++++
src/test/regress/sql/int8.sql | 26 ++++
src/test/regress/sql/numerology.sql | 51 +++++++-
16 files changed, 1028 insertions(+), 118 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Etsuro Fujita 2022-12-14 09:53:53 Re: pgsql: postgres_fdw: Fix assertion in estimate_path_cost_size().
Previous Message Jeff Davis 2022-12-14 01:35:59 pgsql: Add grantable MAINTAIN privilege and pg_maintain role.