aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xlogfuncs.c
diff options
context:
space:
mode:
authorSimon Riggs <simon@2ndQuadrant.com>2016-01-12 07:54:52 +0000
committerSimon Riggs <simon@2ndQuadrant.com>2016-01-12 07:54:52 +0000
commite63bb4549a2f47b86de9fc21c9f8b00440f34f99 (patch)
tree79c4138b111ad43caf0a4c7a77d1261b63e49b05 /src/backend/access/transam/xlogfuncs.c
parent1e29e6324ca7d52eb751c8d63881d1f7c44e3921 (diff)
downloadpostgresql-e63bb4549a2f47b86de9fc21c9f8b00440f34f99.tar.gz
postgresql-e63bb4549a2f47b86de9fc21c9f8b00440f34f99.zip
Add new user fn pg_current_xlog_flush_location()
Tomas Vondra, reviewed by Michael Paquier and Amit Kapila Minor edits by me
Diffstat (limited to 'src/backend/access/transam/xlogfuncs.c')
-rw-r--r--src/backend/access/transam/xlogfuncs.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/backend/access/transam/xlogfuncs.c b/src/backend/access/transam/xlogfuncs.c
index 42168985e0c..31cbb01ce47 100644
--- a/src/backend/access/transam/xlogfuncs.c
+++ b/src/backend/access/transam/xlogfuncs.c
@@ -216,6 +216,27 @@ pg_current_xlog_insert_location(PG_FUNCTION_ARGS)
}
/*
+ * 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)
*
* This is useful for determining how much of WAL is guaranteed to be received