*** a/doc/src/sgml/func.sgml
--- b/doc/src/sgml/func.sgml
***************
*** 15884,15918 **** SELECT set_config('log_statement_stats', 'off', false);
         <entry>
          <literal><function>pg_create_restore_point(<parameter>name</> <type>text</>)</function></literal>
          </entry>
!        <entry><type>text</type></entry>
         <entry>Create a named point for performing restore (restricted to superusers)</entry>
        </row>
        <row>
         <entry>
          <literal><function>pg_current_xlog_insert_location()</function></literal>
          </entry>
!        <entry><type>text</type></entry>
         <entry>Get current transaction log insert location</entry>
        </row>
        <row>
         <entry>
          <literal><function>pg_current_xlog_location()</function></literal>
          </entry>
!        <entry><type>text</type></entry>
         <entry>Get current transaction log write location</entry>
        </row>
        <row>
         <entry>
          <literal><function>pg_start_backup(<parameter>label</> <type>text</> <optional>, <parameter>fast</> <type>boolean</> </optional>)</function></literal>
          </entry>
!        <entry><type>text</type></entry>
         <entry>Prepare for performing on-line backup (restricted to superusers or replication roles)</entry>
        </row>
        <row>
         <entry>
          <literal><function>pg_stop_backup()</function></literal>
          </entry>
!        <entry><type>text</type></entry>
         <entry>Finish performing on-line backup (restricted to superusers or replication roles)</entry>
        </row>
        <row>
--- 15884,15918 ----
         <entry>
          <literal><function>pg_create_restore_point(<parameter>name</> <type>text</>)</function></literal>
          </entry>
!        <entry><type>lsn</type></entry>
         <entry>Create a named point for performing restore (restricted to superusers)</entry>
        </row>
        <row>
         <entry>
          <literal><function>pg_current_xlog_insert_location()</function></literal>
          </entry>
!        <entry><type>lsn</type></entry>
         <entry>Get current transaction log insert location</entry>
        </row>
        <row>
         <entry>
          <literal><function>pg_current_xlog_location()</function></literal>
          </entry>
!        <entry><type>lsn</type></entry>
         <entry>Get current transaction log write location</entry>
        </row>
        <row>
         <entry>
          <literal><function>pg_start_backup(<parameter>label</> <type>text</> <optional>, <parameter>fast</> <type>boolean</> </optional>)</function></literal>
          </entry>
!        <entry><type>lsn</type></entry>
         <entry>Prepare for performing on-line backup (restricted to superusers or replication roles)</entry>
        </row>
        <row>
         <entry>
          <literal><function>pg_stop_backup()</function></literal>
          </entry>
!        <entry><type>lsn</type></entry>
         <entry>Finish performing on-line backup (restricted to superusers or replication roles)</entry>
        </row>
        <row>
***************
*** 15933,15958 **** SELECT set_config('log_statement_stats', 'off', false);
         <entry>
          <literal><function>pg_switch_xlog()</function></literal>
          </entry>
!        <entry><type>text</type></entry>
         <entry>Force switch to a new transaction log file (restricted to superusers)</entry>
        </row>
        <row>
         <entry>
!         <literal><function>pg_xlogfile_name(<parameter>location</> <type>text</>)</function></literal>
          </entry>
         <entry><type>text</type></entry>
         <entry>Convert transaction log location string to file name</entry>
        </row>
        <row>
         <entry>
!         <literal><function>pg_xlogfile_name_offset(<parameter>location</> <type>text</>)</function></literal>
          </entry>
         <entry><type>text</>, <type>integer</></entry>
         <entry>Convert transaction log location string to file name and decimal byte offset within file</entry>
        </row>
        <row>
         <entry>
!         <literal><function>pg_xlog_location_diff(<parameter>location</> <type>text</>, <parameter>location</> <type>text</>)</function></literal>
         </entry>
         <entry><type>numeric</></entry>
         <entry>Calculate the difference between two transaction log locations</entry>
--- 15933,15958 ----
         <entry>
          <literal><function>pg_switch_xlog()</function></literal>
          </entry>
!        <entry><type>lsn</type></entry>
         <entry>Force switch to a new transaction log file (restricted to superusers)</entry>
        </row>
        <row>
         <entry>
