Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doesn't parse pgcrypto #1066

Closed
justinabrahms opened this issue Dec 14, 2023 · 1 comment · Fixed by #1078
Closed

doesn't parse pgcrypto #1066

justinabrahms opened this issue Dec 14, 2023 · 1 comment · Fixed by #1078

Comments

@justinabrahms
Copy link

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)
}
@alamb
Copy link
Contributor

alamb commented Dec 19, 2023

Thanks for the report @justinabrahms -- indeed it seems like the CREATE EXTENSION postgres syntax is not supported. It would be cool to add such support if anyone has time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants