Skip to content

ClickHouseDialect rejects the storage engine clause in CREATE MATERIALIZED VIEW. #3038

Open

Description

@lei-jia-xing

Reproduction

With sqlparser = "=0.64.0":

use sqlparser::{dialect::ClickHouseDialect, parser::Parser};

fn main() {
    let sql = "CREATE MATERIALIZED VIEW mv ENGINE = Memory AS SELECT 1 AS x;";
    match Parser::parse_sql(&ClickHouseDialect {}, sql) {
        Ok(statements) => println!("{statements:?}"),
        Err(error) => println!("{error}"),
    }
}

Actual behavior

sql parser error: Expected: AS, found: ENGINE at Line: 1, Column: 29

Expected behavior

Parse the materialized view definition and preserve ENGINE = Memory in the AST. ClickHouse documents an ENGINE clause for materialized views that store their own data.

ClickHouse materialized view syntax · Related TO clause issue #1312

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions