Files
repmgr/sql_utils/repmgr_wrapper_funcs.c
postgres d728ef0eef Fix some typos and replace the variable Inrecovery with
the function RecoveryInProgress() in the function
sql_utils/repmgr_wrapper_funcs.c:last_xlog_replay_timestamp()
2010-09-14 03:05:28 -05:00

32 lines
536 B
C

/*
* repmgr_wrapper_funcs.c
* Copyright (c) 2ndQuadrant, 2010
*
* Expose some backend functions in SQL
*/
#include "postgres.h"
#include "fmgr.h"
#include "access/xlog.h"
PG_MODULE_MAGIC;
Datum last_xlog_replay_timestamp(PG_FUNCTION_ARGS);
PG_FUNCTION_INFO_V1(last_xlog_replay_timestamp);
Datum
last_xlog_replay_timestamp(PG_FUNCTION_ARGS)
{
TimestampTz rTime;
bool fromStream;
if (!RecoveryInProgress())
PG_RETURN_NULL();
else
{
GetXLogReceiptTime(&rTime, &fromStream);
PG_RETURN_TIMESTAMPTZ(rTime);
}
}