Skip to content

feat: Add 32-bit platform support for graphid type - #2286

Merged
jrgemignani merged 7 commits into
apache:masterfrom
jpabbuehl:feat/32bit-wasm-support
Jan 12, 2026
Merged

feat: Add 32-bit platform support for graphid type#2286
jrgemignani merged 7 commits into
apache:masterfrom
jpabbuehl:feat/32bit-wasm-support

Conversation

@jpabbuehl

@jpabbuehljpabbuehl commented Dec 23, 2025

Copy link
Copy Markdown
Contributor

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)

Usage:

  • 64-bit build: make (default, unchanged behavior)
  • 32-bit build: make SIZEOF_DATUM=4

This change is backward compatible:

  • 64-bit systems: unchanged behavior (pass-by-value)
  • 32-bit systems: now work with pass-by-reference when built with SIZEOF_DATUM=4
  • Source files unchanged (sql/age_main.sql, graphid.h)

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

Tested on:

  • 64-bit Linux (all 29 regression tests pass)
  • 32-bit WebAssembly via PGlite

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)
@tdrz

tdrz commented Jan 6, 2026

Copy link
Copy Markdown

I'm one of the maintainers of PGlite a WASM build of Postgres. We support multiple extensions and would love to have age as well but we'd need this PR merged for it.

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR attempts to add 32-bit platform support for the graphid type to enable AGE to run on WebAssembly (WASM) platforms like PGlite. The changes introduce conditional compilation in the C code to use pass-by-reference on 32-bit systems while maintaining pass-by-value on 64-bit systems.

Key changes:

  • Added conditional graphid Datum conversion macros in graphid.h based on SIZEOF_DATUM
  • Introduced ag_graphid_get_datum() helper function for 32-bit pass-by-reference implementation
  • Removed PASSEDBYVALUE from the SQL type definition

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

FileDescription
src/include/utils/graphid.hAdds conditional compilation macros for graphid/Datum conversion and a helper function for 32-bit platforms
sql/age_main.sqlRemoves PASSEDBYVALUE from the graphid type definition

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadsql/age_main.sql Outdated
Comment on lines +192 to +193
-- Note: PASSEDBYVALUE removed for 32-bit WASM compatibility (PGlite)
-- On 32-bit systems, Datum is 4 bytes and cannot hold 8-byte graphid by value

CopilotAIJan 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing PASSEDBYVALUE unconditionally from the SQL type definition creates a critical mismatch with the C code on 64-bit platforms.

On 64-bit systems:

  • The SQL type definition (without PASSEDBYVALUE) indicates pass-by-reference
  • But the C macros in graphid.h use pass-by-value (DatumGetInt64/Int64GetDatum)

This inconsistency will cause PostgreSQL to incorrectly interpret graphid values on 64-bit platforms, leading to crashes or data corruption. The type's pass-by-value/reference behavior in SQL must match the C implementation.

The SQL type definition would need to be conditional (if PostgreSQL supports that), or the approach needs to be reconsidered. One solution is to always use pass-by-reference for consistency, though this would hurt 64-bit performance.

Suggested change
-- Note: PASSEDBYVALUE removed for 32-bit WASM compatibility (PGlite)
-- On 32-bit systems, Datum is 4 bytes and cannot hold 8-byte graphid by value
PASSEDBYVALUE,
-- Note: graphid is passed by value to match the C implementation on 64-bit PostgreSQL.
-- 32-bit environments where Datum is 4 bytes cannot safely use this definition.

Copilot uses AI. Check for mistakes.
@jrgemignani

Copy link
Copy Markdown
Contributor

@jpabbuehl@tdrz

This change is backward compatible:

64-bit systems continue using pass-by-value
32-bit systems now work with pass-by-reference

Unfortunately, this PR breaks nearly all of the regression tests, so it isn't backward compatible. I would strongly suggest to anyone that before a PR is submitted, make installcheck is run locally to verify all regression tests. Keep in mind that all of our regression tests run under standard PostgreSQL.

No PR can be accepted until it can pass all regression tests.

