Repository navigation
fix(query): compile libpg_query from the submodule instead of a copy in OUT_DIR - #1106
Merged
Merged
Conversation
edjubert
approved these changes
Nov 2, 2026
psteinroe
added a commit
that referenced
this pull request
Nov 4, 2026
`pgls_query` lists `which` as a build dependency, but `build.rs` never uses it, and nothing in its history did. This removes it, which also drops `which`, `winsafe` and an old `rustix`/`linux-raw-sys` from `Cargo.lock`. I built and tested `pgls_query` both ways: with the vendored libpg_query (the default), and with `LIBPG_QUERY_PATH` pointing at a libpg_query installed by its own `make install`. `cargo clippy --workspace --all-targets` passes. This touches the same build-dependency list as #1106, which removes `fs_extra` a few lines above; the two changes merge without conflicts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
build.rscopied the vendored libpg_query tree intoOUT_DIRand compiled every*.cit found there. The copy overwrites files but never removes any, so anOUT_DIRthat a build of another libpg_query version left behind still holds that version's files, and the glob compiles them too. That's what broke Lint, Codegen and Test on #1072: CI restored thetarget/that main saved after #1055, and the branch, still on libpg_query 17, compiled the 18.1.0pg_query_is_utility_stmt.cfrom it (unknown type name 'PgQueryIsUtilityResult'). Switching branches locally does the same.What changed
pg_query.protoand the include paths all come fromvendor/libpg_query. Nothing is copied anymore.OUT_DIRonly holds the objects,libpg_query.aandbindings.rs. The copy wasn't needed: nothing writes into the tree, and the system layout already reads its prefix in place.fs_extrais no longer a build dependency.rerun-if-changedfor the submodule's headers,src,protobufandvendor, plusbuild.rsandLIBPG_QUERY_PATH. Before, cc'srerun-if-env-changedlines turned off Cargo's default "rerun when any file of the package changes", so a change to the submodule alone (e.g.git submodule updateafter switching branches) didn't rebuild the C library at all.The CI caches stay as they are. moonrepo/setup-rust restores by the prefix
setup-rustcargo-v1-<os>, so a key that includes the submodule commit would still restore main's latest cache, and the tree-sitter cache only holds the generated grammar. A branch that is still on libpg_query 17 needs main merged in (it then gets #1055 and this fix), because CI runs the branch's ownbuild.rs.Tests
pgls_queryon main before this change, then checked out the commit before chore(query): upgrade libpg_query to 18.1.0 #1055 (sameCargo.lock, sameOUT_DIR) and built again. It failed with the samepg_query_is_utility_stmt.cerrors as fix(suppressions): end lines at \n only, with the shared line index #1072.OUT_DIRwith the 18.1.0 copies plus a.cfile that only contains#error, then built the commit before chore(query): upgrade libpg_query to 18.1.0 #1055 with thisbuild.rsand switched back to this branch. Both builds pass, and the archive built from the 17 sources has nopg_query_is_utility_stmt.vendor/libpg_query/srcnow reruns the build script; before, the crate stayedFresh. Deleting one reruns it too.cargo test -p pgls_query,cargo clippy -p pgls_query --all-targets -- -D warnings.