Skip to content

[Postgres]: ? JSON operator cannot be parsed without a space after the field name #1992

@lukapeschke

Description

@lukapeschke

When using PostgreSqlDialect, the question mark cannot be parsed if it is not followed by a space, whereas postgres accepts the query. The following code panics when parsing broken:

fn main() {
    let broken = r#"SELECT user?'adress' FROM my_table"#;
    let working = r#"SELECT user? 'adress' FROM my_table"#;

    let working_parsed =
        sqlparser::parser::Parser::parse_sql(&sqlparser::dialect::PostgreSqlDialect {}, working)
            .expect("Failed to parse SQL query");
    println!("{:?}", working_parsed);

    let broken_parsed =
        sqlparser::parser::Parser::parse_sql(&sqlparser::dialect::PostgreSqlDialect {}, broken)
            .expect("Failed to parse SQL query");
    println!("{:?}", broken_parsed);
}

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