Package: postgresql-common
Architecture: amd64
Version: 225
Severity: serious
Justification: Potential data loss (lower at your discretion)
Tags: bullseye
X-Debbugs-CC: d.fil...@web.de

During an upgrade from Buster to Bullseye I also had to upgrade a
cluster from postgresql 11 to 13.  The cluster had the postgis
extension enabled (postgis 2.5.1) and one table with columns of types
from postgis.  My typescript tells me that during "apt full-upgrade"
postgresql-11-postgis-2.5 was removed.

After "apt full-upgrade" was done I installed
postgresql-13-postgis-3-scripts thinking that it would be necessary
for migrating any postgis metadata tables.  Then I tried to migrate
the cluster by running "pg_upgradecluster 11 main", but the migration
failed (the error message roughly was "$lib/postgis-2.5 not found" or
sth. like that; I didn't log that part).  I reactivated the Buster
repos in /etc/apt/sources.list and downgraded some packages back so
that I could install postgresql-11-postgis-2.5-scripts again.  I did
not install postgresql-11-postgis-2.5, though (which, as far as I can
tell, would have been impossible anyway due to conflicting
dependencies, which was presumably also the reason for why it was
automatically removed).  Resolving the dependency rat's nest was not
easy.  Here's the state after:

  # aptitude versions '?or(~npostgis, ~npostgres) ~i' \
        |sed 's@i[ ][ ]@i M @;s@  \([0-9]\+\)$@ locally \1@' \
        |paste - - -|column -t
  Package  libreoffice-sdbc-postgresql:        i  A  1:7.0.4-3        testing  
500
  Package  postgis:                            i  M  3.1.1+dfsg-1     testing  
500
  Package  postgis-gui:                        i  M  2.5.1+dfsg-1     locally  
100
  Package  postgresql:                         i  M  13+225           testing  
500
  Package  postgresql-11:                      i  M  11.12-0+deb10u1  locally  
100
  Package  postgresql-11-postgis-2.5-scripts:  i  M  2.5.1+dfsg-1     locally  
100
  Package  postgresql-11-python3-multicorn:    i  M  1.3.4-4          locally  
100
  Package  postgresql-13:                      i  A  13.2-1           testing  
500
  Package  postgresql-13-postgis-3:            i  M  3.1.1+dfsg-1     testing  
500
  Package  postgresql-13-postgis-3-scripts:    i  A  3.1.1+dfsg-1     testing  
500
  Package  postgresql-client-11:               i  M  11.12-0+deb10u1  locally  
100
  Package  postgresql-client-13:               i  A  13.2-1           testing  
500
  Package  postgresql-client-common:           i  A  225              testing  
500
  Package  postgresql-common:                  i  A  225              testing  
500
  Package  postgresql-contrib:                 i  M  13+225           testing  
500
  Package  postgresql-doc:                     i  M  13+225           testing  
500
  Package  postgresql-doc-11:                  i  M  11.12-0+deb10u1  locally  
100
  Package  postgresql-doc-13:                  i  A  13.2-1           testing  
500

Packages listed as "locally" are Buster packages.

After that I reran "pg_upgradecluster 11 main" and this time the
upgrade worked (but with error messages, which I foolishly did not
log).  However, after temporarily reenabling the old 11 cluster to
check if anything was missing I noticed that the table with postgis
columns was not copied over, and the postgis extension does not show
up in the upgraded cluster either when running: psql -c '\dx' (it does
in the 11 cluster).

I'm filing this bug also to learn how this was supposed to work.  Does
the automatic removal of postgresql-11-postgis-2.5 not effectively
render the cluster unmigratable?  I'm filing it against
postgresql-common as it contains the pg_upgradecluster command.

As for a resolution: I think apt-listchanges should at least warn
people who have extensions installed to dump clusters before
continuing the upgrade and restore them manually.

Regards,
Dennis.

Reply via email to