Skip to content

Switch query parser to pg_query.rs #620

Open
@mdashti

Description

@mdashti

Is your feature request related to a problem? Please describe.
Currently, pgcat is using sqlparser-rs to parse user queries. That's taken us to where we are today, which is great. However, sqlparser-rs does not correctly parse all PostgreSQL queries. There are already some open PRs to fix the known issues (e.g., apache/datafusion-sqlparser-rs#1000 and apache/datafusion-sqlparser-rs#1002), but it's not going to be 100% PG compatible.

Describe the solution you'd like
The closest to PostgreSQL parser that we can get is to use the PostgreSQL parser itself :)

Here's the maintained (extracted) C library: libpg_query, and here's its port to Rust (by pganalyze): pg_query.rs

I wanted to ask for everyone's opinion (especially the main pgcat maintainers) about changing our SQL parser from sqlparser-rs to pg_query.rs. If I see enough support for this change, I can put-together a PR for it.

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