BUG #17333: pgdg postgresql-common pg_upgradecluster duplicate data_directory in configuration file - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #17333: pgdg postgresql-common pg_upgradecluster duplicate data_directory in configuration file
Date
Msg-id 17333-a00bcda4fab7c6d4@postgresql.org
Whole thread Raw
Responses Re: BUG #17333: pgdg postgresql-common pg_upgradecluster duplicate data_directory in configuration file
List pgsql-bugs
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.


pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #17330: EXPLAIN hangs and very long query plans
Next
From: "David G. Johnston"
Date:
Subject: Re: BUG #17333: pgdg postgresql-common pg_upgradecluster duplicate data_directory in configuration file