I am writing a
docker-compose config with a container with PostgreSQL in it.
docker-compose has a configuration options called
restart. If I enable it then whenever the Postgres process stops it will restart Postgres rightaway. However it is (probably) not relevant how it is restarted.
I know that in MySQL it is not safe to start the database right after it stopped because MyISAM tables may be broken. One has to manually repair MyISAM tables first with an unrelated command-line tool and then start the db.
So I wonder if it is generally safe to just restart PostgreSQL in case something is wrong. Or maybe we should first backup, repair, read logs and only then try to start it back.
A related situation would be a power outage for instance. What do I do after that?