Skip to content
/ server Public

Conversation

@abhishek593
Copy link

The main contributions of this PR are:

  • Added function get_numeric_token(), which is a wrapper around get_token() and it checks if there's an underscore in the current token.
  • Added helper function strip_underscores(), which just erases underscores from the current token.
  • Updated sql_lex.cc states (MY_LEX_NUMBER_IDENT, MY_LEX_INT_OR_REAL, MY_LEX_REAL) to permit single underscores between digits in decimal, hexadecimal, and binary literals.
  • New Test Suite: Added mysql-test/main/numeric_underscores.test covering all possible cases.

New validation rules:

  • Only a single underscore is allowed between digits.
  • Consecutive underscores are prohibited (e.g., 1__000 is an error).
  • An underscore cannot appear at the end of a numeric literal.
  • An underscore cannot appear adjacent to a decimal point . or exponent marker e/E (e.g., 1_.0 and 1_e10 are invalid).
  • Underscore is allowed immediately after the base prefix (e.g., 0x_FF, 0b_10).

@gkodinov gkodinov added the External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. label Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements.

Development

Successfully merging this pull request may close these issues.

2 participants