Skip to content

Parsing fails for postgres queries with CTE's that use MATERIALIZED keyword #1147

@ReppCodes

Description

@ReppCodes

Hi! I'm seeing parsing failures for Postgres queries that use the MATERIALIZED keyword.

Minimal repro in the format of a sqlparser-rs test:

#[test]
fn parse_mat_cte() {
    let sql = r#"WITH cte AS MATERIALIZED ( select id from accounts ) select id from cte;"#;
    pg().verified_stmt(sql);

    let sql2 = r#"WITH cte AS NOT MATERIALIZED ( select id from accounts ) select id from cte;"#;
    pg().verified_stmt(sql2);
}

I tested this on two versions, including the latest:

sqlparser = "0.43.1"
# sqlparser = "0.36.1"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions