Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Parse invalid numbers and throw an error #24799

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

brunokim
Copy link
Contributor

Description

Add a rule to parse numbers with invalid placement of underscores, either trailing, consecutive,
or beside the decimal point. Throw an error if such a number is found.

Note: numbers with a leading underscore are also invalid, but depending on the context
they are valid identifiers, e.g., LIMIT _123 is invalid, but SELECT _123 is not. Detecting these
cases would require deeper changes to the grammar, which may not be warranted just to
produce a better error message.

Additional context and related issues

#24784

Release notes

(x) Release notes are required, with the following suggested text:

## General
* Improve error message for invalid numbers. ({24784}`24784`)

@cla-bot cla-bot bot added the cla-signed label Jan 26, 2025
@brunokim brunokim changed the title Parse invalid numbers and throw an error [WIP] Parse invalid numbers and throw an error Jan 26, 2025
@kasiafi
Copy link
Member

kasiafi commented Jan 27, 2025

@brunokim I'm not sure if we want to replace one error message with the other.

The original issue discusses a case of evidently malformed numbers: 123__456.789.

However, like you noted, there are also other cases where the new error message will take over. One example is a column name starting with a number: SELECT 1_. In this case, we'd rather keep the old error message, which has a suggestion that the user should quote the column name: identifiers must not start with a digit; surround the identifier with double quotes.

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

Successfully merging this pull request may close these issues.

2 participants