1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-21 05:21:08 +03:00

Further code review for pg_lsn data type.

Change input function error messages to be more consistent with what is
done elsewhere.  Remove a bunch of redundant type casts, so that the
compiler will warn us if we screw up.  Don't pass LSNs by value on
platforms where a Datum is only 32 bytes, per buildfarm.  Move macros
for packing and unpacking LSNs to pg_lsn.h so that we can include
access/xlogdefs.h, to avoid an unsatisfied dependency on XLogRecPtr.
This commit is contained in:
Robert Haas
2014-02-19 10:06:59 -05:00
parent 844a28a9dd
commit 694e3d139a
6 changed files with 32 additions and 41 deletions

View File

@@ -16,6 +16,7 @@
#define PG_LSN_H
#include "fmgr.h"
#include "access/xlogdefs.h"
extern Datum pg_lsn_in(PG_FUNCTION_ARGS);
extern Datum pg_lsn_out(PG_FUNCTION_ARGS);
@@ -31,4 +32,10 @@ extern Datum pg_lsn_ge(PG_FUNCTION_ARGS);
extern Datum pg_lsn_mi(PG_FUNCTION_ARGS);
#define DatumGetLSN(X) ((XLogRecPtr) DatumGetInt64(X))
#define LSNGetDatum(X) (Int64GetDatum((int64) (X)))
#define PG_GETARG_LSN(n) DatumGetLSN(PG_GETARG_DATUM(n))
#define PG_RETURN_LSN(x) return LSNGetDatum(x)
#endif /* PG_LSN_H */