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

Support PostgreSQL json_to_record / jsonb_to_record syntax #1375

Open
guspower opened this issue Aug 11, 2024 · 0 comments
Open

Support PostgreSQL json_to_record / jsonb_to_record syntax #1375

guspower opened this issue Aug 11, 2024 · 0 comments

Comments

@guspower
Copy link

Current state:

PostgreSQL json_to_record / jsonb_to_record syntax raises a ParseError:

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

fn main() {
    let sql = r#"select * from json_to_record('{"a":1,"b":[1,2,3],"c":[1,2,3],"e":"bar"}') as x(a int, b text, c int[], d text);"#;
    let dialect = PostgreSqlDialect {};
    let ast = Parser::parse_sql(&dialect, sql).unwrap();

    println!("AST: {:?}", ast);
}

Future state:

json_to_record / jsonb_to_record syntax supported.

Additional:

As per the postgresql docs - search for json_to_record (no deep link)

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

No branches or pull requests

1 participant