aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xlog.c
diff options
context:
space:
mode:
authorNeil Conway <neilc@samurai.com>2004-11-17 02:22:54 +0000
committerNeil Conway <neilc@samurai.com>2004-11-17 02:22:54 +0000
commitb25d23e1e60429f960d4e0ca951d87c1ffe737cb (patch)
tree44a341f39eb5a14434634d22a0c1d9c70b6f8f58 /src/backend/access/transam/xlog.c
parent0021ae06be3a74978976ca970bd01941dde70291 (diff)
downloadpostgresql-b25d23e1e60429f960d4e0ca951d87c1ffe737cb.tar.gz
postgresql-b25d23e1e60429f960d4e0ca951d87c1ffe737cb.zip
Don't allow pg_start_backup() to be invoked if archive_command has not
been defined. Patch from Gavin Sherry, editorializing by Neil Conway.
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r--src/backend/access/transam/xlog.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 0224877e60e..6b128682b6b 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.176 2004/11/05 17:10:56 petere Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.177 2004/11/17 02:22:54 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@@ -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)));