{"id":16225029,"url":"https://github.com/paupino/pg_parse","last_synced_at":"2025-04-30T21:30:22.979Z","repository":{"id":38324744,"uuid":"339206344","full_name":"paupino/pg_parse","owner":"paupino","description":"PostgreSQL parser for Rust that uses the actual PostgreSQL server source to parse SQL queries and return the internal PostgreSQL parse tree.","archived":false,"fork":false,"pushed_at":"2024-01-23T20:41:36.000Z","size":159,"stargazers_count":76,"open_issues_count":1,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-04T09:11:53.877Z","etag":null,"topics":["postgresql","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paupino.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-15T21:03:05.000Z","updated_at":"2024-11-20T19:42:37.000Z","dependencies_parsed_at":"2024-01-23T22:11:04.801Z","dependency_job_id":null,"html_url":"https://github.com/paupino/pg_parse","commit_stats":{"total_commits":48,"total_committers":3,"mean_commits":16.0,"dds":0.04166666666666663,"last_synced_commit":"93c1d43b70ecb6e29ee52c4b9b256fd49f913f6f"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paupino%2Fpg_parse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paupino%2Fpg_parse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paupino%2Fpg_parse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paupino%2Fpg_parse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paupino","download_url":"https://codeload.github.com/paupino/pg_parse/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251785309,"owners_count":21643453,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["postgresql","rust"],"created_at":"2024-10-10T12:26:48.327Z","updated_at":"2025-04-30T21:30:22.917Z","avatar_url":"https://github.com/paupino.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"pg_parse \u0026emsp; [![Build Status]][actions] [![Latest Version]][crates.io] [![Docs Badge]][docs]\n===========\n\n[Build Status]: https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fpaupino%2Fpg_parse%2Fbadge\u0026label=build\u0026logo=none\n[actions]: https://actions-badge.atrox.dev/paupino/pg_parse/goto\n[Latest Version]: https://img.shields.io/crates/v/pg_parse.svg\n[crates.io]: https://crates.io/crates/pg_parse\n[Docs Badge]: https://docs.rs/pg_parse/badge.svg\n[docs]: https://docs.rs/pg_parse\n\nPostgreSQL parser for Rust that uses the [actual PostgreSQL server source]((https://github.com/pganalyze/libpg_query)) to parse \nSQL queries and return the internal PostgreSQL parse tree.\n\n## Getting started\n\nAdd the following to your `Cargo.toml`\n\n```toml\n[dependencies]\npg_parse = \"0.11\"\n```\n\n## Example: Parsing a query\n\n```rust\nuse pg_parse::ast::Node;\n\nlet result = pg_parse::parse(\"SELECT * FROM contacts\");\nassert!(result.is_ok());\nlet result = result.unwrap();\nassert!(matches!(*\u0026result[0], Node::SelectStmt(_)));\n\n// We can also convert back to a string, if the `str` feature is enabled (enabled by default).\n#[cfg(feature = \"str\")]\nassert_eq!(result[0].to_string(), \"SELECT * FROM contacts\");\n```\n\n## What's the difference between pg_parse and pg_query.rs?\n\nThe [`pganalyze`](https://github.com/pganalyze/) organization maintains the official implementation: [`pg_query.rs`](https://github.com/pganalyze/pg_query.rs). This\nclosely resembles the name of the C library also published by the team (`libpg_query`). This implementation uses the protobuf \ninterface introduced with version 13 of `libpg_query`.\n\nThis library similarly consumes `libpg_query` however utilizes the older JSON interface to manage parsing. The intention of this library\nis to maintain a dependency \"light\" implementation with `serde` and `serde_json` being the only required runtime dependencies. \n\nSo which one should you use? You probably want to use the official `pg_query.rs` library as that will continue to be \nkept closely up to date with `libpg_query` updates. This library will continue to be maintained however may not be as up-to-date as the official implementation.\n\n## Credits\n\nA huge thank you to [Lukas Fittl](https://github.com/lfittl) for all of his amazing work creating [libpg_query](https://github.com/pganalyze/libpg_query).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaupino%2Fpg_parse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaupino%2Fpg_parse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaupino%2Fpg_parse/lists"}