17 #include "utils/fmgrprotos.h"
21 #define MAXPG_LSNLEN 17
22 #define MAXPG_LSNCOMPONENT 8
37 Assert(have_error != NULL);
41 len1 = strspn(
str,
"0123456789abcdefABCDEF");
47 len2 = strspn(
str + len1 + 1,
"0123456789abcdefABCDEF");
56 off = (
uint32) strtoul(
str + len1 + 1, NULL, 16);
57 result = ((uint64)
id << 32) | off;
67 bool have_error =
false;
72 (
errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
73 errmsg(
"invalid input syntax for type %s: \"%s\"",
261 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
262 errmsg(
"cannot add NaN to pg_lsn")));
295 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
296 errmsg(
"cannot subtract NaN from pg_lsn")));
Datum numeric_sub(PG_FUNCTION_ARGS)
Datum numeric_in(PG_FUNCTION_ARGS)
bool numeric_is_nan(Numeric num)
Datum numeric_add(PG_FUNCTION_ARGS)
Datum numeric_pg_lsn(PG_FUNCTION_ARGS)
#define Assert(condition)
static void PGresult * res
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereturn(context, dummy_value,...)
#define ereport(elevel,...)
#define PG_RETURN_BYTEA_P(x)
#define DirectFunctionCall2(func, arg1, arg2)
#define PG_GETARG_POINTER(n)
#define PG_RETURN_CSTRING(x)
#define DirectFunctionCall1(func, arg1)
#define PG_GETARG_CSTRING(n)
#define PG_RETURN_INT32(x)
#define DirectFunctionCall3(func, arg1, arg2, arg3)
#define PG_RETURN_BOOL(x)
Datum hashint8extended(PG_FUNCTION_ARGS)
Datum hashint8(PG_FUNCTION_ARGS)
char * pstrdup(const char *in)
#define PG_GETARG_NUMERIC(n)
static Datum NumericGetDatum(Numeric X)
Datum pg_lsn_ne(PG_FUNCTION_ARGS)
Datum pg_lsn_eq(PG_FUNCTION_ARGS)
Datum pg_lsn_cmp(PG_FUNCTION_ARGS)
Datum pg_lsn_out(PG_FUNCTION_ARGS)
Datum pg_lsn_smaller(PG_FUNCTION_ARGS)
Datum pg_lsn_send(PG_FUNCTION_ARGS)
XLogRecPtr pg_lsn_in_internal(const char *str, bool *have_error)
#define MAXPG_LSNCOMPONENT
Datum pg_lsn_le(PG_FUNCTION_ARGS)
Datum pg_lsn_in(PG_FUNCTION_ARGS)
Datum pg_lsn_pli(PG_FUNCTION_ARGS)
Datum pg_lsn_mii(PG_FUNCTION_ARGS)
Datum pg_lsn_hash(PG_FUNCTION_ARGS)
Datum pg_lsn_ge(PG_FUNCTION_ARGS)
Datum pg_lsn_hash_extended(PG_FUNCTION_ARGS)
Datum pg_lsn_gt(PG_FUNCTION_ARGS)
Datum pg_lsn_larger(PG_FUNCTION_ARGS)
Datum pg_lsn_recv(PG_FUNCTION_ARGS)
Datum pg_lsn_mi(PG_FUNCTION_ARGS)
Datum pg_lsn_lt(PG_FUNCTION_ARGS)
static Datum ObjectIdGetDatum(Oid X)
static Datum CStringGetDatum(const char *X)
static Datum Int32GetDatum(int32 X)
StringInfoData * StringInfo
#define LSN_FORMAT_ARGS(lsn)
#define InvalidXLogRecPtr