Troubleshoot PostGIS® upgrade issues
Troubleshoot issues that block PostGIS® extension upgrades on Aiven for PostgreSQL® services, and complete the upgrade safely.
Upgrade PostGIS® to 3.6 with topology columns
Upgrade PostGIS topology columns manually when an Aiven for PostgreSQL® service has topology.topoelement or topology.topoelementarray columns and a pre-flight check blocks the upgrade from a PostGIS version earlier than 3.6 to 3.6 or later.
This procedure applies only to services that store topology columns, which is a small subset of PostGIS users. If your databases do not use topology columns, the standard upgrade process applies and no manual steps are required.
Why the upgrade is blocked
PostGIS 3.6.0 introduced a breaking change that affects user tables with
topology.topoelement or topology.topoelementarray columns.
In PostGIS 3.6.0, the base type of the topology.topoelement domain changed from
integer[] to bigint[]. The upgrade script then adds a CHECK constraint that
validates all existing data. When user tables store data in these columns, the
upgrade fails:
- Existing data was stored as
integer[], using 4-byte integers per element. - After the domain change, PostgreSQL reinterprets the same byte data as
bigint[], using 8-byte integers. - Array element access returns incorrect values. For example,
ARRAY[1,2]stored asinteger[]reads asARRAY[1,0]when interpreted asbigint[]. - The CHECK constraint validation fails, which blocks the extension upgrade.
The Aiven pre-flight check detects these columns and blocks the upgrade before any changes are made to your service, so the service stays in a consistent state. The error message lists the affected databases, schemas, tables, and columns, references upstream issue #5983, and directs you to Aiven support. Use this procedure to prepare your databases, with support assistance, before you retry the upgrade.
When the upgrade fails, you might see:
CheckViolationerrors duringALTER EXTENSION postgis_topology UPDATE.- Error messages about invalid topology element references.
- An extension upgrade blocked with an error that mentions topology columns.