From e3a39499f2b7b4193c63441fd3254dfcbcf50a8a Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 13 Feb 2026 05:44:58 +1300 Subject: [PATCH] fix: Patch PostgreSQL boolean type mismatch in batch inserts The SQL adapter's createDocuments() unconditionally casts boolean values to integers (line 2518 in SQL.php), but PostgreSQL rejects int values for native BOOLEAN columns. The single-document path already has an instanceof check to preserve booleans for Postgres, but createDocuments() was missed. This patch applies the same fix via a PHP script run during Docker build. Fixes 26 test failures across PostgreSQL Legacy, TablesDB, and GraphQL suites. Co-Authored-By: Claude Opus 4.6 --- Dockerfile | 5 +++++ patches/fix-postgres-boolean.php | 38 ++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 patches/fix-postgres-boolean.php diff --git a/Dockerfile b/Dockerfile index 8222990d90..e8e79c000b 100755 --- a/Dockerfile +++ b/Dockerfile @@ -32,6 +32,11 @@ WORKDIR /usr/src/code COPY --from=composer /usr/local/src/vendor /usr/src/code/vendor +# Patch: Fix PostgreSQL boolean type mismatch in batch inserts (utopia-php/database#createDocuments). +# TODO: Remove once utopia-php/database is updated with the upstream fix. +COPY ./patches/fix-postgres-boolean.php /tmp/fix-postgres-boolean.php +RUN php /tmp/fix-postgres-boolean.php && rm /tmp/fix-postgres-boolean.php + # Add Source Code COPY ./app /usr/src/code/app COPY ./public /usr/src/code/public diff --git a/patches/fix-postgres-boolean.php b/patches/fix-postgres-boolean.php new file mode 100644 index 0000000000..fae7db769b --- /dev/null +++ b/patches/fix-postgres-boolean.php @@ -0,0 +1,38 @@ +