From d14c790fb1be99639df69593cbaff6258d0e83c8 Mon Sep 17 00:00:00 2001 From: tudor Date: Wed, 5 Nov 2025 13:53:18 +0100 Subject: [PATCH 1/7] cleanup --- src/backend/Makefile | 4 ++-- src/include/port/pg_pthread.h | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/backend/Makefile b/src/backend/Makefile index 0bc6a84c3b10a..1c04efeab0099 100644 --- a/src/backend/Makefile +++ b/src/backend/Makefile @@ -110,8 +110,8 @@ pglite: pglite-exported-functions $(CC) $(CFLAGS) $(LDFLAGS) -DPG_PREFIX=/tmp/pglite -I$(top_builddir)/src/include -I$(top_builddir)/src/ -I$(top_builddir)/src/interfaces/libpq -o pglite.o -c $(top_builddir)/$(PGLITE_MAIN) -Wno-incompatible-pointer-types-discards-qualifiers $(CC) \ $(PGLITE_CFLAGS) \ - -fPIC -m32 -D_FILE_OFFSET_BITS=64 -mno-bulk-memory -mnontrapping-fptoint -mno-reference-types -mno-sign-ext -mno-extended-const -mno-atomics -mno-tail-call -mno-multivalue -mno-relaxed-simd -mno-simd128 -mno-multimemory -mno-exception-handling -Wno-unused-command-line-argument -Wno-unreachable-code-fallthrough -Wno-unused-function -Wno-invalid-noreturn -Wno-declaration-after-statement -Wno-invalid-noreturn \ - -DPYDK=1 -DPG_PREFIX=/tmp/pglite -o pglite.html \ + -fPIC -m32 -mno-bulk-memory -mnontrapping-fptoint -mno-reference-types -mno-sign-ext -mno-extended-const -mno-atomics -mno-tail-call -mno-multivalue -mno-relaxed-simd -mno-simd128 -mno-multimemory -mno-exception-handling -Wno-unused-command-line-argument -Wno-unreachable-code-fallthrough -Wno-unused-function -Wno-invalid-noreturn -Wno-declaration-after-statement -Wno-invalid-noreturn \ + -DPG_PREFIX=/tmp/pglite -o pglite.html \ $(PGPRELOAD) \ -ferror-limit=1 \ -sEXPORTED_FUNCTIONS=@$(emscripten_imports_dir)/exported_functions.txt \ diff --git a/src/include/port/pg_pthread.h b/src/include/port/pg_pthread.h index 6922eb423b945..b3d4ffbf59353 100644 --- a/src/include/port/pg_pthread.h +++ b/src/include/port/pg_pthread.h @@ -12,9 +12,6 @@ #ifndef PG_PTHREAD_H #define PG_PTHREAD_H -#if defined(__wasi__) -#define PYDK -#endif /* __wasi__ */ #include #ifndef HAVE_PTHREAD_BARRIER_WAIT From 1ccb2d383226687a3a326c1a09fbb092196a1d9c Mon Sep 17 00:00:00 2001 From: tudor Date: Wed, 5 Nov 2025 14:24:42 +0100 Subject: [PATCH 2/7] initial pg_uuidv7 commit --- .gitmodules | 3 +++ pglite/pg_uuidv7 | 1 + 2 files changed, 4 insertions(+) create mode 160000 pglite/pg_uuidv7 diff --git a/.gitmodules b/.gitmodules index 94158709d174c..60cfbe40928c7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "pglite/pgtap"] path = pglite/pgtap url = https://github.com/theory/pgtap.git +[submodule "pglite/pg_uuidv7"] + path = pglite/pg_uuidv7 + url = https://github.com/fboulnois/pg_uuidv7/ diff --git a/pglite/pg_uuidv7 b/pglite/pg_uuidv7 new file mode 160000 index 0000000000000..c707aae241118 --- /dev/null +++ b/pglite/pg_uuidv7 @@ -0,0 +1 @@ +Subproject commit c707aae2411181be4802f5fa565b44d9c0bcbc29 From 1195d5388bd5529e0013c45fa816cfcd953d84e0 Mon Sep 17 00:00:00 2001 From: tudor Date: Wed, 5 Nov 2025 14:51:58 +0100 Subject: [PATCH 3/7] backend pg_uuidv7 implemented --- pglite/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pglite/Makefile b/pglite/Makefile index f6bc99b8e50cc..633fe686b9eba 100644 --- a/pglite/Makefile +++ b/pglite/Makefile @@ -6,7 +6,8 @@ include $(top_builddir)/src/Makefile.global SUBDIRS = \ pg_ivm \ vector \ - pgtap + pgtap \ + pg_uuidv7 prefix ?= /install/pglite EXTENSIONS_BUILD_ROOT := /tmp/extensions/build From 2fecd224d7ba69bfed5374edd10b699c9c02def9 Mon Sep 17 00:00:00 2001 From: abbuehlj Date: Tue, 23 Dec 2025 09:55:17 +0100 Subject: [PATCH 4/7] feat: Add Apache AGE graph database extension 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 --- .gitmodules | 4 ++++ pglite-wasm/excluded.pglite.imports | 1 + pglite-wasm/included.pglite.imports | 7 ++++++- pglite/Makefile | 4 ++-- pglite/age | 1 + 5 files changed, 14 insertions(+), 3 deletions(-) create mode 160000 pglite/age diff --git a/.gitmodules b/.gitmodules index 60cfbe40928c7..0a5d37be46d8c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,7 @@ [submodule "pglite/pg_uuidv7"] path = pglite/pg_uuidv7 url = https://github.com/fboulnois/pg_uuidv7/ +[submodule "pglite/age"] + path = pglite/age + url = https://github.com/jpabbuehl/age.git + branch = feat/32bit-wasm-support diff --git a/pglite-wasm/excluded.pglite.imports b/pglite-wasm/excluded.pglite.imports index e0d801f2348b5..776c442baff52 100644 --- a/pglite-wasm/excluded.pglite.imports +++ b/pglite-wasm/excluded.pglite.imports @@ -15,6 +15,7 @@ invoke_ij invoke_ijj invoke_j invoke_ji +invoke_jii invoke_jiiiii invoke_v invoke_vi diff --git a/pglite-wasm/included.pglite.imports b/pglite-wasm/included.pglite.imports index 7a5d30d895111..cd98c3fdd73f5 100644 --- a/pglite-wasm/included.pglite.imports +++ b/pglite-wasm/included.pglite.imports @@ -30,4 +30,9 @@ srand strcmp strftime strlen -strtoul \ No newline at end of file +strtoul +post_parse_analyze_hook +set_rel_pathlist_hook +ProcessUtility_hook +RegisterExtensibleNodeMethods +object_access_hook \ No newline at end of file diff --git a/pglite/Makefile b/pglite/Makefile index 633fe686b9eba..26549b71c3c5f 100644 --- a/pglite/Makefile +++ b/pglite/Makefile @@ -1,4 +1,3 @@ -# Packages other extensions into individual tar.gz archives top_builddir = .. include $(top_builddir)/src/Makefile.global @@ -7,7 +6,8 @@ SUBDIRS = \ pg_ivm \ vector \ pgtap \ - pg_uuidv7 + pg_uuidv7 \ + age prefix ?= /install/pglite EXTENSIONS_BUILD_ROOT := /tmp/extensions/build diff --git a/pglite/age b/pglite/age new file mode 160000 index 0000000000000..cbdae80677ac5 --- /dev/null +++ b/pglite/age @@ -0,0 +1 @@ +Subproject commit cbdae80677ac550ddb468e10b2427896b6f84983 From 962b3bb146c5650342d5745cdc06e2f5d7798cb1 Mon Sep 17 00:00:00 2001 From: abbuehlj Date: Sun, 11 Jan 2026 17:53:43 +0100 Subject: [PATCH 5/7] feat(age): Add 32-bit WASM support via SIZEOF_DATUM=4 build flag - Update pglite/Makefile with age-specific build rule that passes SIZEOF_DATUM=4 - Forces SQL regeneration to apply PASSEDBYVALUE stripping for graphid type - Update AGE submodule to 0a4f4b3 (Makefile-only 32-bit support approach) The AGE fork now uses a Makefile-only approach: - No changes to graphid.h or age_main.sql source files - Makefile conditionally strips PASSEDBYVALUE when SIZEOF_DATUM=4 is passed - PostgreSQL's Int64GetDatum/DatumGetInt64 macros handle the rest --- pglite/Makefile | 13 +++++++++++++ pglite/age | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/pglite/Makefile b/pglite/Makefile index 6eca161406653..55e8878e7339e 100644 --- a/pglite/Makefile +++ b/pglite/Makefile @@ -30,6 +30,19 @@ dist: $(addsuffix .tar.gz,$(EXTENSIONS)) cd $(EXTENSIONS_BUILD_ROOT)/$*/$(prefix) && \ files=$$(find . -type f -o -type l | sed 's|^\./||') && \ tar -czf $(ARCHIVE_DIR)/$*.tar.gz $$files + +# AGE requires SIZEOF_DATUM=4 for 32-bit WASM compatibility (strips PASSEDBYVALUE from graphid) +age.tar.gz: + @echo "=== Staging age (with 32-bit support) ===" + rm -rf $(EXTENSIONS_BUILD_ROOT)/age + bash -c 'mkdir -p $(EXTENSIONS_BUILD_ROOT)/age/$(prefix)/{bin,lib,share/extension,share/doc,share/postgresql/extension,share/postgresql/tsearch_data,include}' + rm -f age/age--*.sql + $(MAKE) -C age install DESTDIR=$(EXTENSIONS_BUILD_ROOT)/age SIZEOF_DATUM=4 + @echo "=== Packaging age ===" + mkdir -p $(ARCHIVE_DIR) + cd $(EXTENSIONS_BUILD_ROOT)/age/$(prefix) && \ + files=$$(find . -type f -o -type l | sed 's|^\./||') && \ + tar -czf $(ARCHIVE_DIR)/age.tar.gz $$files # tar -C $(EXTENSIONS_BUILD_ROOT)/$*/$(prefix) -czf $(ARCHIVE_DIR)/$*.tar.gz . .PHONY: dist diff --git a/pglite/age b/pglite/age index cbdae80677ac5..0a4f4b35706b4 160000 --- a/pglite/age +++ b/pglite/age @@ -1 +1 @@ -Subproject commit cbdae80677ac550ddb468e10b2427896b6f84983 +Subproject commit 0a4f4b35706b4ff2ef531e49c64b63c526ffce7f From 17c7e46b0d3f571b8f09e1772ac77dfcd1f030f0 Mon Sep 17 00:00:00 2001 From: abbuehlj Date: Tue, 20 Jan 2026 08:11:11 +0100 Subject: [PATCH 6/7] chore: point age submodule to upstream apache/age --- .gitmodules | 4 ++-- pglite/age | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index ec811459a609a..e6c2bcb846f22 100644 --- a/.gitmodules +++ b/.gitmodules @@ -12,8 +12,8 @@ url = https://github.com/fboulnois/pg_uuidv7/ [submodule "pglite/age"] path = pglite/age - url = https://github.com/jpabbuehl/age.git - branch = feat/32bit-wasm-support + url = https://github.com/apache/age.git + branch = master [submodule "pglite/pg_hashids"] path = pglite/pg_hashids url = https://github.com/iCyberon/pg_hashids diff --git a/pglite/age b/pglite/age index 0a4f4b35706b4..b29ca5e7d2f84 160000 --- a/pglite/age +++ b/pglite/age @@ -1 +1 @@ -Subproject commit 0a4f4b35706b4ff2ef531e49c64b63c526ffce7f +Subproject commit b29ca5e7d2f84cfe2619eea70c4ace2cba41aa0b From fd6042e7ac9a4a6b06c8d17584f2eb4060f26c1d Mon Sep 17 00:00:00 2001 From: abbuehlj Date: Sun, 25 Jan 2026 08:43:43 +0100 Subject: [PATCH 7/7] Add missing backslash --- pglite/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pglite/Makefile b/pglite/Makefile index 55e8878e7339e..e27f11c1293f1 100644 --- a/pglite/Makefile +++ b/pglite/Makefile @@ -7,7 +7,7 @@ SUBDIRS = \ vector \ pgtap \ pg_uuidv7 \ - age + age \ pg_hashids prefix ?= /install/pglite