Hi all,

Attached is a patch which checks early on in pg_start_back() that
archive_command is defined and if not generates an error. This seemed like
a reason foot gun prevention measure.

Gavin
# Old manifest: 2910f7d05f74e086c097595fe8cc78ad728474e4
# New manifest: 1b0c1a705781c50c81f1e0a3e6c5e89bd846c344
# Summary of changes:
# 
#   patch src/backend/access/transam/xlog.c
#    from 44af82f3c379aad3d842fc2b903d0211ecdd1e30
#      to 08dcb5592d1c8a9501dd6e8845c32b96710b987c
# 
--- src/backend/access/transam/xlog.c
+++ src/backend/access/transam/xlog.c
@@ -5266,6 +5266,14 @@
                ereport(ERROR,
                                (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
                                 (errmsg("must be superuser to run a 
backup"))));
+
+       if (!XLogArchivingActive())
+               ereport(ERROR,
+                               
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+                                (errmsg("wal archiving is not configured"),
+                                (errhint("archive_command must be defined 
before using "
+                                       "online backups can be made 
safely")))));
+
        backupidstr = DatumGetCString(DirectFunctionCall1(textout,
                                                                                
         PointerGetDatum(backupid)));
 
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Reply via email to