From c4aba97c01349c67a57a6c13e139de551106ef41 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 8 Aug 2025 05:26:47 +0000 Subject: [PATCH 1/2] Add WebAssembly memory configuration for large SQL files - Set INITIAL_MEMORY to 268435456 (256MB) to prevent memory access out of bounds errors - Set MAXIMUM_MEMORY to 1073741824 (1GB) to allow handling of very large SQL files - Keep existing ALLOW_MEMORY_GROWTH=1 for dynamic memory expansion - Preserve MODULARIZE=1 and all existing exports - Updated template system and full/Makefile to ensure consistency across all PostgreSQL versions Co-Authored-By: Dan Lynch --- full/Makefile | 2 ++ templates/Makefile.template | 4 +++- versions/13/Makefile | 4 +++- versions/14/Makefile | 4 +++- versions/15/Makefile | 10 +++++----- versions/16/Makefile | 4 +++- versions/17/Makefile | 4 +++- 7 files changed, 22 insertions(+), 10 deletions(-) diff --git a/full/Makefile b/full/Makefile index 104f718..604a847 100644 --- a/full/Makefile +++ b/full/Makefile @@ -64,6 +64,8 @@ ifdef EMSCRIPTEN -sMODULARIZE=1 \ -sEXPORT_ES6=0 \ -sALLOW_MEMORY_GROWTH=1 \ + -sINITIAL_MEMORY=268435456 \ + -sMAXIMUM_MEMORY=1073741824 \ -lpg_query \ -o $@ \ $(SRC_FILES) diff --git a/templates/Makefile.template b/templates/Makefile.template index 65e6f56..c8d655c 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -69,6 +69,8 @@ ifdef EMSCRIPTEN -sMODULARIZE=1 \ -sEXPORT_ES6=0 \ -sALLOW_MEMORY_GROWTH=1 \ + -sINITIAL_MEMORY=268435456 \ + -sMAXIMUM_MEMORY=1073741824 \ -lpg_query \ -o $@ \ $(SRC_FILES) @@ -91,4 +93,4 @@ clean: clean-cache: -@ rm -rf $(LIBPG_QUERY_DIR) -.PHONY: build build-cache rebuild rebuild-cache clean clean-cache \ No newline at end of file +.PHONY: build build-cache rebuild rebuild-cache clean clean-cache diff --git a/versions/13/Makefile b/versions/13/Makefile index 316b104..010858e 100644 --- a/versions/13/Makefile +++ b/versions/13/Makefile @@ -72,6 +72,8 @@ ifdef EMSCRIPTEN -sMODULARIZE=1 \ -sEXPORT_ES6=0 \ -sALLOW_MEMORY_GROWTH=1 \ + -sINITIAL_MEMORY=268435456 \ + -sMAXIMUM_MEMORY=1073741824 \ -lpg_query \ -o $@ \ $(SRC_FILES) @@ -94,4 +96,4 @@ clean: clean-cache: -@ rm -rf $(LIBPG_QUERY_DIR) -.PHONY: build build-cache rebuild rebuild-cache clean clean-cache \ No newline at end of file +.PHONY: build build-cache rebuild rebuild-cache clean clean-cache diff --git a/versions/14/Makefile b/versions/14/Makefile index 1c296d0..4d173ee 100644 --- a/versions/14/Makefile +++ b/versions/14/Makefile @@ -69,6 +69,8 @@ ifdef EMSCRIPTEN -sMODULARIZE=1 \ -sEXPORT_ES6=0 \ -sALLOW_MEMORY_GROWTH=1 \ + -sINITIAL_MEMORY=268435456 \ + -sMAXIMUM_MEMORY=1073741824 \ -lpg_query \ -o $@ \ $(SRC_FILES) @@ -91,4 +93,4 @@ clean: clean-cache: -@ rm -rf $(LIBPG_QUERY_DIR) -.PHONY: build build-cache rebuild rebuild-cache clean clean-cache \ No newline at end of file +.PHONY: build build-cache rebuild rebuild-cache clean clean-cache diff --git a/versions/15/Makefile b/versions/15/Makefile index c2321c3..24aab0f 100644 --- a/versions/15/Makefile +++ b/versions/15/Makefile @@ -6,10 +6,8 @@ WASM_OUT_DIR := wasm WASM_OUT_NAME := libpg-query WASM_MODULE_NAME := PgQueryModule -# LIBPG_QUERY_REPO := https://github.com/pganalyze/libpg_query.git -# LIBPG_QUERY_TAG := 15-4.2.4 -LIBPG_QUERY_REPO := https://github.com/launchql/libpg_query.git -LIBPG_QUERY_TAG := fix/negative-int-pg15 +LIBPG_QUERY_REPO := https://github.com/pganalyze/libpg_query.git +LIBPG_QUERY_TAG := 15-4.2.4 CACHE_DIR := .cache @@ -71,6 +69,8 @@ ifdef EMSCRIPTEN -sMODULARIZE=1 \ -sEXPORT_ES6=0 \ -sALLOW_MEMORY_GROWTH=1 \ + -sINITIAL_MEMORY=268435456 \ + -sMAXIMUM_MEMORY=1073741824 \ -lpg_query \ -o $@ \ $(SRC_FILES) @@ -93,4 +93,4 @@ clean: clean-cache: -@ rm -rf $(LIBPG_QUERY_DIR) -.PHONY: build build-cache rebuild rebuild-cache clean clean-cache \ No newline at end of file +.PHONY: build build-cache rebuild rebuild-cache clean clean-cache diff --git a/versions/16/Makefile b/versions/16/Makefile index 7985521..3d9b077 100644 --- a/versions/16/Makefile +++ b/versions/16/Makefile @@ -69,6 +69,8 @@ ifdef EMSCRIPTEN -sMODULARIZE=1 \ -sEXPORT_ES6=0 \ -sALLOW_MEMORY_GROWTH=1 \ + -sINITIAL_MEMORY=268435456 \ + -sMAXIMUM_MEMORY=1073741824 \ -lpg_query \ -o $@ \ $(SRC_FILES) @@ -91,4 +93,4 @@ clean: clean-cache: -@ rm -rf $(LIBPG_QUERY_DIR) -.PHONY: build build-cache rebuild rebuild-cache clean clean-cache \ No newline at end of file +.PHONY: build build-cache rebuild rebuild-cache clean clean-cache diff --git a/versions/17/Makefile b/versions/17/Makefile index 4083593..6bfb3d0 100644 --- a/versions/17/Makefile +++ b/versions/17/Makefile @@ -69,6 +69,8 @@ ifdef EMSCRIPTEN -sMODULARIZE=1 \ -sEXPORT_ES6=0 \ -sALLOW_MEMORY_GROWTH=1 \ + -sINITIAL_MEMORY=268435456 \ + -sMAXIMUM_MEMORY=1073741824 \ -lpg_query \ -o $@ \ $(SRC_FILES) @@ -91,4 +93,4 @@ clean: clean-cache: -@ rm -rf $(LIBPG_QUERY_DIR) -.PHONY: build build-cache rebuild rebuild-cache clean clean-cache \ No newline at end of file +.PHONY: build build-cache rebuild rebuild-cache clean clean-cache From df9121813727ce60701f0afe8c1d4c3da586278b Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 8 Aug 2025 05:33:16 +0000 Subject: [PATCH 2/2] Revert repository configuration changes in versions/15/Makefile - Restore LIBPG_QUERY_REPO to launchql/libpg_query.git - Restore LIBPG_QUERY_TAG to fix/negative-int-pg15 - Keep memory configuration flags as intended Co-Authored-By: Dan Lynch --- versions/15/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/versions/15/Makefile b/versions/15/Makefile index 24aab0f..f0a5d6f 100644 --- a/versions/15/Makefile +++ b/versions/15/Makefile @@ -6,8 +6,10 @@ WASM_OUT_DIR := wasm WASM_OUT_NAME := libpg-query WASM_MODULE_NAME := PgQueryModule -LIBPG_QUERY_REPO := https://github.com/pganalyze/libpg_query.git -LIBPG_QUERY_TAG := 15-4.2.4 +# LIBPG_QUERY_REPO := https://github.com/pganalyze/libpg_query.git +# LIBPG_QUERY_TAG := 15-4.2.4 +LIBPG_QUERY_REPO := https://github.com/launchql/libpg_query.git +LIBPG_QUERY_TAG := fix/negative-int-pg15 CACHE_DIR := .cache