feat: Add Apache AGE graph database extension #58
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