Skip to content

Parse EXCEPT with a single column without brackets - #349

Merged
git-hulk merged 5 commits into
AfterShip:masterfrom
f0mster:except-single-column-without-parens
Nov 25, 2026
Merged

git-hulk merged 5 commits into
AfterShip:masterfrom
f0mster:except-single-column-without-parens

Conversation

@f0mster

@f0mster f0mster commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

ClickHouse accepts a single column after a * / t.* transformer without brackets and prints it that way itself:

SELECT * EXCEPT b FROM t
SELECT t.* EXCEPT b, c FROM t

The parser only accepted EXCEPT (b) and failed with expected '(', but got '<ident>'. ClickHouse writes this form back in system.tables.create_table_query, so materialized views that use it could not be parsed from a schema dump.

EXCEPT col is now parsed into the same modifier as EXCEPT (col), so the formatter prints EXCEPT(col).

Checked against ClickHouse 26.3 (EXPLAIN SYNTAX and execution): SELECT * EXCEPT b, SELECT t.* EXCEPT b, 3 AS c (the comma starts the next select item), SELECT * EXCEPT b EXCEPT a.

Fixture: parser/testdata/query/select_column_except_without_brackets.sql.

@git-hulk
git-hulk merged commit 6fbf938 into AfterShip:master Nov 25, 2026
2 checks passed
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