!         <literal><function>pg_xlogfile_name(<parameter>location</> <type>lsn</>)</function></literal>
          </entry>
         <entry><type>text</type></entry>
         <entry>Convert transaction log location string to file name</entry>
        </row>
        <row>
         <entry>
!         <literal><function>pg_xlogfile_name_offset(<parameter>location</> <type>lsn</>)</function></literal>
          </entry>
         <entry><type>text</>, <type>integer</></entry>
         <entry>Convert transaction log location string to file name and decimal byte offset within file</entry>
        </row>
        <row>
         <entry>
!         <literal><function>pg_xlog_location_diff(<parameter>location</> <type>lsn</>, <parameter>location</> <type>lsn</>)</function></literal>
         </entry>
         <entry><type>numeric</></entry>
         <entry>Calculate the difference between two transaction log locations</entry>
***************
*** 16107,16113 **** postgres=# SELECT * FROM pg_xlogfile_name_offset(pg_stop_backup());
         <entry>
          <literal><function>pg_last_xlog_receive_location()</function></literal>
          </entry>
!        <entry><type>text</type></entry>
         <entry>Get last transaction log location received and synced to disk by
          streaming replication. While streaming replication is in progress
          this will increase monotonically. If recovery has completed this will
--- 16107,16113 ----
         <entry>
          <literal><function>pg_last_xlog_receive_location()</function></literal>
          </entry>
!        <entry><type>lsn</type></entry>
         <entry>Get last transaction log location received and synced to disk by
          streaming replication. While streaming replication is in progress
          this will increase monotonically. If recovery has completed this will
***************
*** 16121,16127 **** postgres=# SELECT * FROM pg_xlogfile_name_offset(pg_stop_backup());
         <entry>
          <literal><function>pg_last_xlog_replay_location()</function></literal>
          </entry>
!        <entry><type>text</type></entry>
         <entry>Get last transaction log location replayed during recovery.
          If recovery is still in progress this will increase monotonically.
          If recovery has completed then this value will remain static at
--- 16121,16127 ----
         <entry>
          <literal><function>pg_last_xlog_replay_location()</function></literal>
          </entry>
!        <entry><type>lsn</type></entry>
         <entry>Get last transaction log location replayed during recovery.
          If recovery is still in progress this will increase monotonically.
          If recovery has completed then this value will remain static at
***************
*** 16335,16341 **** postgres=# SELECT * FROM pg_xlogfile_name_offset(pg_stop_backup());
          <literal><function>pg_create_physical_replication_slot(<parameter>slotname</parameter> <type>text</type>, <parameter>plugin</parameter> <type>text</type>)</function></literal>
         </entry>
         <entry>
!         (<parameter>slotname</parameter> <type>text</type>, <parameter>xlog_position</parameter> <type>text</type>)
         </entry>
         <entry>
          Creates a new physical replication slot named
--- 16335,16341 ----
          <literal><function>pg_create_physical_replication_slot(<parameter>slotname</parameter> <type>text</type>, <parameter>plugin</parameter> <type>text</type>)</function></literal>
         </entry>
         <entry>
!         (<parameter>slotname</parameter> <type>text</type>, <parameter>xlog_position</parameter> <type>lsn</type>)
         </entry>
         <entry>
          Creates a new physical replication slot named
*** a/src/backend/access/transam/xlogfuncs.c
--- b/src/backend/access/transam/xlogfuncs.c
***************
*** 33,40 ****
  #include "utils/timestamp.h"
  #include "storage/fd.h"
  
