aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xlog.c
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2010-04-07 06:12:52 +0000
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2010-04-07 06:12:52 +0000
commit370f770c15a4c08094298685887d8a512267c369 (patch)
tree34adb5188a1bd16c4f6e7937a78db9604bc783f2 /src/backend/access/transam/xlog.c
parent9c40543c02f2acb4e7ffd6ad732fccc0f725ef80 (diff)
downloadpostgresql-370f770c15a4c08094298685887d8a512267c369.tar.gz
postgresql-370f770c15a4c08094298685887d8a512267c369.zip
Forbid using pg_xlogfile_name() and pg_xlogfile_name_offset() during
recovery. We might want to relax this in the future, but ThisTimeLineID isn't currently correct in backends during recovery, so the filename returned was wrong.
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r--src/backend/access/transam/xlog.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index ce6d561d5be..592419d3567 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.389 2010/04/06 17:51:58 sriggs Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.390 2010/04/07 06:12:52 heikki Exp $
*
*-------------------------------------------------------------------------
*/
@@ -8410,6 +8410,12 @@ pg_xlogfile_name_offset(PG_FUNCTION_ARGS)
HeapTuple resultHeapTuple;
Datum result;
+ if (RecoveryInProgress())
+ ereport(ERROR,
+ (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+ errmsg("recovery is in progress"),
+ errhint("pg_xlogfile_name_offset() cannot be executed during recovery.")));
+
/*
* Read input and parse
*/
@@ -8479,6 +8485,12 @@ pg_xlogfile_name(PG_FUNCTION_ARGS)
XLogRecPtr locationpoint;
char xlogfilename[MAXFNAMELEN];
+ if (RecoveryInProgress())
+ ereport(ERROR,
+ (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+ errmsg("recovery is in progress"),
+ errhint("pg_xlogfile_name() cannot be executed during recovery.")));
+
locationstr = text_to_cstring(location);
if (sscanf(locationstr, "%X/%X", &uxlogid, &uxrecoff) != 2)