From e3eee4304c7ef98b9f1429daceb1b3961db8cd13 Mon Sep 17 00:00:00 2001 From: Neil Conway Date: Wed, 17 Nov 2004 02:22:54 +0000 Subject: [PATCH] Don't allow pg_start_backup() to be invoked if archive_command has not been defined. Patch from Gavin Sherry, editorializing by Neil Conway. --- src/backend/access/transam/xlog.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index ca0a4eafc2..683ded7f7c 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -5266,6 +5266,14 @@ pg_start_backup(PG_FUNCTION_ARGS) 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 " + "online backups can be safely made."))))); + backupidstr = DatumGetCString(DirectFunctionCall1(textout, PointerGetDatum(backupid))); -- 2.39.5