summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/access/gin_tuple.h4
-rw-r--r--src/include/access/spgist_private.h14
-rw-r--r--src/include/access/tupmacs.h15
-rw-r--r--src/include/port/pg_bswap.h17
-rw-r--r--src/include/utils/sortsupport.h4
5 files changed, 17 insertions, 37 deletions
diff --git a/src/include/access/gin_tuple.h b/src/include/access/gin_tuple.h
index 702f7d12889..b4f103dec9a 100644
--- a/src/include/access/gin_tuple.h
+++ b/src/include/access/gin_tuple.h
@@ -15,7 +15,9 @@
#include "utils/sortsupport.h"
/*
- * Data for one key in a GIN index.
+ * Data for one key in a GIN index. (This is not the permanent in-index
+ * representation, but just a convenient format to use during the tuplesort
+ * stage of building a new GIN index.)
*/
typedef struct GinTuple
{
diff --git a/src/include/access/spgist_private.h b/src/include/access/spgist_private.h
index cb43a278f46..56ac64f0597 100644
--- a/src/include/access/spgist_private.h
+++ b/src/include/access/spgist_private.h
@@ -285,10 +285,12 @@ typedef struct SpGistCache
* If the prefix datum is of a pass-by-value type, it is stored in its
* Datum representation, that is its on-disk representation is of length
* sizeof(Datum). This is a fairly unfortunate choice, because in no other
- * place does Postgres use Datum as an on-disk representation; it creates
- * an unnecessary incompatibility between 32-bit and 64-bit builds. But the
- * compatibility loss is mostly theoretical since MAXIMUM_ALIGNOF typically
- * differs between such builds, too. Anyway we're stuck with it now.
+ * place does Postgres use Datum as an on-disk representation. Formerly it
+ * meant an unnecessary incompatibility between 32-bit and 64-bit builds, and
+ * as of v19 it instead creates a hazard for binary upgrades on 32-bit builds.
+ * Fortunately, that hazard seems mostly theoretical for lack of affected
+ * opclasses. Going forward, we will be using a fixed size of Datum so that
+ * there's no longer any pressing reason to change this.
*/
typedef struct SpGistInnerTupleData
{
@@ -377,8 +379,8 @@ typedef SpGistNodeTupleData *SpGistNodeTuple;
*
* size must be a multiple of MAXALIGN; also, it must be at least SGDTSIZE
* so that the tuple can be converted to REDIRECT status later. (This
- * restriction only adds bytes for a NULL leaf datum stored on a 32-bit
- * machine; otherwise alignment restrictions force it anyway.)
+ * restriction only adds bytes for a NULL leaf datum; otherwise alignment
+ * restrictions force it anyway.)
*/
typedef struct SpGistLeafTupleData
{
diff --git a/src/include/access/tupmacs.h b/src/include/access/tupmacs.h
index 6240ec930e7..84b3e7fd896 100644
--- a/src/include/access/tupmacs.h
+++ b/src/include/access/tupmacs.h
@@ -39,9 +39,6 @@ att_isnull(int ATT, const bits8 *BITS)
* return the correct number of bytes fetched from the data area and extended
* to Datum form.
*
- * On machines where Datum is 8 bytes, we support fetching 8-byte byval
- * attributes; otherwise, only 1, 2, and 4-byte values are supported.
- *
* Note that T must already be properly aligned for this to work correctly.
*/
#define fetchatt(A,T) fetch_att(T, (A)->attbyval, (A)->attlen)
@@ -62,10 +59,8 @@ fetch_att(const void *T, bool attbyval, int attlen)
return Int16GetDatum(*((const int16 *) T));
case sizeof(int32):
return Int32GetDatum(*((const int32 *) T));
-#if SIZEOF_DATUM == 8
- case sizeof(Datum):
- return *((const Datum *) T);
-#endif
+ case sizeof(int64):
+ return Int64GetDatum(*((const int64 *) T));
default:
elog(ERROR, "unsupported byval length: %d", attlen);
return 0;
@@ -221,11 +216,9 @@ store_att_byval(void *T, Datum newdatum, int attlen)
case sizeof(int32):
*(int32 *) T = DatumGetInt32(newdatum);
break;
-#if SIZEOF_DATUM == 8
- case sizeof(Datum):
- *(Datum *) T = newdatum;
+ case sizeof(int64):
+ *(int64 *) T = DatumGetInt64(newdatum);
break;
-#endif
default:
elog(ERROR, "unsupported byval length: %d", attlen);
}
diff --git a/src/include/port/pg_bswap.h b/src/include/port/pg_bswap.h
index 33648433c63..b15f6f6ac38 100644
--- a/src/include/port/pg_bswap.h
+++ b/src/include/port/pg_bswap.h
@@ -130,8 +130,7 @@ pg_bswap64(uint64 x)
/*
* Rearrange the bytes of a Datum from big-endian order into the native byte
- * order. On big-endian machines, this does nothing at all. Note that the C
- * type Datum is an unsigned integer type on all platforms.
+ * order. On big-endian machines, this does nothing at all.
*
* One possible application of the DatumBigEndianToNative() macro is to make
* bitwise comparisons cheaper. A simple 3-way comparison of Datums
@@ -139,23 +138,11 @@ pg_bswap64(uint64 x)
* the same result as a memcmp() of the corresponding original Datums, but can
* be much cheaper. It's generally safe to do this on big-endian systems
* without any special transformation occurring first.
- *
- * If SIZEOF_DATUM is not defined, then postgres.h wasn't included and these
- * macros probably shouldn't be used, so we define nothing. Note that
- * SIZEOF_DATUM == 8 would evaluate as 0 == 8 in that case, potentially
- * leading to the wrong implementation being selected and confusing errors, so
- * defining nothing is safest.
*/
-#ifdef SIZEOF_DATUM
#ifdef WORDS_BIGENDIAN
#define DatumBigEndianToNative(x) (x)
#else /* !WORDS_BIGENDIAN */
-#if SIZEOF_DATUM == 8
-#define DatumBigEndianToNative(x) pg_bswap64(x)
-#else /* SIZEOF_DATUM != 8 */
-#define DatumBigEndianToNative(x) pg_bswap32(x)
-#endif /* SIZEOF_DATUM == 8 */
+#define DatumBigEndianToNative(x) UInt64GetDatum(pg_bswap64(DatumGetUInt64(x)))
#endif /* WORDS_BIGENDIAN */
-#endif /* SIZEOF_DATUM */
#endif /* PG_BSWAP_H */
diff --git a/src/include/utils/sortsupport.h b/src/include/utils/sortsupport.h
index b7abaf7802d..c64527e2ee9 100644
--- a/src/include/utils/sortsupport.h
+++ b/src/include/utils/sortsupport.h
@@ -262,7 +262,6 @@ ApplyUnsignedSortComparator(Datum datum1, bool isNull1,
return compare;
}
-#if SIZEOF_DATUM >= 8
static inline int
ApplySignedSortComparator(Datum datum1, bool isNull1,
Datum datum2, bool isNull2,
@@ -296,7 +295,6 @@ ApplySignedSortComparator(Datum datum1, bool isNull1,
return compare;
}
-#endif
static inline int
ApplyInt32SortComparator(Datum datum1, bool isNull1,
@@ -376,9 +374,7 @@ ApplySortAbbrevFullComparator(Datum datum1, bool isNull1,
* are eligible for faster sorting.
*/
extern int ssup_datum_unsigned_cmp(Datum x, Datum y, SortSupport ssup);
-#if SIZEOF_DATUM >= 8
extern int ssup_datum_signed_cmp(Datum x, Datum y, SortSupport ssup);
-#endif
extern int ssup_datum_int32_cmp(Datum x, Datum y, SortSupport ssup);
/* Other functions in utils/sort/sortsupport.c */