Skip to content

Support Clickhouse ASSUME table constraints (and remove required parenthetical) #2466

Description

@pelovett

Hello, currently Clickhouse's ASSUME table constraints generate parse errors:

$ cat assume_test.sql
CREATE TABLE my_table (
    `date` Date,
    CONSTRAINT my_constraint ASSUME (date > '2025-01-01')
)
ENGINE = MergeTree
;

$ cargo run --features json_example --example cli assume_test.sql --clickhouse
    Finished [`dev` profile [unoptimized + debuginfo]](https://doc.rust-lang.org/cargo/reference/profiles.html#default-profiles) target(s) in 0.01s
     Running `target/debug/examples/cli assume_test.sql --clickhouse`
Parsing from file 'assume_test.sql' using ClickHouseDialect
2026-08-31T00:27:53.248Z DEBUG [sqlparser::parser] Parsing sql 'CREATE TABLE my_table (
    `date` Date,
    CONSTRAINT my_constraint ASSUME (date > '2025-01-01')
)
ENGINE = MergeTree
;
'...
Error during parsing: ParserError("Expected: PRIMARY, UNIQUE, FOREIGN, CHECK, or EXCLUDE, found: ASSUME at Line: 3, Column: 30")

In addition, in Clickhouse table constraint expressions aren't required to have top-level parenthesis. We should support these dialect attributes for Clickhouse.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions