Skip to content

Conversation

@jpabbuehl
Copy link
Contributor

Backport of #2286 from master/PG18 to PG17.

Enables AGE to work on 32-bit platforms including WebAssembly (WASM).

Use case: PGlite (PostgreSQL compiled to WebAssembly) uses PG17.5 and requires this patch.

Change: Makefile-only — when SIZEOF_DATUM=4 is passed, strips PASSEDBYVALUE from the graphid type.

Already merged to master (#2286) and PG18 (#2311).

* feat: Add 32-bit platform support for graphid type

This enables AGE to work on 32-bit platforms including WebAssembly (WASM).

Problem:
- graphid is int64 (8 bytes) with PASSEDBYVALUE
- On 32-bit systems, Datum is only 4 bytes
- PostgreSQL rejects pass-by-value types larger than Datum

Solution:
- Makefile-only change (no C code modifications)
- When SIZEOF_DATUM=4 is passed to make, strip PASSEDBYVALUE from the generated SQL
- If not specified, normal 64-bit behavior is preserved (PASSEDBYVALUE kept)

This change is backward compatible:
- 64-bit systems continue using pass-by-value
- 32-bit systems now work with pass-by-reference

Motivation: PGlite (PostgreSQL compiled to WebAssembly) uses 32-bit
pointers and requires this patch to run AGE.

Tested on:
- 64-bit Linux (regression tests pass)
- 32-bit WebAssembly via PGlite (all operations work)

Co-authored-by: abbuehlj <jean-paul.abbuehl@roche.com>
@github-actions github-actions bot added the PG17 label Jan 25, 2026
@jpabbuehl
Copy link
Contributor Author

@jrgemignani pglite is still on PG 17.5 and no date yet for PG 18 support. Any chance to backport?
Thanks a lot

@jrgemignani
Copy link
Contributor

jrgemignani commented Jan 26, 2026

@jpabbuehl Thank you for the backport, but I am going to have to close this. I will be merging all of the masters PRs (including yours) up to 1.7.0 into PG17 get it ready for the next release. Probably in a few days.

edit: I will also be doing this for PG16 -> PG14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants