Skip to content

doesn't parse pgcrypto #1066

Closed
Closed
@justinabrahms

Description

@justinabrahms

In my pg_dump, I have this line, which isn't parseable by this library.

CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA public;

Running:

[nix-shell:~/dir]$ cargo run 
   Compiling sql2png v0.1.0 (/.../dir)
    Finished dev [unoptimized + debuginfo] target(s) in 0.22s
     Running `target/debug/sql2png`
AST: Err(ParserError("Expected an object type after CREATE, found: EXTENSION at Line: 23, Column 8"))

Code:

use sqlparser::dialect::PostgreSqlDialect;
use sqlparser::parser::Parser;
use std::fs;

fn main() {
    let dialect = PostgreSqlDialect {};
    // TODO:ARGS
    let sql = fs::read_to_string("../something/out.sql").expect("File needs to exist");
    let ast = Parser::parse_sql(&dialect, &sql);
    println!("AST: {:?}", ast)
}

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