*** a/doc/src/sgml/func.sgml
--- b/doc/src/sgml/func.sgml
***************
*** 13064,13071 **** SELECT set_config('log_statement_stats', 'off', false);
     <para>
      The functions shown in <xref
      linkend="functions-admin-backup-table"> assist in making on-line backups.
!     Use of the first three functions is restricted to superusers. The first
!     five functions cannot be executed during recovery.
     </para>
  
     <table id="functions-admin-backup-table">
--- 13064,13071 ----
     <para>
      The functions shown in <xref
      linkend="functions-admin-backup-table"> assist in making on-line backups.
!     These functions cannot be executed during recovery.
!     Use of the first three functions is restricted to superusers.
     </para>
  
     <table id="functions-admin-backup-table">
*** a/src/backend/access/transam/xlog.c
--- b/src/backend/access/transam/xlog.c
***************
*** 8409,8414 **** pg_xlogfile_name_offset(PG_FUNCTION_ARGS)
--- 8409,8420 ----
  	HeapTuple	resultHeapTuple;
  	Datum		result;
  
+ 	if (RecoveryInProgress())
+ 		ereport(ERROR,
+ 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+ 				 errmsg("recovery is in progress"),
+ 				 errhint("WAL control functions cannot be executed during recovery.")));
+ 
  	/*
  	 * Read input and parse
  	 */
***************
*** 8478,8483 **** pg_xlogfile_name(PG_FUNCTION_ARGS)
--- 8484,8495 ----
  	XLogRecPtr	locationpoint;
  	char		xlogfilename[MAXFNAMELEN];
  
+ 	if (RecoveryInProgress())
+ 		ereport(ERROR,
+ 				(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
+ 				 errmsg("recovery is in progress"),
+ 				 errhint("WAL control functions cannot be executed during recovery.")));
+ 
  	locationstr = text_to_cstring(location);
  
  	if (sscanf(locationstr, "%X/%X", &uxlogid, &uxrecoff) != 2)
