Skip to content

Conversation

@jpabbuehl
Copy link

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:

  • Add conditional compilation in graphid.h
  • Use pass-by-value on 64-bit (SIZEOF_DATUM >= 8)
  • Use pass-by-reference on 32-bit (SIZEOF_DATUM < 8)
  • Remove PASSEDBYVALUE from SQL type definition

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)

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:
- Add conditional compilation in graphid.h
- Use pass-by-value on 64-bit (SIZEOF_DATUM >= 8)
- Use pass-by-reference on 32-bit (SIZEOF_DATUM < 8)
- Remove PASSEDBYVALUE from SQL type definition

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)
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.

1 participant