On Wed, Jul 9, 2025 at 2:51 PM Mahendra Singh Thalor <mahi6...@gmail.com> wrote: > > This drops all databases: > > > > pg_dumpall --clean -Fd -f /tmp/dump > > pg_restore -d template1 --globals-only /tmp/dump > > > > That didn't match my expectations given this help text: > > > > $ pg_restore --help|grep global > > -g, --globals-only restore only global objects, no databases > > Databases are global objects so due to --clean command, we are putting > drop commands in global.dat for all the databases. While restoring, we > used the "--globals-only" option so we are dropping all these > databases by global.dat file. > > Please let us know your expectations for this specific case.
I am not sure whether pg_dumpall --clean should ever drop databases, but it certainly shouldn't do it with --globals-only. In that case, it's not restoring the databases, so dropping them seems catastrophically bad. -- Robert Haas EDB: http://www.enterprisedb.com