Skip to content

Conversation

@sgress454
Copy link
Owner

@sgress454 sgress454 commented Dec 2, 2025

This PR updates the list of reserved words that cannot be used unquoted as identifiers. The list was generated using a C program that iterates over the full set of keywords in SQLite and attempts to do CREATE TABLE t(<keyword> INTEGER); for each one, tracking which keywords fail. Many words that were previously in the reservedMap passed this test and have been removed.

Removing items from that list prompted a bit of yak shaving:

  • The alias_ident rule has been split into alias_ident_explicit (i.e. using AS) and alias_ident_implicit (not using AS, e.g. SELECT * FROM foo bar WHERE bar.val = 1).
  • A new invalidImplicitAliasMap is added (generated using the same C program) to track which keywords cannot be used as implicit aliases. There's a lot of overlap with reserveredMap, but there are items exclusive to both lists.
  • More joins have been implemented. RIGHT joins were previously incorrectly parsed as aliases because the join_op rule didn't implement them, but now they were broken entirely, so I went ahead and implemented them + other missing joins.
  • Added tests for all joins
  • The alter_table_stmt rule now only supports one table name (which is correct for SQLite), as the previous rule was not compatible with the alias rule updates. That rule used table_ref_list which supports aliases for table names, which caused the parser to interpret things like RENAME as table aliases. Aliases are not valid in ALTER TABLE statements.

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.

2 participants