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

Syntax error column name key in SQLite #80

Open
samal-rasmussen opened this issue Jun 7, 2024 · 2 comments
Open

Syntax error column name key in SQLite #80

samal-rasmussen opened this issue Jun 7, 2024 · 2 comments

Comments

@samal-rasmussen
Copy link

This:

CREATE TABLE key_value (key TEXT PRIMARY KEY, value TEXT

Results in:

Syntax Error: Unexpected "key"
Was expecting to see: "CHECK", "CONSTRAINT", "FOREIGN", "PRIMARY", "UNIQUE", identifier, or whitespace
--> undefined:1:25
  |
1 | CREATE TABLE key_value (key TEXT PRIMARY KEY, value TEXT;
  |                         ^
@nene
Copy link
Owner

nene commented Jun 9, 2024

Thanks for reporting.

I used this list of keywords in SQLite documentation, assuming none of these can be used as normal identifiers (as the text on that page suggests), but apparently not all of them are actually reserved keywords.

@nene nene changed the title Syntaxt error column name key Syntax error column name key in SQLite Jun 9, 2024
@samal-rasmussen
Copy link
Author

Yeah I did not look at anything at all before I just used key as a column name :D I didn't even know basic stuff like "A keyword in double-quotes is an identifier.". Thanks for linking to the keyword docs.

I was a bit surprised that a formatter would care about this, but of course the formatter uses a parser, which has more reason to care.

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