Skip to content

Conversation

@jpabbuehl
Copy link

@jpabbuehl jpabbuehl commented Dec 23, 2025

Summary

Add support for Apache AGE (A Graph Extension) which brings graph database capabilities and Cypher query language to PGlite.

Changes

Build Configuration

File Change
pglite/Makefile Add age to SUBDIRS
pglite-wasm/included.pglite.imports Export hook symbols for AGE
pglite-wasm/excluded.pglite.imports Add invoke_jii pattern

AGE Submodule

Added AGE as a submodule from jpabbuehl/age branch feat/32bit-wasm-support.

This fork includes 32-bit WASM compatibility patches:

  • graphid.h: Conditional pass-by-reference for 32-bit systems
  • age_main.sql: Removed PASSEDBYVALUE from graphid type

Upstream 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 parsing
  • set_rel_pathlist_hook # Query planning
  • ProcessUtility_hook # DDL handling
  • RegisterExtensibleNodeMethods # Custom node types
  • object_access_hook # Access control

Also added invoke_jii to excluded imports (AGE uses int64(*)(int,int) function pointer pattern).

Technical Details

32-bit WASM Compatibility

PGlite compiles with -m32 (32-bit WASM). AGE's graphid type is 8 bytes, which doesn't fit in a 32-bit Datum. The AGE fork includes:

#if SIZEOF_DATUM >= 8
// 64-bit: pass by value (original)
#else
// 32-bit: pass by reference
#endif## Testing

  • AGE compiles to WASM successfully
  • age.tar.gz generated (140KB compressed)
  • All 43 TypeScript tests pass

Related PRs

Checklist

  • Build succeeds with ./build-with-docker.sh
  • AGE extension tarball generated
  • No regressions in existing extensions

tdrz and others added 4 commits November 5, 2025 13:53
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants