Skip to content

Reject invalid numeric underscore separators - #2426

Draft
fyrsta7 wants to merge 1 commit into
apache:mainfrom
fyrsta7:fix/numeric-underscore-separators
Draft

Reject invalid numeric underscore separators#2426
fyrsta7 wants to merge 1 commit into
apache:mainfrom
fyrsta7:fix/numeric-underscore-separators

Conversation

@fyrsta7

@fyrsta7 fyrsta7 commented Aug 4, 2026

Copy link
Copy Markdown

Summary

Fixes #2421 by rejecting invalid numeric underscore separators for dialects that support underscores in numeric literals.

Details

Numeric separators should appear between digits. This keeps valid literals such as 10_000 and 1_000.123_456, while rejecting trailing, consecutive, and decimal-point-adjacent underscores such as 10_00_, 10___0, 1_000.123_, and 1._000.

The change adds coverage at both the tokenizer and parser test levels.

Validation

  • git diff --check
  • cargo fmt --all --check
  • cargo test tokenize_numeric_literal_underscore -- --nocapture
  • cargo test parse_numeric_literal_underscore --test sqlparser_common -- --nocapture
  • cargo test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

postgres parser: multiple or trailing underscores should error

1 participant