Skip to content

PostgreSqlDialect rejects PostgreSQL's CREATE STATISTICS statement for defining extended statistics on a table. #3035

Open

Description

@lei-jia-xing

Reproduction

With sqlparser = "=0.64.0":

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

fn main() {
    let sql = "CREATE STATISTICS s ON a, b FROM t;";
    match Parser::parse_sql(&PostgreSqlDialect {}, sql) {
        Ok(statements) => println!("{statements:?}"),
        Err(error) => println!("{error}"),
    }
}

Actual behavior

sql parser error: Expected: an object type after CREATE, found: STATISTICS at Line: 1, Column: 8

Expected behavior

Parse the SQL as a single statement, with the statistics object name, target table, and column list represented in the AST.

PostgreSQL documentation for CREATE STATISTICS

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