diff options
author | Pavan Deolasee | 2016-10-27 15:02:55 +0000 |
---|---|---|
committer | Pavan Deolasee | 2016-10-27 15:02:55 +0000 |
commit | c52792488cd87e67e62ec61f5b56f461900353b4 (patch) | |
tree | 02b4a719f979659de8f73fce6c1ca65cef2e323f /src/include/postgres.h | |
parent | 891e6be57e5580b54a9df9fd42cb9bd10d0e7b21 (diff) | |
parent | b5bce6c1ec6061c8a4f730d927e162db7e2ce365 (diff) |
Merge commit 'b5bce6c1ec6061c8a4f730d927e162db7e2ce365'
Diffstat (limited to 'src/include/postgres.h')
-rw-r--r-- | src/include/postgres.h | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/src/include/postgres.h b/src/include/postgres.h index 142d781344..3b93f7b3bb 100644 --- a/src/include/postgres.h +++ b/src/include/postgres.h @@ -7,7 +7,7 @@ * Client-side code should include postgres_fe.h instead. * * - * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group + * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group * Portions Copyright (c) 1995, Regents of the University of California * Portions Copyright (c) 2010-2012 Postgres-XC Development Group * @@ -408,7 +408,7 @@ typedef Datum *DatumPtr; * the left of the width of bool, per comment above. */ -#define DatumGetBool(X) ((bool) (((bool) (X)) != 0)) +#define DatumGetBool(X) ((bool) (GET_1_BYTE(X) != 0)) /* * BoolGetDatum @@ -640,6 +640,33 @@ extern Datum Int64GetDatum(int64 X); #endif /* + * DatumGetUInt64 + * Returns 64-bit unsigned integer value of a datum. + * + * Note: this macro hides whether int64 is pass by value or by reference. + */ + +#ifdef USE_FLOAT8_BYVAL +#define DatumGetUInt64(X) ((uint64) GET_8_BYTES(X)) +#else +#define DatumGetUInt64(X) (* ((uint64 *) DatumGetPointer(X))) +#endif + +/* + * UInt64GetDatum + * Returns datum representation for a 64-bit unsigned integer. + * + * Note: if int64 is pass by reference, this function returns a reference + * to palloc'd space. + */ + +#ifdef USE_FLOAT8_BYVAL +#define UInt64GetDatum(X) ((Datum) SET_8_BYTES(X)) +#else +#define UInt64GetDatum(X) Int64GetDatum((int64) (X)) +#endif + +/* * DatumGetFloat4 * Returns 4-byte floating point value of a datum. * |