- static void validate_xlog_location(char *str);
- 
  
  /*
   * pg_start_backup: set up for taking an on-line backup dump
--- 33,38 ----
*** a/src/backend/catalog/system_views.sql
--- b/src/backend/catalog/system_views.sql
***************
*** 810,816 **** COMMENT ON FUNCTION ts_debug(text) IS
  
  CREATE OR REPLACE FUNCTION
    pg_start_backup(label text, fast boolean DEFAULT false)
!   RETURNS text STRICT VOLATILE LANGUAGE internal AS 'pg_start_backup';
  
  CREATE OR REPLACE FUNCTION
    json_populate_record(base anyelement, from_json json, use_json_as_text boolean DEFAULT false)
--- 810,816 ----
  
  CREATE OR REPLACE FUNCTION
    pg_start_backup(label text, fast boolean DEFAULT false)
!   RETURNS lsn STRICT VOLATILE LANGUAGE internal AS 'pg_start_backup';
  
  CREATE OR REPLACE FUNCTION
    json_populate_record(base anyelement, from_json json, use_json_as_text boolean DEFAULT false)
*** a/src/backend/replication/slotfuncs.c
--- b/src/backend/replication/slotfuncs.c
***************
*** 141,148 **** pg_get_replication_slots(PG_FUNCTION_ARGS)
  		bool		active;
  		Oid			database;
  		const char *slot_name;
- 
- 		char		restart_lsn_s[MAXFNAMELEN];
  		int			i;
  
  		SpinLockAcquire(&slot->mutex);
--- 141,146 ----
*** a/src/include/catalog/pg_proc.h
--- b/src/include/catalog/pg_proc.h
***************
*** 2971,2998 **** DATA(insert OID = 2171 ( pg_cancel_backend		PGNSP PGUID 12 1 0 0 0 f f f f t f v
  DESCR("cancel a server process' current query");
  DATA(insert OID = 2096 ( pg_terminate_backend		PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 16 "23" _null_ _null_ _null_ _null_ pg_terminate_backend _null_ _null_ _null_ ));
  DESCR("terminate a server process");
! DATA(insert OID = 2172 ( pg_start_backup		PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 25 "25 16" _null_ _null_ _null_ _null_ pg_start_backup _null_ _null_ _null_ ));
  DESCR("prepare for taking an online backup");
! DATA(insert OID = 2173 ( pg_stop_backup			PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 25 "" _null_ _null_ _null_ _null_ pg_stop_backup _null_ _null_ _null_ ));
  DESCR("finish taking an online backup");
  DATA(insert OID = 3813 ( pg_is_in_backup		PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 16 "" _null_ _null_ _null_ _null_ pg_is_in_backup _null_ _null_ _null_ ));
  DESCR("true if server is in online backup");
  DATA(insert OID = 3814 ( pg_backup_start_time		PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 1184 "" _null_ _null_ _null_ _null_ pg_backup_start_time _null_ _null_ _null_ ));
  DESCR("start time of an online backup");
! DATA(insert OID = 2848 ( pg_switch_xlog			PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 25 "" _null_ _null_ _null_ _null_ pg_switch_xlog _null_ _null_ _null_ ));
  DESCR("switch to new xlog file");
! DATA(insert OID = 3098 ( pg_create_restore_point	PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 25 "25" _null_ _null_ _null_ _null_ pg_create_restore_point _null_ _null_ _null_ ));
  DESCR("create a named restore point");
! DATA(insert OID = 2849 ( pg_current_xlog_location	PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 25 "" _null_ _null_ _null_ _null_ pg_current_xlog_location _null_ _null_ _null_ ));
  DESCR("current xlog write location");
! DATA(insert OID = 2852 ( pg_current_xlog_insert_location	PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 25 "" _null_ _null_ _null_ _null_ pg_current_xlog_insert_location _null_ _null_ _null_ ));
  DESCR("current xlog insert location");
! DATA(insert OID = 2850 ( pg_xlogfile_name_offset	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2249 "25" "{25,25,23}" "{i,o,o}" "{wal_location,file_name,file_offset}" _null_ pg_xlogfile_name_offset _null_ _null_ _null_ ));
  DESCR("xlog filename and byte offset, given an xlog location");
! DATA(insert OID = 2851 ( pg_xlogfile_name			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "25" _null_ _null_ _null_ _null_ pg_xlogfile_name _null_ _null_ _null_ ));
  DESCR("xlog filename, given an xlog location");
  
! DATA(insert OID = 3165 ( pg_xlog_location_diff		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "25 25" _null_ _null_ _null_ _null_ pg_xlog_location_diff _null_ _null_ _null_ ));
  DESCR("difference in bytes, given two xlog locations");
  
  DATA(insert OID = 3809 ( pg_export_snapshot		PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 25 "" _null_ _null_ _null_ _null_ pg_export_snapshot _null_ _null_ _null_ ));
--- 2971,2998 ----
  DESCR("cancel a server process' current query");
  DATA(insert OID = 2096 ( pg_terminate_backend		PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 16 "23" _null_ _null_ _null_ _null_ pg_terminate_backend _null_ _null_ _null_ ));
  DESCR("terminate a server process");
! DATA(insert OID = 2172 ( pg_start_backup		PGNSP PGUID 12 1 0 0 0 f f f f t f v 2 0 3220 "25 16" _null_ _null_ _null_ _null_ pg_start_backup _null_ _null_ _null_ ));
  DESCR("prepare for taking an online backup");
! DATA(insert OID = 2173 ( pg_stop_backup			PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 3220 "" _null_ _null_ _null_ _null_ pg_stop_backup _null_ _null_ _null_ ));
  DESCR("finish taking an online backup");
  DATA(insert OID = 3813 ( pg_is_in_backup		PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 16 "" _null_ _null_ _null_ _null_ pg_is_in_backup _null_ _null_ _null_ ));
  DESCR("true if server is in online backup");
  DATA(insert OID = 3814 ( pg_backup_start_time		PGNSP PGUID 12 1 0 0 0 f f f f t f s 0 0 1184 "" _null_ _null_ _null_ _null_ pg_backup_start_time _null_ _null_ _null_ ));
  DESCR("start time of an online backup");
! DATA(insert OID = 2848 ( pg_switch_xlog			PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 3220 "" _null_ _null_ _null_ _null_ pg_switch_xlog _null_ _null_ _null_ ));
  DESCR("switch to new xlog file");
! DATA(insert OID = 3098 ( pg_create_restore_point	PGNSP PGUID 12 1 0 0 0 f f f f t f v 1 0 3220 "25" _null_ _null_ _null_ _null_ pg_create_restore_point _null_ _null_ _null_ ));
  DESCR("create a named restore point");
! DATA(insert OID = 2849 ( pg_current_xlog_location	PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 3220 "" _null_ _null_ _null_ _null_ pg_current_xlog_location _null_ _null_ _null_ ));
  DESCR("current xlog write location");
! DATA(insert OID = 2852 ( pg_current_xlog_insert_location	PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 3220 "" _null_ _null_ _null_ _null_ pg_current_xlog_insert_location _null_ _null_ _null_ ));
  DESCR("current xlog insert location");
! DATA(insert OID = 2850 ( pg_xlogfile_name_offset	PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 2249 "3220" "{3220,25,23}" "{i,o,o}" "{wal_location,file_name,file_offset}" _null_ pg_xlogfile_name_offset _null_ _null_ _null_ ));
  DESCR("xlog filename and byte offset, given an xlog location");
! DATA(insert OID = 2851 ( pg_xlogfile_name			PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 25 "3220" _null_ _null_ _null_ _null_ pg_xlogfile_name _null_ _null_ _null_ ));
  DESCR("xlog filename, given an xlog location");
  
! DATA(insert OID = 3165 ( pg_xlog_location_diff		PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1700 "3220 3220" _null_ _null_ _null_ _null_ pg_xlog_location_diff _null_ _null_ _null_ ));
  DESCR("difference in bytes, given two xlog locations");
  
  DATA(insert OID = 3809 ( pg_export_snapshot		PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 25 "" _null_ _null_ _null_ _null_ pg_export_snapshot _null_ _null_ _null_ ));
***************
*** 3001,3009 **** DESCR("export a snapshot");
  DATA(insert OID = 3810 (  pg_is_in_recovery		PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 16 "" _null_ _null_ _null_ _null_ pg_is_in_recovery _null_ _null_ _null_ ));
  DESCR("true if server is in recovery");
  
! DATA(insert OID = 3820 ( pg_last_xlog_receive_location	PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 25 "" _null_ _null_ _null_ _null_ pg_last_xlog_receive_location _null_ _null_ _null_ ));
  DESCR("current xlog flush location");
! DATA(insert OID = 3821 ( pg_last_xlog_replay_location	PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 25 "" _null_ _null_ _null_ _null_ pg_last_xlog_replay_location _null_ _null_ _null_ ));
  DESCR("last xlog replay location");
  DATA(insert OID = 3830 ( pg_last_xact_replay_timestamp	PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 1184 "" _null_ _null_ _null_ _null_ pg_last_xact_replay_timestamp _null_ _null_ _null_ ));
  DESCR("timestamp of last replay xact");
--- 3001,3009 ----
  DATA(insert OID = 3810 (  pg_is_in_recovery		PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 16 "" _null_ _null_ _null_ _null_ pg_is_in_recovery _null_ _null_ _null_ ));
  DESCR("true if server is in recovery");
  
! DATA(insert OID = 3820 ( pg_last_xlog_receive_location	PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 3220 "" _null_ _null_ _null_ _null_ pg_last_xlog_receive_location _null_ _null_ _null_ ));
  DESCR("current xlog flush location");
! DATA(insert OID = 3821 ( pg_last_xlog_replay_location	PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 3220 "" _null_ _null_ _null_ _null_ pg_last_xlog_replay_location _null_ _null_ _null_ ));
  DESCR("last xlog replay location");
  DATA(insert OID = 3830 ( pg_last_xact_replay_timestamp	PGNSP PGUID 12 1 0 0 0 f f f f t f v 0 0 1184 "" _null_ _null_ _null_ _null_ pg_last_xact_replay_timestamp _null_ _null_ _null_ ));
  DESCR("timestamp of last replay xact");
***************
*** 4800,4810 **** DATA(insert OID = 3473 (  spg_range_quad_leaf_consistent	PGNSP PGUID 12 1 0 0 0
  DESCR("SP-GiST support for quad tree over range");
  
  /* replication slots */
