Skip to content

fix(parser): Limit named PK parsing to MySQL only#6991

Merged
georgesittas merged 1 commit intomainfrom
vaggelisd/clickhouse_tuple
Feb 6, 2026
Merged

fix(parser): Limit named PK parsing to MySQL only#6991
georgesittas merged 1 commit intomainfrom
vaggelisd/clickhouse_tuple

Conversation

@VaggelisD
Copy link
Collaborator

@VaggelisD VaggelisD commented Feb 6, 2026

Fixes #6989

The regression is due to #6389 as it tried to parse MySQL's named primary keys such as PRIMARY KEY name (...), which now trips up for Clickhouse's PRIMARY KEY tuple (...).

I don't think named primary keys exist outside of MySQL (it itself seems to discard the name anyways) so I opted out of using a parser flag to generalize the behavior.

# Naming the PK does not work
:) CREATE TABLE test_table (id Int32, name String) ENGINE=MergeTree PRIMARY KEY "foo" (id);
Code: 46. DB::Exception: Unknown function foo: While processing foo(id). (UNKNOWN_FUNCTION)

# tuple() works
:) CREATE TABLE test_table (id Int32, name String) ENGINE=MergeTree PRIMARY KEY tuple();
OK

# wrapped tuple() also works
:) CREATE TABLE test_table (id Int32, name String) ENGINE=MergeTree PRIMARY KEY (tuple());
OK

Docs

Clickhouse PK

@georgesittas georgesittas merged commit 836cc60 into main Feb 6, 2026
13 checks passed
@georgesittas georgesittas deleted the vaggelisd/clickhouse_tuple branch February 6, 2026 14:53
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.

ClickHouse: Cannot parse PRIMARY KEY tuple() (empty tuple) in v28

2 participants