From e3efb0d854b754f02a543b2af59f3b519ad8d19f Mon Sep 17 00:00:00 2001 From: Vadim Kharitonov Date: Wed, 25 Jan 2023 18:29:06 +0100 Subject: [PATCH] Fix bug while creating unit extension (#3447) after executing ```sql CREATE EXTENSION unit; ``` I saw such error ``` ERROR: could not open file "/usr/local/pgsql/share/extension/unit_prefixes.data" for reading: No such file or directory (SQLSTATE 58P01) ``` Co-authored-by: Anastasia Lubennikova --- Dockerfile.compute-node | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Dockerfile.compute-node b/Dockerfile.compute-node index 3d6cfd4e6b..936f368833 100644 --- a/Dockerfile.compute-node +++ b/Dockerfile.compute-node @@ -147,6 +147,11 @@ RUN wget https://github.com/df7cb/postgresql-unit/archive/refs/tags/7.7.tar.gz & cd postgresql-unit-7.7 && \ make -j $(getconf _NPROCESSORS_ONLN) PG_CONFIG=/usr/local/pgsql/bin/pg_config && \ make -j $(getconf _NPROCESSORS_ONLN) install PG_CONFIG=/usr/local/pgsql/bin/pg_config && \ + # unit extension's "create extension" script relies on absolute install path to fill some reference tables. + # We move the extension from '/usr/local/pgsql/' to '/usr/local/' after it is build. So we need to adjust the path. + # This one-liner removes pgsql/ part of the path. + # NOTE: Other extensions that rely on MODULEDIR variable after building phase will need the same fix. + find /usr/local/pgsql/share/extension/ -name "unit*.sql" -print0 | xargs -0 sed -i "s|pgsql/||g" && \ echo 'trusted = true' >> /usr/local/pgsql/share/extension/unit.control #########################################################################################