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

Wrong report of syntax error if FORMAT clause is used #8455

Open
aafemt opened this issue Feb 28, 2025 · 2 comments
Open

Wrong report of syntax error if FORMAT clause is used #8455

aafemt opened this issue Feb 28, 2025 · 2 comments

Comments

@aafemt
Copy link
Contributor

aafemt commented Feb 28, 2025

Following query reports correct error (except "source column" part):

SQL> select cast('1-1-1 1:1:1.1' as abc) from rdb$database;
Statement failed, SQLSTATE = 42000
Dynamic SQL Error
-SQL error code = -607
-Invalid command
-Specified domain or source column ABC does not exist

Following error is incorrect:

SQL> select cast('1-1-1 1:1:1.1' as abc format 'yyyy-mm-dd hh24:mi:ss.ff4') from rdb$database;
Statement failed, SQLSTATE = 42000
Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, column 36
-format
@mrotteveel
Copy link
Member

mrotteveel commented Feb 28, 2025

I'm not sure that is really "wrong". In the first case, it's syntactically valid, but there is no domain with the specified name, and in the second case you have an invalid syntax, so a token unknown error is expected (or at least, only CHAR/VARCHAR/TIMESTAMP/TIME/DATE are supported here through cast_format_type).

Sure, it would be possible to adjust the parser to produce better errors, but there are a lot of other cases in the Firebird parser that result in a token unknown error if you make syntax errors.

@aafemt
Copy link
Contributor Author

aafemt commented Feb 28, 2025

Consider a little mistype in datatype name. For example datetime instead of timestamp. The error in this case become very puzzling and misguiding.

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

No branches or pull requests

2 participants