Run make PG_CONFIG=$HOME/pg17/bin/pg_config installcheck EXTRA_TESTS="pgvector fuzzystrmatch pg_trgm"
echo "# +++ regress install-check in +++" && /home/runner/pg17/lib/postgresql/pgxs/src/makefiles/../../src/test/regress/pg_regress --inputdir=./ --bindir='/home/runner/pg17/bin' --load-extension=age --inputdir=.//regress --outputdir=.//regress --temp-instance=.//regress/instance --port=61958 --encoding=UTF-8 --temp-config .//regress/age_regression.conf --dbname=contrib_regression scan graphid agtype agtype_hash_cmp catalog cypher expr cypher_create cypher_match cypher_unwind cypher_set cypher_remove cypher_delete cypher_with cypher_vle cypher_union cypher_call cypher_merge cypher_subquery age_global_graph age_load index analyze graph_generation name_validation jsonb_operators list_comprehension map_projection pgvector fuzzystrmatch pg_trgm drop
# +++ regress install-check in +++
# initializing database system by running initdb
# using temp instance on port 61958 with PID 2978
ok 1 - scan 309 ms
not ok 2 - graphid 423 ms
# (test process exited with exit code 2)
# (test process exited with exit code 2)
not ok 3 - agtype 28 ms
ok 4 - agtype_hash_cmp 19 ms
not ok 5 - catalog 409 ms
# (test process exited with exit code 2)
not ok 6 - cypher 32 ms
# (test process exited with exit code 2)
# (test process exited with exit code 2)
not ok 7 - expr 2 ms
not ok 8 - cypher_create 425 ms
# (test process exited with exit code 2)
# (test process exited with exit code 2)
not ok 9 - cypher_match 33 ms
not ok 10 - cypher_unwind 428 ms
# (test process exited with exit code 2)
# (test process exited with exit code 2)
not ok 11 - cypher_set 27 ms
# (test process exited with exit code 2)
not ok 12 - cypher_remove 3 ms
not ok 13 - cypher_delete 428 ms
# (test process exited with exit code 2)
# (test process exited with exit code 2)
not ok 14 - cypher_with 27 ms
# (test process exited with exit code 2)
not ok 15 - cypher_vle 3 ms
not ok 16 - cypher_union 458 ms
# (test process exited with exit code 2)
# (test process exited with exit code 2)
not ok 17 - cypher_call 28 ms
not ok 18 - cypher_merge 461 ms
# (test process exited with exit code 2)
# (test process exited with exit code 2)
not ok 19 - cypher_subquery 25 ms
# (test process exited with exit code 2)
not ok 20 - age_global_graph 3 ms
# (test process exited with exit code 2)
not ok 21 - age_load 438 ms
not ok 22 - index 28 ms
# (test process exited with exit code 2)
# (test process exited with exit code 2)
not ok 23 - analyze 3 ms
# (test process exited with exit code 2)
not ok 24 - graph_generation 447 ms
# (test process exited with exit code 2)
not ok 25 - name_validation 32 ms
# (test process exited with exit code 2)
not ok 26 - jsonb_operators 3 ms
# (test process exited with exit code 2)
not ok 27 - list_comprehension 422 ms
# (test process exited with exit code 2)
not ok 28 - map_projection 27 ms
# (test process exited with exit code 2)
not ok 29 - pgvector 3 ms
# (test process exited with exit code 2)
not ok 30 - fuzzystrmatch 439 ms
not ok 31 - pg_trgm 27 ms
# (test process exited with exit code 2)
# (test process exited with exit code 2)
not ok 32 - drop 4 ms
# 30 of 32 tests failed.
1..32
# The differences that caused some tests to fail can be viewed in the file "/home/runner/work/age/age/regress/regression.diffs".
# A copy of the test summary that you see above is saved in the file "/home/runner/work/age/age/regress/regression.out".
make: *** [/home/runner/pg17/lib/postgresql/pgxs/src/makefiles/pgxs.mk:436: installcheck] Error 1
Error: Process completed with exit code 2.

@tdrz

tdrz commented Jan 7, 2026

Copy link
Copy Markdown

@jrgemignani Thank you for having a look. Lesson learned for next time!

