On Thu, 2020-11-05 at 19:03 +0000, Dmitry O Litvintsev wrote:
> I have a workflow where I recover from PITR backup and run a query on it. The program that runs query
> checks that it can connect to database in a loop, until it can, and then runs the query.
> This has worked fine far. Recently I upgraded to 11 and I see that I can connect to DB while recovery is
> not complete yet.
That's because "hot_standby = on" by default from v10 on.
You could change the configuration and set it to "off",
then PostgreSQL will continue to work as before.
The alternative way is running this after you connect:
SELECT pg_is_in_recovery();
If that returns TRUE, recovery is not done yet.
Back out, wait a while, then try again.
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com