最新バージョンにアップグレードしたら全てが消えた

postgres テンプレートファイルを確認しました。これは1つのデータベースのみを対象としています。これは異常です。既存のデータベースをループ処理して変更するべきでした。このシナリオで解決策を探している方のために、ここに残しておきます

DB_LIST=$(su postgres -c "/usr/lib/postgresql/${PG_MAJOR_OLD}/bin/psql -p 5432 -tAc \"select datname from pg_database where not datistemplate and datname != 'postgres'\"")

for DB in $DB_LIST; do
  su postgres -c "/usr/lib/postgresql/${PG_MAJOR_OLD}/bin/pg_dump -Fd -j$(nproc --ignore=1) \"$DB\" -f /shared/postgres_dump/\"$DB\""
done