pg_lsn.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*-------------------------------------------------------------------------
  2. *
  3. * pg_lsn.h
  4. * Declarations for operations on log sequence numbers (LSNs) of
  5. * PostgreSQL.
  6. *
  7. *
  8. * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
  9. * Portions Copyright (c) 1994, Regents of the University of California
  10. *
  11. * src/include/utils/pg_lsn.h
  12. *
  13. *-------------------------------------------------------------------------
  14. */
  15. #ifndef PG_LSN_H
  16. #define PG_LSN_H
  17. #include "fmgr.h"
  18. #include "access/xlogdefs.h"
  19. extern Datum pg_lsn_in(PG_FUNCTION_ARGS);
  20. extern Datum pg_lsn_out(PG_FUNCTION_ARGS);
  21. extern Datum pg_lsn_recv(PG_FUNCTION_ARGS);
  22. extern Datum pg_lsn_send(PG_FUNCTION_ARGS);
  23. extern Datum pg_lsn_eq(PG_FUNCTION_ARGS);
  24. extern Datum pg_lsn_ne(PG_FUNCTION_ARGS);
  25. extern Datum pg_lsn_lt(PG_FUNCTION_ARGS);
  26. extern Datum pg_lsn_gt(PG_FUNCTION_ARGS);
  27. extern Datum pg_lsn_le(PG_FUNCTION_ARGS);
  28. extern Datum pg_lsn_ge(PG_FUNCTION_ARGS);
  29. extern Datum pg_lsn_cmp(PG_FUNCTION_ARGS);
  30. extern Datum pg_lsn_hash(PG_FUNCTION_ARGS);
  31. extern Datum pg_lsn_mi(PG_FUNCTION_ARGS);
  32. #define DatumGetLSN(X) ((XLogRecPtr) DatumGetInt64(X))
  33. #define LSNGetDatum(X) (Int64GetDatum((int64) (X)))
  34. #define PG_GETARG_LSN(n) DatumGetLSN(PG_GETARG_DATUM(n))
  35. #define PG_RETURN_LSN(x) return LSNGetDatum(x)
  36. #endif /* PG_LSN_H */