Making type Datum be 8 bytes everywhere
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@lists.postgresql.org
Cc: Andres Freund <andres@anarazel.de>, Robert Haas <robertmhaas@gmail.com>
Date: 2025-07-18T00:09:57Z
Lists: pgsql-hackers
Attachments
- v0-0001-Make-type-Datum-be-8-bytes-wide-everywhere.patch (text/x-diff) patch v0-0001
In a discussion on Discord (in the PG #core-hacking channel, which unfortunately is inaccessible to non-members), Andres and Robert complained about the development/maintenance costs of continuing to support 32-bit platforms. Here is a modest proposal to reduce those costs without going so far as to entirely desupport such platforms: let's require them to use 8-byte Datums even though that's probably not a native data type for them. That lets us get rid of logic to support the !USE_FLOAT8_BYVAL case, and allows a few other simplifications. The attached patch switches to 8-byte Datums everywhere, but doesn't make any effort to remove the now-dead code. I made it just as a proof-of-concept that this can work. It compiled cleanly and passed check-world for me on a 32-bit FreeBSD image. I've not looked into the performance consequences. We probably should at least try to measure that, though I'm not sure what our threshold of pain would be for deciding not to do this. Thoughts? regards, tom lane
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Avoid faulty alignment of Datums in build_sorted_items().
- 09036dc71c68 19 (unreleased) landed
-
Grab the low-hanging fruit from forcing USE_FLOAT8_BYVAL to true.
- ee54046601de 19 (unreleased) landed
-
Grab the low-hanging fruit from forcing sizeof(Datum) to 8.
- 6aebedc38497 19 (unreleased) landed
-
Make type Datum be 8 bytes wide everywhere.
- 2a600a93c7be 19 (unreleased) landed
-
Mop-up for Datum conversion cleanups.
- 665c3dbba497 19 (unreleased) landed