0

I am using the beta versions of PostgreSQL 16 under Ubuntu (22.04). An issue is that every time (three times so far) a new beta is released, the existing database/cluster has to be upgraded due to some format change.

The Ubuntu upgrade program showed the sequence of commands that needs to be copied and executed. But this has been tedious and error-prone as I have to do this on multiple machines. And I had experience with failed database upgrades leading to an unusable state.

To avoid the trouble, I just uninstall and purge all traces of PostgreSQL and reinstall it to the new version. But this is a bit time consuming.

My Question is:

Is there a reliable way to remove just the main cluster and then recreate it?

P.S. I use only one version of PostgreSQL and one main cluster. The database is dumped before the upgrade.

0

1 Answer 1

0

Q: Is there a reliable way to remove just the main cluster and then recreate it?

To remove the main cluster:

$ sudo -u postgres pg_dropcluster 16 main --stop

To create it again:

$ sudo -u postgres pg_createcluster 16 main

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.