Skip to content

Postgis extension upgrade issue #256

Description

@kurdyshev

Description

I followed the example from the PostGIS extension container documentation (https://github.com/cloudnative-pg/postgres-extensions-containers/blob/main/postgis/README.md) and created a CloudNativePG cluster using PostGIS extension version 3.6.3.
After that, I tried to upgrade the PostGIS extension to 3.6.4 by changing the extension image version and updating the Database resource.
The new extension version is available, but the database extension upgrade fails.

~ kubectl exec -it cluster-postgis-1 -- psql app -c "\dx"
Defaulted container "postgres" out of: postgres, bootstrap-controller (init)
                                                                                List of installed extensions
             Name             | Version | Default version |   Schema   |                                                     Description            
                                         
------------------------------+---------+-----------------+------------+----------------------------------------------------------------------------
-----------------------------------------
 address_standardizer         | 3.6.3   | 3.6.4           | public     | Used to parse an address into constituent elements. Generally used to suppo
rt geocoding address normalization step.
 address_standardizer_data_us | 3.6.3   | 3.6.4           | public     | Address Standardizer US dataset example
 fuzzystrmatch                | 1.2     | 1.2             | public     | determine similarities and distance between strings
 plpgsql                      | 1.0     | 1.0             | pg_catalog | PL/pgSQL procedural language
 postgis                      | 3.6.3   | 3.6.4           | public     | PostGIS geometry and geography spatial types and functions
 postgis_raster               | 3.6.3   | 3.6.4           | public     | PostGIS raster types and functions
 postgis_sfcgal               | 3.6.3   | 3.6.4           | public     | PostGIS SFCGAL functions
 postgis_tiger_geocoder       | 3.6.3   | 3.6.4           | tiger      | PostGIS tiger geocoder and reverse geocoder
 postgis_topology             | 3.6.3   | 3.6.4           | topology   | PostGIS topology spatial types and functions
(9 rows)

Error

The Database resource reports:

~ kubectl get database cluster-postgis-app -o yaml | grep -A 6 status
status:
  applied: false
  extensions:
  - applied: false
    message: 'altering version: ERROR: could not access file "$libdir/postgis-3":
      No such file or directory (SQLSTATE 58P01)'
    name: postgis

Additional testing

Manually recreating the extension works:

DROP EXTENSION postgis CASCADE;
CREATE EXTENSION postgis;

After recreation, the extension is created with version 3.6.4.

Expected behavior

It should be possible to upgrade an existing PostGIS extension from 3.6.3 to 3.6.4 without dropping and recreating the extension.
The extension upgrade should work through:

ALTER EXTENSION postgis UPDATE TO '3.6.4';

Question

Is this expected behavior with the current PostGIS extension container image?
If no, could the extension image be adjusted so that ALTER EXTENSION UPDATE can find the required shared library during the upgrade?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions