From f4d759b6fd5141e256ad59195d8931620eac43c9 Mon Sep 17 00:00:00 2001 From: Gautham Chandra Date: Sat, 15 Aug 2026 23:10:10 -0400 Subject: [PATCH] feat: Add pg_partman 5.5.0 as a SQL-only extension (NO_BGW) pg_partman's core is pure SQL/PLpgSQL; the only C component is its background worker, which schedules run_maintenance() and cannot exist in single-process WASM. Upstream officially supports building without it via NO_BGW=1, so the extension is packaged SQL-only and maintenance is invoked by the embedding application instead. The submodule is pinned at the v5.5.0 release tag. It is intentionally kept out of SUBDIRS so the recursive 'all' build never attempts to compile the background worker with emscripten; only the dist rule touches it. --- .gitmodules | 3 +++ pglite/other_extensions/Makefile | 19 ++++++++++++++++++- pglite/other_extensions/pg_partman | 1 + 3 files changed, 22 insertions(+), 1 deletion(-) create mode 160000 pglite/other_extensions/pg_partman diff --git a/.gitmodules b/.gitmodules index 7510d1a707b74..a5a4b1feb1bbd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -29,3 +29,6 @@ [submodule "pglite/other_extensions/pgmq"] path = pglite/other_extensions/pgmq url = https://github.com/pgmq/pgmq +[submodule "pglite/other_extensions/pg_partman"] + path = pglite/other_extensions/pg_partman + url = https://github.com/pgpartman/pg_partman.git diff --git a/pglite/other_extensions/Makefile b/pglite/other_extensions/Makefile index 601f0ffb12545..3c7ae7520acfb 100644 --- a/pglite/other_extensions/Makefile +++ b/pglite/other_extensions/Makefile @@ -18,6 +18,11 @@ ARCHIVE_DIR := /pglite/extensions/other EXTENSIONS := $(SUBDIRS) EXTENSIONS += postgis +# NOTE: pg_partman is deliberately not in SUBDIRS: its default target would compile the +# background worker, which cannot run in WASM. It is built SQL-only via its own +# dist rule below with NO_BGW=1 (which is an officially supported pg_partman build mode). +EXTENSIONS += pg_partman + # Default target: build tarballs for all contribs dist: $(addsuffix .tar.gz,$(EXTENSIONS)) @@ -46,6 +51,18 @@ age.tar.gz: files=$$(find . -type f -o -type l | sed 's|^\./||') && \ tar -czf $(ARCHIVE_DIR)/age.tar.gz $$files +# pg_partman's core is pure SQL/PLpgSQL; NO_BGW=1 skips its background worker C module +pg_partman.tar.gz: + @echo "=== Staging pg_partman (SQL-only, NO_BGW=1) ===" + rm -rf $(EXTENSIONS_BUILD_ROOT)/pg_partman + bash -c 'mkdir -p $(EXTENSIONS_BUILD_ROOT)/pg_partman/$(prefix)/{bin,lib,share/extension,share/doc,share/postgresql/extension}' + $(MAKE) -C pg_partman NO_BGW=1 install DESTDIR=$(EXTENSIONS_BUILD_ROOT)/pg_partman + @echo "=== Packaging pg_partman ===" + mkdir -p $(ARCHIVE_DIR) + cd $(EXTENSIONS_BUILD_ROOT)/pg_partman/$(prefix) && \ + files=$$(find . -type f -o -type l | sed 's|^\./||') && \ + tar -czf $(ARCHIVE_DIR)/pg_partman.tar.gz $$files + dist-postgis: @echo "=== Adding proj data to postgis archive ===" gunzip $(ARCHIVE_DIR)/postgis.tar.gz @@ -59,4 +76,4 @@ archive_clean: rm -rf $(EXTENSIONS_BUILD_ROOT)/$* rm -rf $(ARCHIVE_DIR) -$(recurse) \ No newline at end of file +$(recurse) diff --git a/pglite/other_extensions/pg_partman b/pglite/other_extensions/pg_partman new file mode 160000 index 0000000000000..f7e83b9c441c7 --- /dev/null +++ b/pglite/other_extensions/pg_partman @@ -0,0 +1 @@ +Subproject commit f7e83b9c441c7e97066d815bbe14e02a9dc5ff94