docker-pgautoupgrade icon indicating copy to clipboard operation
docker-pgautoupgrade copied to clipboard

Failing even though extensions are built into image

Open anna-is-cute opened this issue 2 months ago • 2 comments

Hi! I've used this image to upgrade from 16 to 17 without issue in the past. Today I tried to upgrade to 18 with no luck, however. I was hoping someone might be able to explain what's going wrong here.

FROM docker.io/pgautoupgrade/pgautoupgrade:18-alpine

RUN apk add --no-cache build-base clang19 llvm19 \
    && mkdir build \
    && cd build \
    && wget https://api.pgxn.org/dist/semver/0.40.0/semver-0.40.0.zip \
    && unzip semver-0.40.0.zip \
    && cd semver-0.40.0 \
    && make \
    && make install \
    && cd ../.. \
    && rm -rf build \
    && mkdir build \
    && cd build \
    && wget https://github.com/HypoPG/hypopg/archive/refs/tags/1.4.2.tar.gz \
    && tar -xvf 1.4.2.tar.gz \
    && cd hypopg-1.4.2 \
    && make \
    && make install \
    && cd ../.. \
    && rm -rf build \
    && mkdir build \
    && cd build \
    && wget https://github.com/supabase/index_advisor/archive/refs/tags/v0.2.0.tar.gz \
    && tar -xvf v0.2.0.tar.gz \
    && cd index_advisor-0.2.0 \
    && make \
    && make install \
    && cd ../.. \
    && rm -rf build \
    && apk del build-base clang19 llvm19 \
    && rm -f /sbin/apk \
    && rm -rf /etc/apk \
    && rm -rf /lib/apk \
    && rm -rf /usr/share/apk \
    && rm -rf /var/lib/apk

Basically I just install the three extensions used by my prod database into the image. This is actually the same Dockerfile I use for the prod database but with the FROM line changed.

I build that image as upgrade-db, and then run it as follows.

podman run --name pgauto -it \
    --volume database-data:/var/lib/postgresql \
    -e POSTGRES_PASSWORD=redacted \
    -e PGAUTO_ONESHOT=true \
    upgrade-db

It fails on not finding the semver extension.

command: "/usr/local/bin/pg_dump" --host /var/run/postgresql --port 50432 --username postgres --no-data --sequence-data  --quote-all-identifiers --binary-upgrade --format=custom --statistics --no-sync --file="/var/lib/postgresql/18/docker/new/pg_upgrade_output.d/20251028T152537.575/dump/pg_upgrade_dump_17805.custom" 'dbname=generic' >> "/var/lib/postgresql/18/docker/new/pg_upgrade_output.d/20251028T152537.575/log/pg_upgrade_dump_17805.log" 2>&1
pg_dump: error: query failed: ERROR:  could not access file "semver": No such file or directory
pg_dump: detail: Query was: EXECUTE getAttributeStats('[truncated]

Any idea what's going wrong here? The extension is definitely there!

podman run --rm -it --entrypoint /bin/bash upgrade-db
544c23c11e06:/var/lib/postgresql# ls /usr/local/share/postgresql/extension/ | grep -i semver
semver.control

anna-is-cute avatar Oct 28 '25 15:10 anna-is-cute

could you append more of the log? I am a bit confused where this pg_dump is happening in the upgrade process on the new cluster notably.

andyundso avatar Oct 28 '25 22:10 andyundso

That's the entirety of the actual log file (truncated bit is just a list of my tables), but the output showed the error happening during the "consistency checks* phase where it was dumping the schema of my database. If you need that output specifically, I can run it again, but it will take me some time.

anna-is-cute avatar Oct 28 '25 22:10 anna-is-cute