summaryrefslogtreecommitdiff
path: root/src/include/postgres.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/postgres.h')
-rw-r--r--src/include/postgres.h58
1 files changed, 4 insertions, 54 deletions
diff --git a/src/include/postgres.h b/src/include/postgres.h
index e81829bfa6f..357cbd6fd96 100644
--- a/src/include/postgres.h
+++ b/src/include/postgres.h
@@ -388,68 +388,41 @@ NameGetDatum(const NameData *X)
/*
* DatumGetInt64
* Returns 64-bit integer value of a datum.
- *
- * Note: this function hides whether int64 is pass by value or by reference.
*/
static inline int64
DatumGetInt64(Datum X)
{
-#ifdef USE_FLOAT8_BYVAL
return (int64) X;
-#else
- return *((int64 *) DatumGetPointer(X));
-#endif
}
/*
* Int64GetDatum
* Returns datum representation for a 64-bit integer.
- *
- * Note: if int64 is pass by reference, this function returns a reference
- * to palloc'd space.
*/
-#ifdef USE_FLOAT8_BYVAL
static inline Datum
Int64GetDatum(int64 X)
{
return (Datum) X;
}
-#else
-extern Datum Int64GetDatum(int64 X);
-#endif
-
/*
* DatumGetUInt64
* Returns 64-bit unsigned integer value of a datum.
- *
- * Note: this function hides whether int64 is pass by value or by reference.
*/
static inline uint64
DatumGetUInt64(Datum X)
{
-#ifdef USE_FLOAT8_BYVAL
return (uint64) X;
-#else
- return *((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.
*/
static inline Datum
UInt64GetDatum(uint64 X)
{
-#ifdef USE_FLOAT8_BYVAL
return (Datum) X;
-#else
- return Int64GetDatum((int64) X);
-#endif
}
/*
@@ -497,13 +470,10 @@ Float4GetDatum(float4 X)
/*
* DatumGetFloat8
* Returns 8-byte floating point value of a datum.
- *
- * Note: this function hides whether float8 is pass by value or by reference.
*/
static inline float8
DatumGetFloat8(Datum X)
{
-#ifdef USE_FLOAT8_BYVAL
union
{
int64 value;
@@ -512,19 +482,12 @@ DatumGetFloat8(Datum X)
myunion.value = DatumGetInt64(X);
return myunion.retval;
-#else
- return *((float8 *) DatumGetPointer(X));
-#endif
}
/*
* Float8GetDatum
* Returns datum representation for an 8-byte floating point number.
- *
- * Note: if float8 is pass by reference, this function returns a reference
- * to palloc'd space.
*/
-#ifdef USE_FLOAT8_BYVAL
static inline Datum
Float8GetDatum(float8 X)
{
@@ -537,35 +500,22 @@ Float8GetDatum(float8 X)
myunion.value = X;
return Int64GetDatum(myunion.retval);
}
-#else
-extern Datum Float8GetDatum(float8 X);
-#endif
-
/*
* Int64GetDatumFast
* Float8GetDatumFast
*
- * These macros are intended to allow writing code that does not depend on
+ * These macros were intended to allow writing code that does not depend on
* whether int64 and float8 are pass-by-reference types, while not
- * sacrificing performance when they are. The argument must be a variable
- * that will exist and have the same value for as long as the Datum is needed.
- * In the pass-by-ref case, the address of the variable is taken to use as
- * the Datum. In the pass-by-val case, these are the same as the non-Fast
- * functions, except for asserting that the variable is of the correct type.
+ * sacrificing performance when they are. They are no longer different
+ * from the regular functions, though we keep the assertions to protect
+ * code that might get back-patched into older branches.
*/
-#ifdef USE_FLOAT8_BYVAL
#define Int64GetDatumFast(X) \
(AssertVariableIsOfTypeMacro(X, int64), Int64GetDatum(X))
#define Float8GetDatumFast(X) \
(AssertVariableIsOfTypeMacro(X, double), Float8GetDatum(X))
-#else
-#define Int64GetDatumFast(X) \
- (AssertVariableIsOfTypeMacro(X, int64), PointerGetDatum(&(X)))
-#define Float8GetDatumFast(X) \
- (AssertVariableIsOfTypeMacro(X, double), PointerGetDatum(&(X)))
-#endif
/* ----------------------------------------------------------------