pgsql: On Windows, make link(2) report ENOTSUP when appropriate.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: On Windows, make link(2) report ENOTSUP when appropriate.
Date: 2026-07-31 18:40:08
Message-ID: E1wps9Q-0000000188j-3xKV@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On Windows, make link(2) report ENOTSUP when appropriate.

CreateHardLinkA reports ERROR_INVALID_FUNCTION if the target file
is on a filesystem that doesn't support hard links. _dosmaperr
maps that to EINVAL, which confuses zic.c into failure. zic.c is
expecting ENOTSUP if the filesystem lacks link support, and will
properly fall back to making a physical copy if it gets that.
Hence, add code to map ERROR_INVALID_FUNCTION to ENOTSUP.

(We could instead teach _dosmaperr to do that, but it's far from clear
that this would be appropriate as a global behavior: intuitively
it seems like EINVAL should be appropriate most of the time.)

We didn't need this before commit aeb07c55f, because the tzcode
version we were using before that didn't have this particular
error-handling logic. Hence, no back-patch for now; but if we
decide to back-patch tzcode 2026b or later, we'll need this too.

Author: Vladlen Popolitov <v(dot)popolitov(at)postgrespro(dot)ru>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/e6122f9b2eef9096f1f11ecc058bcd91@postgrespro.ru

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/481052c7754013d44a89f50912ba6845398f88df

Modified Files
--------------
src/port/win32link.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Nathan Bossart 2026-07-31 19:01:25 pgsql: Add list of major features to the v19 release notes.
Previous Message Jacob Champion 2026-07-31 18:27:10 pgsql: libpq-oauth: Avoid overflow for very large intervals