summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/c.h8
-rw-r--r--src/include/catalog/pg_type.dat16
-rw-r--r--src/include/fmgr.h2
-rw-r--r--src/include/postgres.h58
4 files changed, 17 insertions, 67 deletions
diff --git a/src/include/c.h b/src/include/c.h
index bbdaa88c63a..39022f8a9dd 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -609,11 +609,11 @@ typedef signed int Offset;
typedef float float4;
typedef double float8;
-#ifdef USE_FLOAT8_BYVAL
+/*
+ * float8, int8, and related datatypes are now always pass-by-value.
+ * We keep this symbol to avoid breaking extension code that may use it.
+ */
#define FLOAT8PASSBYVAL true
-#else
-#define FLOAT8PASSBYVAL false
-#endif
/*
* Oid, RegProcedure, TransactionId, SubTransactionId, MultiXactId,
diff --git a/src/include/catalog/pg_type.dat b/src/include/catalog/pg_type.dat
index 29e4ffffc98..cb730aeac86 100644
--- a/src/include/catalog/pg_type.dat
+++ b/src/include/catalog/pg_type.dat
@@ -54,7 +54,7 @@
typcollation => 'C' },
{ oid => '20', array_type_oid => '1016',
descr => '~18 digit integer, 8-byte storage',
- typname => 'int8', typlen => '8', typbyval => 'FLOAT8PASSBYVAL',
+ typname => 'int8', typlen => '8', typbyval => 't',
typcategory => 'N', typinput => 'int8in', typoutput => 'int8out',
typreceive => 'int8recv', typsend => 'int8send', typalign => 'd' },
{ oid => '21', array_type_oid => '1005',
@@ -172,7 +172,7 @@
typoutput => 'pg_ddl_command_out', typreceive => 'pg_ddl_command_recv',
typsend => 'pg_ddl_command_send', typalign => 'ALIGNOF_POINTER' },
{ oid => '5069', array_type_oid => '271', descr => 'full transaction id',
- typname => 'xid8', typlen => '8', typbyval => 'FLOAT8PASSBYVAL',
+ typname => 'xid8', typlen => '8', typbyval => 't',
typcategory => 'U', typinput => 'xid8in', typoutput => 'xid8out',
typreceive => 'xid8recv', typsend => 'xid8send', typalign => 'd' },
@@ -222,7 +222,7 @@
typsend => 'float4send', typalign => 'i' },
{ oid => '701', array_type_oid => '1022',
descr => 'double-precision floating point number, 8-byte storage',
- typname => 'float8', typlen => '8', typbyval => 'FLOAT8PASSBYVAL',
+ typname => 'float8', typlen => '8', typbyval => 't',
typcategory => 'N', typispreferred => 't', typinput => 'float8in',
typoutput => 'float8out', typreceive => 'float8recv', typsend => 'float8send',
typalign => 'd' },
@@ -237,7 +237,7 @@
typreceive => 'circle_recv', typsend => 'circle_send', typalign => 'd' },
{ oid => '790', array_type_oid => '791',
descr => 'monetary amounts, $d,ddd.cc',
- typname => 'money', typlen => '8', typbyval => 'FLOAT8PASSBYVAL',
+ typname => 'money', typlen => '8', typbyval => 't',
typcategory => 'N', typinput => 'cash_in', typoutput => 'cash_out',
typreceive => 'cash_recv', typsend => 'cash_send', typalign => 'd' },
@@ -290,7 +290,7 @@
typinput => 'date_in', typoutput => 'date_out', typreceive => 'date_recv',
typsend => 'date_send', typalign => 'i' },
{ oid => '1083', array_type_oid => '1183', descr => 'time of day',
- typname => 'time', typlen => '8', typbyval => 'FLOAT8PASSBYVAL',
+ typname => 'time', typlen => '8', typbyval => 't',
typcategory => 'D', typinput => 'time_in', typoutput => 'time_out',
typreceive => 'time_recv', typsend => 'time_send', typmodin => 'timetypmodin',
typmodout => 'timetypmodout', typalign => 'd' },
@@ -298,14 +298,14 @@
# OIDS 1100 - 1199
{ oid => '1114', array_type_oid => '1115', descr => 'date and time',
- typname => 'timestamp', typlen => '8', typbyval => 'FLOAT8PASSBYVAL',
+ typname => 'timestamp', typlen => '8', typbyval => 't',
typcategory => 'D', typinput => 'timestamp_in', typoutput => 'timestamp_out',
typreceive => 'timestamp_recv', typsend => 'timestamp_send',
typmodin => 'timestamptypmodin', typmodout => 'timestamptypmodout',
typalign => 'd' },
{ oid => '1184', array_type_oid => '1185',
descr => 'date and time with time zone',
- typname => 'timestamptz', typlen => '8', typbyval => 'FLOAT8PASSBYVAL',
+ typname => 'timestamptz', typlen => '8', typbyval => 't',
typcategory => 'D', typispreferred => 't', typinput => 'timestamptz_in',
typoutput => 'timestamptz_out', typreceive => 'timestamptz_recv',
typsend => 'timestamptz_send', typmodin => 'timestamptztypmodin',
@@ -413,7 +413,7 @@
# pg_lsn
{ oid => '3220', array_type_oid => '3221', descr => 'PostgreSQL LSN',
- typname => 'pg_lsn', typlen => '8', typbyval => 'FLOAT8PASSBYVAL',
+ typname => 'pg_lsn', typlen => '8', typbyval => 't',
typcategory => 'U', typinput => 'pg_lsn_in', typoutput => 'pg_lsn_out',
typreceive => 'pg_lsn_recv', typsend => 'pg_lsn_send', typalign => 'd' },
diff --git a/src/include/fmgr.h b/src/include/fmgr.h
index 0fe7b4ebc77..c7236e42972 100644
--- a/src/include/fmgr.h
+++ b/src/include/fmgr.h
@@ -469,7 +469,7 @@ typedef struct
int funcmaxargs; /* FUNC_MAX_ARGS */
int indexmaxkeys; /* INDEX_MAX_KEYS */
int namedatalen; /* NAMEDATALEN */
- int float8byval; /* FLOAT8PASSBYVAL */
+ int float8byval; /* FLOAT8PASSBYVAL (now vestigial) */
char abi_extra[32]; /* see pg_config_manual.h */
} Pg_abi_values;
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
/* ----------------------------------------------------------------