The following bug has been logged on the website:
Bug reference: 17333
Logged by: Eric Meygret
Email address: eric.meygret@free.fr
PostgreSQL version: 14.1
Operating system: Ubuntu 20.04
Description:
Hello,
first I want to say that this bug could delete all data, and second sorry
for my bad English.
I tried to upgrade a database from 9.6 to 14(but I think it is the same for
any migrations).
in /etc/postgresql/9.6/main/postgresql.conf I have to times data_directory
first default value:
data_directory = '/var/lib/postgresql/9.6/main'
and at the end of file
data_directory = '/postgresql/9.6/main/'
postgresql ignore first value.
when I launch upgrade with
pg_upgradecluster -v 14 --method=link --link 9.6 main /postgresql/14/main/
upgrade copy /etc/postgresql/9.6/main/postgresql.conf to
/etc/postgresql/14/main/postgresql.conf
and replace first occurrence so I have :
data_directory = '/postgresql/14/main/'
and at then end of the configuration file :
data_directory = '/postgresql/9.6/main/'
the upgrade failed and start a pg_dropcluster 14 main and this one use the
last occurrence so delete /postgresql/9.6/main/
and now all data are lost. (thanks to backup before upgrade :) )
hope that my explanation is correct and understandable.