cockroachdb / cockroachdb/cockroach

sql: allow grouping digits in numeric constants with underscores

Open
#111,038 0 comments 0 reactions 0 assignees View on GitHub
C-enhancement E-quick-win T-sql-queries
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

The SQL:2023 spec includes a new syntax that allows digits in numeric constants to be group by underscores.

From section 5.3:

> 22) An _unsigned decimal integer_ that immediately contains _underscore_s is equivalent to the same _unsigned decimal integer_ with every _underscore_ removed.
> 23) An _unsigned hexadecimal integer_ that immediately contains _underscore_s is equivalent to the same _unsigned hexadecimal integer_ with every _underscore_ removed.
> 24) An _unsigned octal integer_ that immediately contains _underscore_s is equivalent to the same _unsigned octal integer_ with every _underscore_ removed.
> 25) An _unsigned binary integer_ that immediately contains _underscore_s is equivalent to the same _unsigned binary integer_ with every _underscore_ removed.

Postgres added support for this in Postgres 16. See: http://peter.eisentraut.org/blog/2023/09/20/grouping-digits-in-sql

Note that this is dependent on addressing #111037 first.

Jira issue: CRDB-31736

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.