Closed BEN00262 closed 2 years ago
The SQL standard defines:
<key word> ::=
<reserved word>
| <non-reserved word>
NAME
falls in the list of non-reserved words. As far as I can tell, the standard doesn't have a rule saying an <identifier>
cannot be a <non-reserved word>
but this will cause problems with the parser if NAME
needs to be a keyword in the future. So as a precautionary measure I register all key words in the parser as off limits.
I realize it's kind of annoying for many common words, but it seems like the safer option to just disallow them all now. You can use "name"
.
That being said, I think the error message should be clearer with a suggestion so it's not so bizarre:
syntax error: near "NAME" (using key word as identifier?)
@BEN00262 Turns out you can use non reserved words as identifiers: https://github.com/elliotchance/vsql/releases/tag/v0.24.1
Hi was trying to create a table with 'name' as a column but got a crash, looking into the lexer i realized that name is marked as a keyword. Is this by design?