PostgreSQL 12.4 restore_command in postgresql.auto.conf
Windows 2016, Windows 2019
12.4 Source Binary with our custom MSI installer
I have a restore TCL script writing restore_command to the ‘recovery.conf’ file since PostgreSQL 9.2. The content of the file has a single restore_command (restore_command='CALL "C:\\Program Files\\Entrust\\ECA\\bin\\RESTWAL.BAT" "c:\\entbackup\\mgrbk20201112190721\\Database\\walfiles\\%f"
"%p"') to indicate which backup to restore.
From PostgreSQL v12, the TCL script is updated to write the restore_command to PGDATA\postgresql.auto.conf and then create the recovery.signal file before starting the PostgreSQL service. Please see my test scenario:
Installed PostgreSQL 12.4 on a Windows 2019 VM, database cluster has been initialized and schema created, loaded with data. Created 4 full database base backups to test restore functionality as follow:
Please select the backup to restore.
Select option 1-4, or 'q' to quit:
I can perform consecutive restores to backup #4, then immediately restores to #1 or any of the listed backups earlier than backup #4. The restore fails if I choose a later backup than the last restored backup (e.g. restored to #1 and then
attempt to restore to #2). See error in log:
2020-11-16 20:58:15.138 GMT  LOG: database system was interrupted; last known up at 2020-11-12 19:07:36 GMT