! DATA(insert OID = 3779 (  pg_create_physical_replication_slot PGNSP PGUID 12 1 0 0 0 f f f f f f v 1 0 2249 "19" "{19,25,25}" "{i,o,o}" "{slotname,slotname,xlog_position}" _null_ pg_create_physical_replication_slot _null_ _null_ _null_ ));
  DESCR("create a physical replication slot");
  DATA(insert OID = 3780 (  pg_drop_replication_slot PGNSP PGUID 12 1 0 0 0 f f f f f f v 1 0 2278 "19" _null_ _null_ _null_ _null_ pg_drop_replication_slot _null_ _null_ _null_ ));
  DESCR("drop a replication slot");
! DATA(insert OID = 3781 (  pg_get_replication_slots	PGNSP PGUID 12 1 10 0 0 f f f f f t s 0 0 2249 "" "{25,25,26,16,28,25}" "{o,o,o,o,o,o}" "{slot_name,slot_type,datoid,active,xmin,restart_lsn}" _null_ pg_get_replication_slots _null_ _null_ _null_ ));
  DESCR("information about replication slots currently in use");
  
  /* event triggers */
--- 4800,4810 ----
  DESCR("SP-GiST support for quad tree over range");
  
  /* replication slots */
! DATA(insert OID = 3779 (  pg_create_physical_replication_slot PGNSP PGUID 12 1 0 0 0 f f f f f f v 1 0 2249 "19" "{19,25,3220}" "{i,o,o}" "{slotname,slotname,xlog_position}" _null_ pg_create_physical_replication_slot _null_ _null_ _null_ ));
  DESCR("create a physical replication slot");
  DATA(insert OID = 3780 (  pg_drop_replication_slot PGNSP PGUID 12 1 0 0 0 f f f f f f v 1 0 2278 "19" _null_ _null_ _null_ _null_ pg_drop_replication_slot _null_ _null_ _null_ ));
  DESCR("drop a replication slot");
! DATA(insert OID = 3781 (  pg_get_replication_slots	PGNSP PGUID 12 1 10 0 0 f f f f f t s 0 0 2249 "" "{25,25,26,16,28,3220}" "{o,o,o,o,o,o}" "{slot_name,slot_type,datoid,active,xmin,restart_lsn}" _null_ pg_get_replication_slots _null_ _null_ _null_ ));
  DESCR("information about replication slots currently in use");
  
  /* event triggers */
