Skip to content

Parse() then AST.toString() doesn't restore square brackets on column name #1740

@andymcmullan

Description

@andymcmullan

If a column name requires square brackets, e.g. due to a space or a period in the column name, toString() on the AST loses the brackets resulting in incorrect SQL.

For example

const ast = alasql.parse('SELECT [Foo Bar] FROM tbl');
console.log(ast.toString());

gives SELECT Foo Bar FROM tbl instead of SELECT [Foo Bar] FROM tbl

Similarly:

const ast = alasql.parse('SELECT [Foo.Bar] FROM tbl');
console.log(ast.toString());

gives SELECT Foo.Bar FROM tbl instead of SELECT [Foo.Bar] FROM tbl

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions