Re: [Patch] Windows relation extension failure at 2GB and 4GB
Thomas Munro <thomas.munro@gmail.com>
From: Thomas Munro <thomas.munro@gmail.com>
To: Bryan Green <dbryan.green@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2025-11-06T10:10:00Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Replace off_t by pgoff_t in I/O routines
- 84fb27511dbe 19 (unreleased) landed
-
Add check for large files in meson.build
- d715aaa76f68 16.12 landed
- f6c1342e72aa 17.8 landed
- 434b605745a1 18.2 landed
- 79cd66f28c65 19 (unreleased) landed
On Thu, Nov 6, 2025 at 10:20 PM Thomas Munro <thomas.munro@gmail.com> wrote: > The only system left with narrow off_t is Windows. By the way, that's not always true: Meson + MinGW have a 64-bit off_t on Windows, because meson decides to set -D_FIILE_OFFSET_BITS=64 for all C compilers except msvc[1] (only other exclusion is macOS, but that is 64-bit only these days; there are other systems like FreeBSD where sizeof(off_t) is always 8 but it doesn't seem to know about that or bother to check), and MinGW's headers react to that. I suspect autoconf's AC_SYS_LARGEFILE would do that too with MinGW, IDK, but configure.ac doesn't call it for win32 by special condition. That creates a strange difference between meson and autoconf builds IMHO, but if we resolve that in the only direction possible AFAICS we'd still have a strange difference between MSVC and MinGW. Observing that mess, I kinda wonder what would happen if we just used a big hammer to redefine off_t to be __int64 ourselves. On the face of it, it sounds like an inherently bad idea that could bite you when interacting with libraries whose headers use off_t. On the other hand, the world of open source libraries we care about might already be resistant to that chaos, if libraries are being built with and without -D_FIILE_OFFSET_BITS=64 willy-nilly, or they actually can't deal with large files at all in which case that's something we'd have to deal with whatever we do. I don't know, it's just a thought that occurred to me while contemplating how unpleasant it is to splatter pgoff_t all over our tree, and yet *still* have to tread very carefully with the boundaries of external libraries that might be using off_t, researching each case... [1] https://github.com/mesonbuild/meson/blob/97a1c567c9813176e4bec40f6055f228b2121609/mesonbuild/compilers/compilers.py#L1144