postgis / docker-postgis

Docker image for PostGIS
https://hub.docker.com/r/postgis/postgis/
MIT License
1.35k stars 462 forks source link

search_path is lacking topology #288

Closed strk closed 2 years ago

strk commented 2 years ago

See https://gitlab.com/nibioopensource/pgtopo_update_rest/-/jobs/2305639540#L695 The search_path for the dockerized database is: "$user", public, tiger This is for tag 13-3.2-alpine, I didn't test other tags

strk commented 2 years ago

I've just tested that this is also the case for the 13-master tag: https://gitlab.com/nibioopensource/pgtopo_update_rest/-/jobs/2305781533#L257

strk commented 2 years ago

Both template_postgis and postgres databases have the missing topology schema, even with latest tag:

root@docker:~# docker exec -ti postgis-latest psql -U postgres -l
                                    List of databases
       Name       |  Owner   | Encoding |  Collate   |   Ctype    |   Access privileges   
------------------+----------+----------+------------+------------+-----------------------
 postgres         | postgres | UTF8     | en_US.utf8 | en_US.utf8 | 
 template0        | postgres | UTF8     | en_US.utf8 | en_US.utf8 | =c/postgres          +
                  |          |          |            |            | postgres=CTc/postgres
 template1        | postgres | UTF8     | en_US.utf8 | en_US.utf8 | =c/postgres          +
                  |          |          |            |            | postgres=CTc/postgres
 template_postgis | postgres | UTF8     | en_US.utf8 | en_US.utf8 | 
(4 rows)

root@docker:~# docker exec -ti postgis-latest psql -U postgres template_postgis
psql (13.5 (Debian 13.5-1.pgdg110+1))
Type "help" for help.

template_postgis=# show search_path;
      search_path       
------------------------
 "$user", public, tiger
(1 row)

template_postgis=# 
\q
root@docker:~# docker exec -ti postgis-latest psql -U postgres postgres
psql (13.5 (Debian 13.5-1.pgdg110+1))
Type "help" for help.

postgres=# show search_path;
      search_path       
------------------------
 "$user", public, tiger
(1 row)
strk commented 2 years ago

I've created a new database from within the docker container to see what would have happened and surprise: installing tiger_geocoder removes the topology item:

test_issue288=# CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;
CREATE EXTENSION
test_issue288=# show search_path;              
        search_path        
---------------------------
 "$user", public, topology
(1 row)

test_issue288=# CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;
CREATE EXTENSION
test_issue288=# show search_path;              
      search_path       
------------------------
 "$user", public, tiger
(1 row)
strk commented 2 years ago

Dropping and re-creating postgis_topology extension removes the tiger schema from search_path and adds the topology schema instead. They contend their name in the search_path, will need to be filed upstream.

strk commented 2 years ago

NOTE: reconnecting to database after the creation of the first extension, before creating the next extension, fixes the problem

strk commented 2 years ago

Upstream ticket: https://trac.osgeo.org/postgis/ticket/5125