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