pganalyze / pg_query.rs Goto Github PK
View Code? Open in Web Editor NEWRust library to parse, deparse and normalize SQL queries using the PostgreSQL query parser
License: MIT License
Rust library to parse, deparse and normalize SQL queries using the PostgreSQL query parser
License: MIT License
The crate https://crates.io/crates/pg_query is still pointing at what is presumably an old repo and not the latest version. Please update it.
Hello. I'm trying to get set up on an M1 mac with the Getting started snippet. On running cargo build
I get the error:
/Projects/simple_pgquery/pgquerytest/target/debug/build/pg_query-8200207fd30b02f3/out/pg_query.h:5:10: fatal error: 'sys/types.h' file not found
Wanted to ask if this was a known issue with a workaround. If not, I will assume it's an issue on my machine and keep trying to fix it. Thanks.
Both NodesEnum::nodes()
and protobuf::ParseResult::nodes()
don't have documentation, although the latter hints
// Note: this doesn't iterate over every possible node type, since we only care about a subset of nodes.
Is the goal just to provide a helper function to extract ParseResult::{warnings, tables, aliases, cte_names, functions}
?
I'm trying to do some more detailed parsing of a statement tree, and would like a "visitor" pattern. I need more information than scan()
provides. Is it useful to extend the nodes
function?
All of which are published in pg_query.h.
I've got a viable draft of these functions over at skalt/pg_query_wrapper, and I'd be happy to adapt and PR them to this repo.
Hello. I tried to run the following source code on Windows 10 and the build failed. I am seeking assistance in resolving this issue.
use pg_query;
fn main() {
let result = pg_query::parse("SELECT * FROM contacts");
assert!(result.is_ok());
}
The project is located at E:\pg-query-test
.
error: failed to run custom build command for `pg_query v0.8.2`
Caused by:
process didn't exit successfully: `E:\pg-query-test\target\debug\build\pg_query-4000e504282b2f84\build-script-build` (exit code: 1)
--- stdout
cargo:rerun-if-changed=.\libpg_query\Makefile
cargo:rustc-link-search=native=E:\pg-query-test\target\debug\build\pg_query-b2e470b4f0427967\out
cargo:rustc-link-lib=static=pg_query
--- stderr
Error: Error { kind: NotFound, message: "program not found" }
OS: Windows 10
pg_query: 0.8.2
cargo: 1.75.0-nightly
cmake: 3.28.1
libpq_query 15-4.2.1 includes an INTERVAL deparsing fix: pganalyze/libpg_query#184 that would be good to get into the pg_query mainline.
When using cargo build
, I get the following error:
thread 'main' panicked at '"__atomic_wide_counter_struct_(unnamed_at_/usr/include/bits/atomic_wide_counter_h_28_3)" is not a valid Ident', /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.66/src/fallback.rs:774:9
The same problem was observed here to be due to an old bindgen: danstiner/rust-u2f#114
This is likely more a problem with rust-analyzer than this library, but I want to raise awareness because this harms ergonomics and I'd like to understand if there's a work around you all have figured out.
e.g. Even though type is Result<Vec<Node::SelectStmt, Error>>
and this code compiles correctly, rust-analyzer provides Result<Vec<{unknown}, Error>>
Anything that can be done to make this easier to work with?
The parallel test as currently written opens 10,000 threads that each call out to libpg_query at the same time. This error happens rarely, and so far only on CI.
https://github.com/pganalyze/pg_query.rs/runs/7419661487
LeakSanitizer:DEADLYSIGNAL
==4846==ERROR: LeakSanitizer: SEGV on unknown address 0x7f7999ae3ff8 (pc 0x5607592a63f4 bp 0x7f7595e56e60 sp 0x7f7595e565f0 T16383)
==4846==The signal is caused by a READ memory access.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.