Skip to content

Upgrade to postgis 3.7 - #465

Merged
ImreSamu merged 2 commits into
postgis:masterfrom
ImreSamu:update_2026oct31
Nov 5, 2026
Merged

ImreSamu merged 2 commits into
postgis:masterfrom
ImreSamu:update_2026oct31

Conversation

@ImreSamu

Copy link
Copy Markdown
Member

No description provided.

@ImreSamu
ImreSamu marked this pull request as ready for review November 3, 2026 21:56
@ImreSamu
ImreSamu requested a review from phillipross November 3, 2026 21:57
@ImreSamu

ImreSamu commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

Ready to review
( cc @phillipross )

@phillipross phillipross left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@phillipross phillipross left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woops, I approved too soon. I think #466 may need some attention.

@ImreSamu

ImreSamu commented Nov 5, 2026

Copy link
Copy Markdown
Member Author

Thank you, please re-check !


I have created a quick fix for #466: update-postgis.sh
so no longer fails on postgis 3.7 images, which don't provide postgis_tiger_geocoder.
I also added a new test: test/tests/postgis-update/run.sh.

This is only a temporary solution. For a full update compatibility, we may still need to re-add the address_standardizer and tiger geocoder packages to the debian and alpine images ( installed but not initialized )
But that needs more thought, so this PR only aims to be a quick fix.

