Hi all,

On the thread about the removal of VS 2013, Jose (in CC) has mentioned
that bumping MIN_WINNT independently would make sense, as the
simplication of locales would expose under MinGW some code for
GetLocaleInfoEx():
https://www.postgresql.org/message-id/cac+axb3himfh+-pgro1cyju6zf2hlh6vmwpbf5raytf1ubm...@mail.gmail.com

Attached is a patch to set MIN_WINNT, the minimal version of Windows
allowed at run-time to 0x0600 for all environments, aka Vista.  This
results in removing the support for XP at run-time when compiling with
anything else than VS >= 2015 (VS 2013, MinGW, etc.).  We could cut
things more, I hope, but this bump makes sense in itself with the
business related to locales.

What I would like to do is to apply that at the beginning of the dev
cycle for v16, in parallel of the removal of VS 2013.  This move is
rather independent of the other thread, which is why I am spawning a
new one here.  And it is better than having to dig into the other
thread for a change like that.

Thoughts or opinions?
--
Michael
From 26da923e3007e7eb1b459826158623c9db47e983 Mon Sep 17 00:00:00 2001
From: Michael Paquier <mich...@paquier.xyz>
Date: Thu, 26 May 2022 10:20:06 +0900
Subject: [PATCH] Bump WIN_MINNT to 0x0600 everywhere

---
 src/include/port/win32.h          | 10 +++-------
 src/backend/utils/adt/pg_locale.c |  4 ++--
 doc/src/sgml/installation.sgml    |  2 +-
 3 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/src/include/port/win32.h b/src/include/port/win32.h
index c6213c77c3..4d24c46812 100644
--- a/src/include/port/win32.h
+++ b/src/include/port/win32.h
@@ -11,15 +11,11 @@
 
 /*
  * Make sure _WIN32_WINNT has the minimum required value.
- * Leave a higher value in place. When building with at least Visual
- * Studio 2015 the minimum requirement is Windows Vista (0x0600) to
- * get support for GetLocaleInfoEx() with locales. For everything else
- * the minimum version is Windows XP (0x0501).
+ * Leave a higher value in place.  The minimum requirement is Windows Vista
+ * (0x0600) to get support for GetLocaleInfoEx() with locales.
  */
-#if defined(_MSC_VER) && _MSC_VER >= 1900
+#if defined(_MSC_VER)
 #define MIN_WINNT 0x0600
-#else
-#define MIN_WINNT 0x0501
 #endif
 
 #if defined(_WIN32_WINNT) && _WIN32_WINNT < MIN_WINNT
diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c
index a0490a7522..4c39841b99 100644
--- a/src/backend/utils/adt/pg_locale.c
+++ b/src/backend/utils/adt/pg_locale.c
@@ -1729,7 +1729,7 @@ get_collation_actual_version(char collprovider, const char *collcollate)
 		else
 			ereport(ERROR,
 					(errmsg("could not load locale \"%s\"", collcollate)));
-#elif defined(WIN32) && _WIN32_WINNT >= 0x0600
+#elif defined(WIN32)
 		/*
 		 * If we are targeting Windows Vista and above, we can ask for a name
 		 * given a collation name (earlier versions required a location code
@@ -1757,7 +1757,7 @@ get_collation_actual_version(char collprovider, const char *collcollate)
 							collcollate,
 							GetLastError())));
 		}
-		collversion = psprintf("%d.%d,%d.%d",
+		collversion = psprintf("%ld.%ld,%ld.%ld",
 							   (version.dwNLSVersion >> 8) & 0xFFFF,
 							   version.dwNLSVersion & 0xFF,
 							   (version.dwDefinedVersion >> 8) & 0xFFFF,
diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml
index c585078029..5e2541137b 100644
--- a/doc/src/sgml/installation.sgml
+++ b/doc/src/sgml/installation.sgml
@@ -2136,7 +2136,7 @@ export MANPATH
 
   <para>
    <productname>PostgreSQL</productname> can be expected to work on these operating
-   systems: Linux (all recent distributions), Windows (XP and later),
+   systems: Linux (all recent distributions), Windows (Vista and later),
    FreeBSD, OpenBSD, NetBSD, macOS, AIX, HP/UX, and Solaris.
    Other Unix-like systems may also work but are not currently
    being tested.  In most cases, all CPU architectures supported by
-- 
2.36.1

Attachment: signature.asc
Description: PGP signature

Reply via email to