1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-16 06:01:02 +03:00

Add new user fn pg_current_xlog_flush_location()

Tomas Vondra, reviewed by Michael Paquier and Amit Kapila
Minor edits by me
This commit is contained in:
Simon Riggs
2016-01-12 07:54:52 +00:00
parent 1e29e6324c
commit e63bb4549a
4 changed files with 41 additions and 6 deletions

View File

@ -215,6 +215,27 @@ pg_current_xlog_insert_location(PG_FUNCTION_ARGS)
PG_RETURN_LSN(current_recptr);
}
/*
* Report the current WAL flush location (same format as pg_start_backup etc)
*
* This function is mostly for debugging purposes.
*/
Datum
pg_current_xlog_flush_location(PG_FUNCTION_ARGS)
{
XLogRecPtr current_recptr;
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.")));
current_recptr = GetFlushRecPtr();
PG_RETURN_LSN(current_recptr);
}
/*
* Report the last WAL receive location (same format as pg_start_backup etc)
*