feat: Add Apache AGE graph database extension#58
Open
jpabbuehl wants to merge 8 commits intoelectric-sql:REL_17_5_WASM-pglite-builderfrom
Open
feat: Add Apache AGE graph database extension#58jpabbuehl wants to merge 8 commits intoelectric-sql:REL_17_5_WASM-pglite-builderfrom
jpabbuehl wants to merge 8 commits intoelectric-sql:REL_17_5_WASM-pglite-builderfrom
Conversation
Add support for Apache AGE (A Graph Extension) which brings graph database capabilities and Cypher query language to PostgreSQL. Changes: - Add AGE as submodule from jpabbuehl/age (32-bit WASM compatible fork) - Add AGE to SUBDIRS in pglite/Makefile - Export required hook symbols in included.pglite.imports: - post_parse_analyze_hook (Cypher parsing) - set_rel_pathlist_hook (query planning) - ProcessUtility_hook (DDL handling) - RegisterExtensibleNodeMethods (custom nodes) - object_access_hook (access control) - Add invoke_jii to excluded.pglite.imports (function pointer pattern) The AGE submodule points to a fork with 32-bit WASM compatibility: - graphid type uses pass-by-reference on 32-bit systems - Upstream PR pending at apache/age Related: electric-sql/pglite PR for TypeScript wrapper
- Update pglite/Makefile with age-specific build rule that passes SIZEOF_DATUM=4 - Forces SQL regeneration to apply PASSEDBYVALUE stripping for graphid type - Update AGE submodule to 0a4f4b3 (Makefile-only 32-bit support approach) The AGE fork now uses a Makefile-only approach: - No changes to graphid.h or age_main.sql source files - Makefile conditionally strips PASSEDBYVALUE when SIZEOF_DATUM=4 is passed - PostgreSQL's Int64GetDatum/DatumGetInt64 macros handle the rest
6 tasks
tdrz
reviewed
Jan 21, 2026
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.
Summary
Add support for Apache AGE (A Graph Extension) which brings graph database capabilities and Cypher query language to PGlite.
Changes
Build Configuration
pglite/Makefileageto SUBDIRS, add age-specific build rule withSIZEOF_DATUM=4pglite-wasm/included.pglite.importspglite-wasm/excluded.pglite.importsinvoke_jiipatternAGE Submodule
Added AGE as a submodule from
jpabbuehl/agebranchfeat/32bit-wasm-support.This fork uses a Makefile-only approach for 32-bit WASM compatibility:
graphid.horage_main.sqlsource filesPASSEDBYVALUEfromgraphidtype whenSIZEOF_DATUM=4is passedUpstream PR pending: apache/age@master...jpabbuehl:age:feat/32bit-wasm-support
Symbol Exports
AGE requires these PostgreSQL hook symbols:
post_parse_analyze_hook— Cypher query parsingset_rel_pathlist_hook— Query planningProcessUtility_hook— DDL handlingRegisterExtensibleNodeMethods— Custom node typesobject_access_hook— Access controlAlso added
invoke_jiito excluded imports (AGE usesint64(*)(int,int)function pointer pattern).Technical Details
32-bit WASM Compatibility
PGlite compiles with
-m32(32-bit WASM). AGE'sgraphidtype is 8 bytes, which doesn't fit in a 32-bitDatum.Build-time solution (Makefile-only):
In
pglite/Makefile- passesSIZEOF_DATUM=4to AGE build:In AGE's
Makefile- stripsPASSEDBYVALUEwhenSIZEOF_DATUM=4:This approach:
Int64GetDatum/DatumGetInt64macros (already handle 32-bit pass-by-reference)Testing
age.tar.gzgenerated (140KB compressed)Related PRs
Checklist
./build-with-docker.sh