Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 16, 2025

ORDER was a reserved keyword in all contexts, preventing its use as table names, column names, or JSON properties. This follows the same pattern as PR #2203 for VALUE/VALUES keywords.

Changes

  • Grammar (src/alasqlparser.jison): Added ORDER to NonReserved rule and nonReserved array
  • Tests (test/test2223.js): 8 test cases covering table names, column names, JSON properties, and ORDER BY preservation

Example

// Now works - ORDER as table and column name
CREATE TABLE order (id INT, order INT, status STRING)
SELECT * FROM order ORDER BY order DESC

// Now works - ORDER in JSON properties  
CREATE INDEX idx ON products(data->order)

// Still works - ORDER BY clause unchanged
SELECT * FROM products ORDER BY price ASC

The parser's error recovery mechanism (| error NonReserved in Literal rule) handles context-aware behavior automatically - ORDER remains reserved for ORDER BY syntax but accepts it as an identifier elsewhere.

Original prompt

This section details on the original issue you should resolve

<issue_title>Limit the impact of using the keyword: ORDER</issue_title>
<issue_description>Limit the impact of using the keyword: ORDER

Just like in #2203 we want to limit the impact of having keywords. Preferably by making them keywords only in the context needed so the string/word can be used for things like table names and column names i the data - if possible. It might be too much of a hassle to make the impact less, but lets investigate what is possible - still sticking to the SQL-99 specs.

Start by making a test file named test0000.js where 0000 is the issue ID of this ticket. Replicate the use and mimic what usecases could make sense to test, like as a table name, as a column name, as a graph search. Things lke that.

The grammar can be updated in alasqlgrammar.jison. Focus on small precise changes. After updating it we need to run yarn jison && yarn test

Always run yarn format before committing.

</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Limit the impact of using the keyword ORDER Make ORDER a context-aware keyword Dec 16, 2025
Copilot AI requested a review from mathiasrw December 16, 2025 23:00
@mathiasrw mathiasrw marked this pull request as ready for review December 17, 2025 12:44
@mathiasrw mathiasrw merged commit 5d5bce7 into develop Dec 17, 2025
20 checks passed
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.

Limit the impact of using the keyword: ORDER

2 participants