*** a/doc/src/sgml/func.sgml
--- b/doc/src/sgml/func.sgml
***************
*** 13286,13292 **** postgres=# SELECT * FROM pg_xlogfile_name_offset(pg_stop_backup());
          then this value will remain static at the value of the last WAL record
          received and synced to disk during that recovery. When the server has
          been started without a streaming recovery then the return value will be
!         InvalidXLogRecPtr (0/0).
         </entry>
        </row>
        <row>
--- 13286,13292 ----
          then this value will remain static at the value of the last WAL record
          received and synced to disk during that recovery. When the server has
          been started without a streaming recovery then the return value will be
!         <literal>NULL</>.
         </entry>
        </row>
        <row>
***************
*** 13299,13305 **** postgres=# SELECT * FROM pg_xlogfile_name_offset(pg_stop_backup());
          If recovery has completed then this value will remain static at
          the value of the last WAL record applied during that recovery.
          When the server has been started normally without a recovery
!         then the return value will be InvalidXLogRecPtr (0/0).
         </entry>
        </row>
       </tbody>
--- 13299,13305 ----
          If recovery has completed then this value will remain static at
          the value of the last WAL record applied during that recovery.
          When the server has been started normally without a recovery
!         then the return value will be <literal>NULL</>.
         </entry>
        </row>
       </tbody>
*** a/src/backend/access/transam/xlog.c
--- b/src/backend/access/transam/xlog.c
***************
*** 8753,8765 **** Datum
  pg_last_xlog_receive_location(PG_FUNCTION_ARGS)
  {
  	XLogRecPtr	recptr;
- 	char		location[MAXFNAMELEN];
  
  	recptr = GetWalRcvWriteRecPtr();
  
! 	snprintf(location, sizeof(location), "%X/%X",
! 			 recptr.xlogid, recptr.xrecoff);
! 	PG_RETURN_TEXT_P(cstring_to_text(location));
  }
  
  /*
--- 8753,8771 ----
  pg_last_xlog_receive_location(PG_FUNCTION_ARGS)
  {
  	XLogRecPtr	recptr;
  
  	recptr = GetWalRcvWriteRecPtr();
  
! 	if (recptr.xlogid == 0 && recptr.xrecoff == 0)
! 		PG_RETURN_NULL();
! 	else
! 	{
! 		char		location[MAXFNAMELEN];
! 
! 		snprintf(location, sizeof(location), "%X/%X",
! 				 recptr.xlogid, recptr.xrecoff);
! 		PG_RETURN_TEXT_P(cstring_to_text(location));
! 	}
  }
  
  /*
***************
*** 8774,8788 **** pg_last_xlog_replay_location(PG_FUNCTION_ARGS)
  	/* use volatile pointer to prevent code rearrangement */
  	volatile XLogCtlData *xlogctl = XLogCtl;
  	XLogRecPtr	recptr;
- 	char		location[MAXFNAMELEN];
  
  	SpinLockAcquire(&xlogctl->info_lck);
  	recptr = xlogctl->recoveryLastRecPtr;
  	SpinLockRelease(&xlogctl->info_lck);
  
! 	snprintf(location, sizeof(location), "%X/%X",
! 			 recptr.xlogid, recptr.xrecoff);
! 	PG_RETURN_TEXT_P(cstring_to_text(location));
  }
  
  /*
--- 8780,8800 ----
  	/* use volatile pointer to prevent code rearrangement */
  	volatile XLogCtlData *xlogctl = XLogCtl;
  	XLogRecPtr	recptr;
  
  	SpinLockAcquire(&xlogctl->info_lck);
  	recptr = xlogctl->recoveryLastRecPtr;
  	SpinLockRelease(&xlogctl->info_lck);
  
! 	if (recptr.xlogid == 0 && recptr.xrecoff == 0)
! 		PG_RETURN_NULL();
! 	else
! 	{
! 		char		location[MAXFNAMELEN];
! 
! 		snprintf(location, sizeof(location), "%X/%X",
! 				 recptr.xlogid, recptr.xrecoff);
! 		PG_RETURN_TEXT_P(cstring_to_text(location));
! 	}
  }
  
  /*