I also checked the CI logs, and the : 'postgis-update' [7/7]...passed`

And this is my local test:

$ docker stop pgis || true
docker rm   pgis || true
docker run -d --name pgis -e POSTGRES_PASSWORD=pw postgis/postgis:18-3.7-alpine
docker exec pgis  bash -c "while ! pg_isready --host 127.0.0.1; do sleep 1; done ;"
docker exec -t pgis psql -U postgres -c"\dx"
docker exec -u postgres pgis bash -x update-postgis.sh
docker exec -t pgis psql -U postgres -c"\dx"

pgis
pgis
7932e7b2107d64c3d9a6702184bb08e530d1ae45ade24affca20e6bf258097b9
127.0.0.1:5432 - no response
127.0.0.1:5432 - no response
127.0.0.1:5432 - no response
127.0.0.1:5432 - accepting connections
                                              List of installed extensions
       Name       | Version | Default version |   Schema   |                        Description                         
------------------+---------+-----------------+------------+------------------------------------------------------------
 plpgsql          | 1.0     | 1.0             | pg_catalog | PL/pgSQL procedural language
 postgis          | 3.7.0   | 3.7.0           | public     | PostGIS geometry and geography spatial types and functions
 postgis_topology | 3.7.0   | 3.7.0           | topology   | PostGIS topology spatial types and functions
(3 rows)

+ set -e
+ export PGUSER=
+ PGUSER=
+ POSTGIS_VERSION=3.7.0
+ '[' -z 3.7.0 ']'
+ for DB in template_postgis "$POSTGRES_DB" "${@}"
+ echo 'Updating PostGIS extensions '\''template_postgis'\'' to 3.7.0'
Updating PostGIS extensions 'template_postgis' to 3.7.0
+ psql --dbname=template_postgis -c $'\n        -- Upgrade PostGIS (includes raster)\n        CREATE EXTENSION IF NOT EXISTS postgis VERSION \'3.7.0\';\n        ALTER EXTENSION postgis UPDATE TO \'3.7.0\';\n\n        -- Upgrade Topology\n        CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION \'3.7.0\';\n        ALTER EXTENSION postgis_topology UPDATE TO \'3.7.0\';\n\n        DO $$\n        DECLARE\n            orphan text;\n        BEGIN\n            -- PostGIS 3.7 and later no longer provide the US Tiger Geocoder\n            IF EXISTS (\n                SELECT FROM pg_available_extension_versions\n                WHERE name = \'postgis_tiger_geocoder\' AND version = \'3.7.0\'\n            ) THEN\n                -- Install Tiger dependencies in case not already installed\n                CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;\n                -- Upgrade US Tiger Geocoder\n                CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION \'3.7.0\';\n                ALTER EXTENSION postgis_tiger_geocoder UPDATE TO \'3.7.0\';\n            END IF;\n\n            -- Installed earlier, but this image can no longer upgrade them\n            FOR orphan IN\n                SELECT e.extname FROM pg_extension e\n                WHERE e.extname IN (\'postgis_tiger_geocoder\', \'address_standardizer\', \'address_standardizer_data_us\')\n                  AND NOT EXISTS (SELECT FROM pg_available_extensions a WHERE a.name = e.extname)\n            LOOP\n                RAISE WARNING \'extension "%" is installed in database "%", but this image does not provide it: not upgraded\', orphan, current_database();\n            END LOOP;\n        END\n        $$;\n    '
NOTICE:  extension "postgis" already exists, skipping
NOTICE:  version "3.7.0" of extension "postgis" is already installed
NOTICE:  extension "postgis_topology" already exists, skipping
CREATE EXTENSION
ALTER EXTENSION
NOTICE:  version "3.7.0" of extension "postgis_topology" is already installed
CREATE EXTENSION
ALTER EXTENSION
DO
+ for DB in template_postgis "$POSTGRES_DB" "${@}"
+ echo 'Updating PostGIS extensions '\'''\'' to 3.7.0'
Updating PostGIS extensions '' to 3.7.0
+ psql --dbname= -c $'\n        -- Upgrade PostGIS (includes raster)\n        CREATE EXTENSION IF NOT EXISTS postgis VERSION \'3.7.0\';\n        ALTER EXTENSION postgis UPDATE TO \'3.7.0\';\n\n        -- Upgrade Topology\n        CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION \'3.7.0\';\n        ALTER EXTENSION postgis_topology UPDATE TO \'3.7.0\';\n\n        DO $$\n        DECLARE\n            orphan text;\n        BEGIN\n            -- PostGIS 3.7 and later no longer provide the US Tiger Geocoder\n            IF EXISTS (\n                SELECT FROM pg_available_extension_versions\n                WHERE name = \'postgis_tiger_geocoder\' AND version = \'3.7.0\'\n            ) THEN\n                -- Install Tiger dependencies in case not already installed\n                CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;\n                -- Upgrade US Tiger Geocoder\n                CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION \'3.7.0\';\n                ALTER EXTENSION postgis_tiger_geocoder UPDATE TO \'3.7.0\';\n            END IF;\n\n            -- Installed earlier, but this image can no longer upgrade them\n            FOR orphan IN\n                SELECT e.extname FROM pg_extension e\n                WHERE e.extname IN (\'postgis_tiger_geocoder\', \'address_standardizer\', \'address_standardizer_data_us\')\n                  AND NOT EXISTS (SELECT FROM pg_available_extensions a WHERE a.name = e.extname)\n            LOOP\n                RAISE WARNING \'extension "%" is installed in database "%", but this image does not provide it: not upgraded\', orphan, current_database();\n            END LOOP;\n        END\n        $$;\n    '
NOTICE:  extension "postgis" already exists, skipping
NOTICE:  version "3.7.0" of extension "postgis" is already installed
NOTICE:  extension "postgis_topology" already exists, skipping
CREATE EXTENSION
ALTER EXTENSION
NOTICE:  version "3.7.0" of extension "postgis_topology" is already installed
CREATE EXTENSION
ALTER EXTENSION
DO
                                              List of installed extensions
       Name       | Version | Default version |   Schema   |                        Description                         
------------------+---------+-----------------+------------+------------------------------------------------------------
 plpgsql          | 1.0     | 1.0             | pg_catalog | PL/pgSQL procedural language
 postgis          | 3.7.0   | 3.7.0           | public     | PostGIS geometry and geography spatial types and functions
 postgis_topology | 3.7.0   | 3.7.0           | topology   | PostGIS topology spatial types and functions
(3 rows)

@phillipross phillipross left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good now, thanks!

@ImreSamu
ImreSamu merged commit 0ff5ed7 into postgis:master Nov 5, 2026
33 checks passed
jgarber623-cargosense added a commit to CargoSense/docker-postgis that referenced this pull request Nov 16, 2026
Matches upstream changes that drop v3.6 in favor of v3.7.

See-also: postgis/docker-postgis#465
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants