Skip to content

Problem quoting alias for columns #606

Closed

Description

@loque

I've found a problem when alasql parses the query string. When trying to give a column an alias with spaces I got errors when using " and '. I think it would be useful to explain in the wiki that aliases can only be quoted like this:

SELECT SUM(I_dont_like_this_name) AS `Fancy Name` FROM table_name

For reference, the error messages I got where, in Chromium SyntaxError: Unexpected identifier, and in Firefox SyntaxError: missin ] in index expression

Activity

  1. agershun commented on Feb 26, 2016

    @agershun
    Member

    Hi Lucas,

    1. You also can use [ ] to enclose these 'multiword' name (not only backquotes ) like :
    SELECT ... AS [Fancy Name] FROM table_name
    1. When you wrote about quotes in the alias names, did you mean this syntax like this:
    SELECT ... AS "Fancy Name" FROM table_name

    I will check the parser grammar rules for this syntax.

  2. loque commented on Feb 26, 2016

    @loque
    Author

    Hi @agershun,

    Good to know about the []!

    Exactly, the syntax in the following examples did not work:

    SELECT ... AS "Fancy Name" FROM table_name
    SELECT ... AS 'Fancy Name' FROM table_name

    Btw, I really appreciate the work you've done with AlaSQL!

  3. added a commit that references this issue on Dec 15, 2025
    4992fcb
  4. mathiasrw commented on Dec 15, 2025

    @mathiasrw
    Member

    Fix released as part of v4.14.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions