Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trailing commas in SELECT clauses aren't supported with aliases #50998

Open
Algunenano opened this issue Jun 14, 2023 · 1 comment · May be fixed by #59236
Open

Trailing commas in SELECT clauses aren't supported with aliases #50998

Algunenano opened this issue Jun 14, 2023 · 1 comment · May be fixed by #59236

Comments

@Algunenano
Copy link
Member

Trailing commas was added recently (#48438) to support some cases, but it fails if the last expression contains an alias

Works:

Select
    sum(number) as s,
    number,
FROM numbers(10)
GROUP BY number

Works:

Select
    number,
    sum(number),
FROM numbers(10)
GROUP BY number

Doesn't work and gives a bad error:

Select
    number,
    sum(number) as s,
FROM numbers(10)
GROUP BY number
Syntax error: failed at position 47 ('numbers') (line 4, col 6):

Select
    number,
    sum(number) as s,
FROM numbers(10)
GROUP BY number

Expected one of: token, Dot, OR, AND, IS NULL, IS NOT NULL, BETWEEN, NOT BETWEEN, LIKE, ILIKE, NOT LIKE, NOT ILIKE, REGEXP, IN, NOT IN, GLOBAL IN, GLOBAL NOT IN, MOD, DIV, alias, AS, Comma, FROM, PREWHERE, WHERE, GROUP BY, WITH, HAVING, WINDOW, ORDER BY, LIMIT, OFFSET, SETTINGS, UNION, EXCEPT, INTERSECT, INTO OUTFILE, FORMAT, end of query

Refs #40192

@movy
Copy link

movy commented Nov 9, 2023

Not sure if it belongs here, but is supporting trailing commas in other clauses (i.e. ORDER BY, GROUP BY etc) on the todo list? Lack of support for trailing commas is annoying as it is, but currently it's inconsistent across even a single query: columns can be freely rearranged / commented out in SELECT, but not in other clauses (requires attention to commas). This single matter causes most frustration with Clickhouse so far. Such a great product, but such an ubiquitous (yet seemingly easy to fix) annoyance.

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

Successfully merging a pull request may close this issue.

2 participants