This update introduces conditional compilation in the Makefile to support 32-bit platforms by detecting the size of Datum. The graphid type now uses pass-by-reference on 32-bit systems, ensuring compatibility with PostgreSQL's limitations on pass-by-value types larger than Datum.
Changes include:
- Added SIZEOF_DATUM detection in the Makefile.
- Updated the SQL definition of graphid to conditionally remove PASSEDBYVALUE for 32-bit systems.
This change maintains backward compatibility for 64-bit systems while enabling functionality on 32-bit platforms, including WebAssembly.
@jpabbuehl

Copy link
Copy Markdown
ContributorAuthor

@jrgemignani I overlook the regression test suite.

I adjusted PR to keep the source SQL (sql/age_main.sql) completely unchanged and instead conditionally strip PASSEDBYVALUE from the generated SQL file at build time when SIZEOF_DATUM=4.

Now, all 29 regression tests pass identically on 64-bit while enabling 32-bit WASM/PGlite support through build-time detection.

@jpabbuehl

jpabbuehl commented Jan 7, 2026

Copy link
Copy Markdown
ContributorAuthor

Ran test in docker given make installcheck has some tmp path resolution issue with macos

docker build -f docker/Dockerfile.dev -t age-test .
# +++ regress install-check in +++
# initializing database system by running initdb
# using temp instance on port 61958 with PID 80
ok 1 - scan 54 ms
ok 2 - graphid 4 ms
ok 3 - agtype 21 ms
ok 4 - agtype_hash_cmp 3 ms
ok 5 - catalog 51 ms
ok 6 - cypher 10 ms
ok 7 - expr 1489 ms
ok 8 - cypher_create 28 ms
ok 9 - cypher_match 7464 ms
ok 10 - cypher_unwind 176 ms
ok 11 - cypher_set 28 ms
ok 12 - cypher_remove 100 ms
ok 13 - cypher_delete 52 ms
ok 14 - cypher_with 109 ms
ok 15 - cypher_vle 2153 ms
ok 16 - cypher_union 7 ms
ok 17 - cypher_call 9 ms
ok 18 - cypher_merge 66 ms
ok 19 - cypher_subquery 158 ms
ok 20 - age_global_graph 26 ms
ok 21 - age_load 545 ms
ok 22 - index 97 ms
ok 23 - analyze 6 ms
ok 24 - graph_generation 16 ms
ok 25 - name_validation 29 ms
ok 26 - jsonb_operators 16 ms
ok 27 - list_comprehension 135 ms
ok 28 - map_projection 9 ms
ok 29 - drop 51 ms
1..29
# All 29 tests passed.

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadMakefile Outdated
Comment threadMakefile Outdated
$(age_sql): $(SQLS)
@cat $(SQLS) > $@
ifeq ($(SIZEOF_DATUM),4)
@sed 's/^[[:space:]]*PASSEDBYVALUE,$$/ -- PASSEDBYVALUE removed for 32-bit/' $@ > $@.tmp && mv $@.tmp $@

CopilotAIJan 7, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sed command replaces PASSEDBYVALUE with a SQL comment, but this creates a semantic change in the generated SQL file that is only visible at build time. When debugging issues on 32-bit platforms, developers might look at the source SQL files and see PASSEDBYVALUE present, but the actual installed SQL has it commented out. This discrepancy could cause confusion. Consider adding a comment in the source SQL file (sql/age_main.sql) near the PASSEDBYVALUE line to indicate it will be removed on 32-bit platforms, or use a more explicit marker in the source that gets processed by sed.

Suggested change
@sed 's/^[[:space:]]*PASSEDBYVALUE,$$/ -- PASSEDBYVALUE removed for 32-bit/' $@ > $@.tmp && mv $@.tmp $@
@sed 's/^[[:space:]]*PASSEDBYVALUE,$$/ -- PASSEDBYVALUE disabled on 32-bit (replaced at build time; see Makefile SIZEOF_DATUM rule)/' $@ > $@.tmp && mv $@.tmp $@

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment threadMakefile Outdated
jpabbuehland others added 3 commits January 8, 2026 05:42
Ensures replacement succeeds; fails fast if format changes
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Validates values (4 or 8); clearer warnings; uses $(origin)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadMakefile Outdated
$(age_sql): $(SQLS)
@cat $(SQLS) > $@
ifeq ($(SIZEOF_DATUM),4)
@sed 's/^[[:space:]]*PASSEDBYVALUE[[:space:]]*,\?[[:space:]]*$$/ -- PASSEDBYVALUE disabled on 32-bit (replaced at build time; see Makefile SIZEOF_DATUM rule)/' $@ > $@.tmp && mv $@.tmp $@ && grep -q 'PASSEDBYVALUE disabled on 32-bit' $@ || { echo "PASSEDBYVALUE marker not found or not replaced in $@"; exit 1; }

