Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Allow DELETED and INSERTED keywords as identifiers outside OUTPUT clauses#2386

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
Copilot wants to merge7 commits intodevelop
base:develop
Choose a base branch
Loading
fromcopilot/limit-deleted-keyword-impact

Conversation

Copy link
Contributor

CopilotAI commentedDec 16, 2025
edited
Loading

COMPLETED - Limit the impact of using the keyword: DELETED

Summary

Successfully limited the impact of the DELETED keyword. It can now be used as:

  • ✅ Table names
  • ✅ Column names
  • ✅ Table aliases
  • ✅ Column aliases
  • ✅ In WHERE, ORDER BY, GROUP BY clauses

OUTPUT clause functionality with DELETED.* and INSERTED.* is fully preserved.

Recent Fix

Fixed test2223 failures by restoring ORDER keyword to NonReserved grammar rule. During code reformatting, ORDER was accidentally removed from the grammar rule while it remained in the JavaScript array, causing parser error recovery to fail.

Changes Made

Grammar Changes (src/alasqlparser.jison)

  1. Added DELETED and INSERTED to NonReserved list: Both in the grammar rule and the JavaScript array. This allows the parser's error recovery mechanism to treat these keywords as regular identifiers when appropriate.

  2. Added standalone Column rules with detailed comments:

    • Lines 1246-1251: DELETED DOT Literal patterns for OUTPUT pseudo-table (uppercase 'DELETED' tableid)
    • Lines 1258-1266: Standalone DELETED/INSERTED patterns for regular identifiers (lowercase columnid)
    • Comments explain rule ordering, casing rationale, and SQL case-insensitive behavior
  3. Preserved existing OUTPUT clause functionality: No changes to existing DELETED DOT Literal patterns

Test Coverage (test/test2360.js)

Created comprehensive test file with 15 test cases - all passing ✓

  • DELETED as table name
  • DELETED as column name
  • DELETED in OUTPUT clauses (existing functionality)
  • DELETED as table and column aliases
  • DELETED in WHERE, ORDER BY, GROUP BY clauses
  • Combined usage scenarios

Verification

  • ✅ All 15 DELETED keyword tests pass
  • ✅ All 8 ORDER keyword tests pass (test2223)
  • ✅ All 23 existing OUTPUT clause tests still pass
  • ✅ No regressions in other test files

Known Limitation

Qualified column references likedeleted.column when "deleted" is a user-defined table name (not the OUTPUT pseudo-table) may create ambiguity. Workaround: use table aliases or unqualified references.

Original prompt

This section details on the original issue you should resolve

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

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 namedtest0000.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 runyarn jison && yarn test

Always runyarn format before committing.

</issue_description>

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


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn moreCopilot coding agent tips in the docs.

CopilotAI changed the title[WIP] Limit the impact of using the keyword: DELETEDAllow DELETED and INSERTED keywords as identifiers outside OUTPUT clausesDec 16, 2025
CopilotAI requested a review frommathiasrwDecember 16, 2025 23:06
@mathiasrwmathiasrwforce-pushed thecopilot/limit-deleted-keyword-impact branch from56b5c03 toe75294aCompareDecember 17, 2025 13:39
@mathiasrw
Copy link
Member

@copilot

.............!

782 passing (2s)
30 pending
1 failing

  1. Test 2223 - ORDER as context-aware keyword
    B) ORDER as a column name:
    Error: Parsing halted while starting to recover from another error.
    at Parser.parse (dist/alasql.fs.js:2289:27)
    at alasql.parse (dist/alasql.fs.js:4713:22)
    at alasql.dexec (dist/alasql.fs.js:4974:16)
    at alasql.exec (dist/alasql.fs.js:4928:17)
    at alasql (dist/alasql.fs.js:137:17)
    at Context. (test/test2223.js:37:3)
    at process.processImmediate (node:internal/timers:485:21)

Copy link
ContributorAuthor

@copilot

...

Fixed in commit80045dc. The ORDER keyword was accidentally removed from the NonReserved grammar rule during code reformatting. All test2223 tests now pass.

CopilotAIand others added6 commitsDecember 18, 2025 01:00
Co-authored-by: mathiasrw <1063454+mathiasrw@users.noreply.github.com>
Co-authored-by: mathiasrw <1063454+mathiasrw@users.noreply.github.com>
Co-authored-by: mathiasrw <1063454+mathiasrw@users.noreply.github.com>
Co-authored-by: mathiasrw <1063454+mathiasrw@users.noreply.github.com>
@mathiasrwmathiasrwforce-pushed thecopilot/limit-deleted-keyword-impact branch from80045dc toe3c5746CompareDecember 17, 2025 14:00
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@mathiasrwmathiasrwAwaiting requested review from mathiasrw

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Limit the impact of using the keyword: DELETED

2 participants

@mathiasrw

[8]ページ先頭

©2009-2025 Movatter.jp