You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(v18): use pg_query_scan_tokens for scan - #171
Merge after constructive-io/libpg_query chore/sync-18-latest → 18-constructive. This PR's CI clones 18-constructive, and it only builds once that merge lands.
Upstream libpg_query switched from protobuf-c to upb and removed protobuf/pg_query.pb-c.h. The full-API wasm_wrapper.c included that header in order to unpack pg_query_scan() output, so the v18 WASM build fails to compile against the synced fork.
scan() JSON output stays the same: same fields, same simplified tokenName mapping. version now comes from PG_VERSION_NUM, which is the same value protobuf used to carry. Tests and README now expect 180006 (PG 18.6).
Verified locally: v18 pnpm build + pnpm test pass 92/92 when built from the synced fork branch.
🟢 Vendored libpg_query.md still documents removed scan API (libpg_query.md) — The PR migrates the wrapper to pg_query_scan_tokens/PgQueryScanTokensResult (versions/18/src/wasm_wrapper.c:378), but the vendored API reference versions/18/libpg_query.md still documents the removed protobuf-based pg_query_scan with an unpack workflow (lines 52-77 and 247).
The change moves both C wrappers (templates/full and versions/18) to the new pg_query_scan_tokens API: protobuf unpacking is removed, PgQueryScanTokensResult fields are read directly as a struct array, cleanup switches to pg_query_free_scan_tokens_result, and the reported version now comes from the PG_VERSION_NUM build constant. The emitted JSON shape ({"version":N,"tokens":[...]}) is unchanged, so the TypeScript scan/scanSync consumers remain compatible. The test suite in versions/18/test/pg18.test.js was updated for the new parser version, and versions/18/README.md documents the version bump. One low-severity doc divergence remains: the vendored API reference still describes the removed scan API.
Migrated to pg_query_scan_tokens/pg_query_free_scan_tokens_result, dropping protobuf includes and unpack code; token loops now iterate scan_result->tokens as structs and version is emitted from PG_VERSION_NUM.
versions/18/README.md
Version bump documentation to the new parser build.
versions/18/test/pg18.test.js
Test expectations updated for the pg18 parser and scan token output.
versions/18/libpg_query.md (untouched)
Still documents the removed pg_query_scan protobuf workflow; flagged for follow-up.
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
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.
Summary
Merge after constructive-io/libpg_query
chore/sync-18-latest→18-constructive. This PR's CI clones18-constructive, and it only builds once that merge lands.Upstream libpg_query switched from protobuf-c to upb and removed
protobuf/pg_query.pb-c.h. The full-APIwasm_wrapper.cincluded that header in order to unpackpg_query_scan()output, so the v18 WASM build fails to compile against the synced fork.The fix uses upstream's new protobuf-free API:
scan()JSON output stays the same: same fields, same simplifiedtokenNamemapping.versionnow comes fromPG_VERSION_NUM, which is the same value protobuf used to carry. Tests and README now expect180006(PG 18.6).Verified locally: v18
pnpm build+pnpm testpass 92/92 when built from the synced fork branch.Link to Devin session: https://app.devin.ai/sessions/bb737daf640f408b8e33e9f72dc75587
Open in Devin Desktop: https://app.devin.ai/desktop/session/bb737daf640f408b8e33e9f72dc75587?variant=devin
Requested by: @pyramation