Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 30, 2025

Thank you for the time you are putting into AlaSQL!

Problem

alasql.parse() followed by AST.toString() was losing square brackets on column names with special characters:

var ast = alasql.parse('SELECT [Foo Bar] FROM tbl');
ast.toString(); // Returns "SELECT Foo Bar FROM tbl" - brackets lost

Changes

  • Modified Column.toString() in src/50expression.js to detect bracketed column IDs (object with val and wrap properties) and reconstruct proper bracket/backtick syntax
  • Added test/test1740.js with 6 test cases covering spaces, periods, special characters, multiple columns, and backticks

Note

The failing test046 (15 == 0) is a pre-existing issue on the develop branch, unrelated to these changes. It tests array bracket notation ([0], [1]) for array-of-arrays queries, which is a separate bug from the column name bracket notation ([Foo Bar]) addressed here.


✨ 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 mentioned this pull request Nov 30, 2025
Copilot AI changed the title [WIP] Add test file to verify fix for issue #1740 Fix issue #1740: Preserve square brackets and backticks in column names during AST.toString() Nov 30, 2025
Copilot AI requested a review from mathiasrw November 30, 2025 22:15
Copilot finished work on behalf of mathiasrw November 30, 2025 22:15
@mathiasrw mathiasrw marked this pull request as ready for review November 30, 2025 23:02
@mathiasrw mathiasrw merged commit 81d7712 into cohelp/akashyadav24/1782 Dec 1, 2025
2 checks passed
@mathiasrw mathiasrw deleted the copilot/sub-pr-2287 branch December 1, 2025 03:36
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