CopilotAIJan 8, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sed replacement pattern uses a complex regular expression that may not be portable across all sed implementations. Specifically, the character class [[:space:]] is a POSIX extension that may not work with all versions of sed (though it's widely supported).

Additionally, the pattern matches PASSEDBYVALUE with optional trailing comma and whitespace on its own line. This is fragile because:

  1. It won't match if PASSEDBYVALUE appears inline with other content
  2. Minor formatting changes in the SQL source could break this pattern
  3. The replacement creates a very long comment line that could exceed line length limits

Consider a more targeted approach, such as:

  • Using a script (perl/python) for more robust text processing
  • Matching based on more context (e.g., within the CREATE TYPE graphid block)
  • Using multiple simpler patterns instead of one complex pattern
Suggested change
@sed 's/^[[:space:]]*PASSEDBYVALUE[[:space:]]*,\?[[:space:]]*$$/ -- PASSEDBYVALUE disabled on 32-bit (replaced at build time; see Makefile SIZEOF_DATUM rule)/' $@ > $@.tmp && mv $@.tmp $@ && grep -q 'PASSEDBYVALUE disabled on 32-bit' $@ || { echo "PASSEDBYVALUE marker not found or not replaced in $@"; exit 1; }
@sed -e 's/^[ \t]*PASSEDBYVALUE[ \t]*,[ \t]*$/ -- PASSEDBYVALUE disabled on 32-bit; see Makefile SIZEOF_DATUM/' -e 's/^[ \t]*PASSEDBYVALUE[ \t]*$/ -- PASSEDBYVALUE disabled on 32-bit; see Makefile SIZEOF_DATUM/' $@ > $@.tmp && mv $@.tmp $@ && grep -q 'PASSEDBYVALUE disabled on 32-bit' $@ || { echo "PASSEDBYVALUE marker not found or not replaced in $@"; exit 1; }

Copilot uses AI. Check for mistakes.
Comment threadMakefile Outdated
Comment on lines +141 to +155
# 32-bit platform support: detect SIZEOF_DATUM (override with make SIZEOF_DATUM=4)
# Only attempt auto-detection if SIZEOF_DATUM was not provided on the command line.
ifeq ($(origin SIZEOF_DATUM), undefined)
SIZEOF_DATUM := $(shell printf '%s\n%s\n' '\#include "pg_config.h"' 'SIZEOF_VOID_P' | \
$(CC) -I$(shell $(PG_CONFIG) --includedir-server) -E -x c - 2>/dev/null | grep -E '^[0-9]+$$' | tail -1)
ifeq ($(SIZEOF_DATUM),)
$(warning Unable to detect SIZEOF_DATUM from pg_config.h; defaulting to 8. Check that PostgreSQL server headers are installed and that pg_config and the compiler are correctly configured.)
SIZEOF_DATUM := 8
endif
ifeq ($(filter 4 8,$(SIZEOF_DATUM)),)
$(warning Detected unexpected SIZEOF_DATUM '$(SIZEOF_DATUM)'; expected 4 or 8. Defaulting to 8.)
SIZEOF_DATUM := 8
endif
endif

CopilotAIJan 8, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description states "Add conditional compilation in graphid.h" to use pass-by-value on 64-bit and pass-by-reference on 32-bit systems. However, the actual code changes do not include any modifications to graphid.h or any other C header/source files.

The macros in src/include/utils/graphid.h still unconditionally use:

  • DATUM_GET_GRAPHID(d) as DatumGetInt64(d)
  • GRAPHID_GET_DATUM(x) as Int64GetDatum(x)

These macros need to be conditionally compiled based on SIZEOF_DATUM to handle pass-by-reference on 32-bit platforms. Without these changes, the build will succeed but the code will fail at runtime on 32-bit systems because it's still attempting to pass 8-byte values by value in a 4-byte Datum.

The C code must include conditional compilation logic similar to:

  • On 64-bit: use DatumGetInt64/Int64GetDatum (pass-by-value)
  • On 32-bit: use DatumGetPointer/PointerGetDatum with proper dereferencing (pass-by-reference)

This is a critical missing piece that makes the current implementation incomplete.

Copilot uses AI. Check for mistakes.
@jrgemignani

jrgemignani commented Jan 8, 2026

Copy link
Copy Markdown
Contributor

@jpabbuehl Thank you for your work so far!

I do, however, have a few requests due to Copilot and reviewing the code changes.

I'm not sure if you can see Copilot's remarks above? But, if you could review them, especially the one about sed and fragility and the PR description -

The sed replacement pattern uses a complex regular expression that may not be portable across all sed implementations. Specifically, the character class [[:space:]] is a POSIX extension that may not work with all versions of sed (though it's widely supported).
...

The PR description states "Add conditional compilation in graphid.h" to use pass-by-value on 64-bit and pass-by-reference on 32-bit systems. However, the actual code changes do not include any modifications to graphid.h or any other C header/source files.
...

I just want your thoughts on them.

As for the code, I would feel more comfortable if the code changes didn't auto-detect -

# 32-bit platform support: detect SIZEOF_DATUM (override with make SIZEOF_DATUM=4)
# Only attempt auto-detection if SIZEOF_DATUM was not provided on the command line.
ifeq ($(origin SIZEOF_DATUM), undefined)

I would prefer that the parameter SIZEOF_DATUM be passed and if not found, nothing happens. This way it is more expected. Is that okay with you? For this case you would need to validate that it is 4.

This update simplifies the handling of SIZEOF_DATUM in the Makefile for 32-bit builds. The previous auto-detection logic has been removed in favor of a clearer instruction to pass SIZEOF_DATUM=4 when needed. Additionally, the replacement logic for PASSEDBYVALUE in the SQL definition has been enhanced to provide better error handling and messaging.
Changes include:
- Removed complex SIZEOF_DATUM detection logic.
- Updated comments for clarity on 32-bit support.
- Improved error messages for PASSEDBYVALUE replacement failures.
@jpabbuehl

Copy link
Copy Markdown
ContributorAuthor

@jrgemignani Thanks for your feedback. Indeed the PR description needs to be adjusted.I pivoted to a more targeted Makefile-only approach instead of modifying graphid.h

Good idea on the explicit parameter approach - I've removed the auto-detection logic. Now SIZEOF_DATUM must be explicitly passed (e.g., make SIZEOF_DATUM=4) for 32-bit builds. When unspecified, normal 64-bit behavior goes on.

On the sed replacement from Copilot's feedback - I've simplified to an exact pattern match (^ PASSEDBYVALUE,$)

@jrgemignanijrgemignani left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@jrgemignani
jrgemignani merged commit c979380 into apache:masterJan 12, 2026
7 checks passed
@jrgemignani

Copy link
Copy Markdown
Contributor

Merged

jrgemignani pushed a commit to jrgemignani/age that referenced this pull request Jan 21, 2026
* 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>
MuhammadTahaNaveed pushed a commit that referenced this pull request Jan 21, 2026
* 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>
jpabbuehl added a commit to jpabbuehl/age that referenced this pull request Jan 25, 2026
* 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>
jrgemignani pushed a commit to jrgemignani/age that referenced this pull request Jan 30, 2026
* 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>
MuhammadTahaNaveed pushed a commit that referenced this pull request Feb 3, 2026
* 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>
jrgemignani pushed a commit to jrgemignani/age that referenced this pull request Mar 24, 2026
* 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>
MuhammadTahaNaveed pushed a commit that referenced this pull request Mar 26, 2026
* 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>
Sign up for freeto 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.

4 participants

@jpabbuehl@tdrz@jrgemignani