Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 495ed0e

Browse files
committedJul 7, 2022
Make Windows 10 the minimal runtime requirement for WIN32
This commit bumps the runtime value of _WIN32_WINNT to be 0x0A00 for any builds on Windows. Hence, this makes Windows 10 the minimal requirement when running PostgreSQL under WIN32, be it for builds of Cygwin, MinGW or Visual Studio. The previous minimal runtime version was either Windows Vista when building with at least Visual Studio 2015 or Windows XP for the rest. Windows 10 is the most modern version supported by Microsoft, and per discussion, as we don't have buildfarm members that run older versions anymore, this is the minimal supported version that suits better for our needs. This will actually make easier the development of some patches, two being async I/O and large page handling by avoiding a lot of compatibility gotchas, on platforms that have most likely few users anyway. It is possible to remove MIN_WINNT in win32.h and the macros IsWindowsXXXOrGreater() that were used in the code at runtime to check which version of Windows was getting used. The change in pg_locale.c comes from Juan. Note that all my tests passed, and that the CI is green. The buildfarm will quickly tell if this needs more adjustments. Author: Michael Paquier, Juan José Santamaría Flecha Reviewed-by: Thomas Munro Discussion: https://postgr.es/m/Yo7tHKD8VCkeNi71@paquier.xyz
1 parent d547f7c commit 495ed0e

File tree

6 files changed

+13
-69
lines changed

6 files changed

+13
-69
lines changed
 

‎doc/src/sgml/install-windows.sgml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,7 @@
8282
as well as standalone Windows SDK releases 8.1a to 10.
8383
64-bit PostgreSQL builds are supported with
8484
<productname>Microsoft Windows SDK</productname> version 8.1a to 10 or
85-
<productname>Visual Studio 2013</productname> and above. Compilation
86-
is supported down to <productname>Windows 7</productname> and
87-
<productname>Windows Server 2008 R2 SP1</productname> when building with
88-
<productname>Visual Studio 2013</productname> to
89-
<productname>Visual Studio 2022</productname>.
85+
<productname>Visual Studio 2013</productname> and above.
9086
<!--
9187
For 2013 requirements:
9288
https://docs.microsoft.com/en-us/visualstudio/productinfo/vs2013-sysrequirements-vs
@@ -358,8 +354,7 @@ $ENV{MSBFLAGS}="/m";
358354
<title>Special Considerations for 64-Bit Windows</title>
359355

360356
<para>
361-
PostgreSQL will only build for the x64 architecture on 64-bit Windows, there
362-
is no support for Itanium processors.
357+
PostgreSQL will only build for the x64 architecture on 64-bit Windows.
363358
</para>
364359

365360
<para>

‎doc/src/sgml/installation.sgml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2136,7 +2136,7 @@ export MANPATH
21362136

21372137
<para>
21382138
<productname>PostgreSQL</productname> can be expected to work on these operating
2139-
systems: Linux (all recent distributions), Windows (XP and later),
2139+
systems: Linux (all recent distributions), Windows (10 and later),
21402140
FreeBSD, OpenBSD, NetBSD, macOS, AIX, HP/UX, and Solaris.
21412141
Other Unix-like systems may also work but are not currently
21422142
being tested. In most cases, all CPU architectures supported by
@@ -2323,16 +2323,15 @@ ERROR: could not load library "/opt/dbs/pgsql/lib/plperl.so": Bad address
23232323
<listitem>
23242324
<para>
23252325
The <command>adduser</command> command is not supported; use
2326-
the appropriate user management application on Windows NT,
2327-
2000, or XP. Otherwise, skip this step.
2326+
the appropriate user management application on Windows.
2327+
Otherwise, skip this step.
23282328
</para>
23292329
</listitem>
23302330

23312331
<listitem>
23322332
<para>
23332333
The <command>su</command> command is not supported; use ssh to
2334-
simulate su on Windows NT, 2000, or XP. Otherwise, skip this
2335-
step.
2334+
simulate su on Windows. Otherwise, skip this step.
23362335
</para>
23372336
</listitem>
23382337

‎src/backend/main/main.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -290,23 +290,6 @@ startup_hacks(const char *progname)
290290
_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
291291
_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
292292
_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
293-
294-
#if defined(_M_AMD64) && _MSC_VER == 1800
295-
296-
/*----------
297-
* Avoid crashing in certain floating-point operations if we were
298-
* compiled for x64 with MS Visual Studio 2013 and are running on
299-
* Windows prior to 7/2008R2 SP1 on an AVX2-capable CPU.
300-
*
301-
* Ref: https://connect.microsoft.com/VisualStudio/feedback/details/811093/visual-studio-2013-rtm-c-x64-code-generation-bug-for-avx2-instructions
302-
*----------
303-
*/
304-
if (!IsWindows7SP1OrGreater())
305-
{
306-
_set_FMA3_enable(0);
307-
}
308-
#endif /* defined(_M_AMD64) && _MSC_VER == 1800 */
309-
310293
}
311294
#endif /* WIN32 */
312295

‎src/backend/utils/adt/pg_locale.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,7 +1719,7 @@ get_collation_actual_version(char collprovider, const char *collcollate)
17191719
else
17201720
ereport(ERROR,
17211721
(errmsg("could not load locale \"%s\"", collcollate)));
1722-
#elif defined(WIN32) && _WIN32_WINNT >= 0x0600
1722+
#elif defined(WIN32)
17231723
/*
17241724
* If we are targeting Windows Vista and above, we can ask for a name
17251725
* given a collation name (earlier versions required a location code
@@ -1747,7 +1747,7 @@ get_collation_actual_version(char collprovider, const char *collcollate)
17471747
collcollate,
17481748
GetLastError())));
17491749
}
1750-
collversion = psprintf("%d.%d,%d.%d",
1750+
collversion = psprintf("%ld.%ld,%ld.%ld",
17511751
(version.dwNLSVersion >> 8) & 0xFFFF,
17521752
version.dwNLSVersion & 0xFF,
17531753
(version.dwDefinedVersion >> 8) & 0xFFFF,

‎src/bin/pg_ctl/pg_ctl.c

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1896,17 +1896,8 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_ser
18961896
/* Verify that we found all functions */
18971897
if (_IsProcessInJob == NULL || _CreateJobObject == NULL || _SetInformationJobObject == NULL || _AssignProcessToJobObject == NULL || _QueryInformationJobObject == NULL)
18981898
{
1899-
/*
1900-
* IsProcessInJob() is not available on < WinXP, so there is no need
1901-
* to log the error every time in that case
1902-
*/
1903-
if (IsWindowsXPOrGreater())
1904-
1905-
/*
1906-
* Log error if we can't get version, or if we're on WinXP/2003 or
1907-
* newer
1908-
*/
1909-
write_stderr(_("%s: WARNING: could not locate all job object functions in system API\n"), progname);
1899+
/* Log error if we can't get version */
1900+
write_stderr(_("%s: WARNING: could not locate all job object functions in system API\n"), progname);
19101901
}
19111902
else
19121903
{
@@ -1946,19 +1937,6 @@ CreateRestrictedProcess(char *cmd, PROCESS_INFORMATION *processInfo, bool as_ser
19461937
JOB_OBJECT_UILIMIT_EXITWINDOWS | JOB_OBJECT_UILIMIT_READCLIPBOARD |
19471938
JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS | JOB_OBJECT_UILIMIT_WRITECLIPBOARD;
19481939

1949-
if (as_service)
1950-
{
1951-
if (!IsWindows7OrGreater())
1952-
{
1953-
/*
1954-
* On Windows 7 (and presumably later),
1955-
* JOB_OBJECT_UILIMIT_HANDLES prevents us from
1956-
* starting as a service. So we only enable it on
1957-
* Vista and earlier (version <= 6.0)
1958-
*/
1959-
uiRestrictions.UIRestrictionsClass |= JOB_OBJECT_UILIMIT_HANDLES;
1960-
}
1961-
}
19621940
_SetInformationJobObject(job, JobObjectBasicUIRestrictions, &uiRestrictions, sizeof(uiRestrictions));
19631941

19641942
securityLimit.SecurityLimitFlags = JOB_OBJECT_SECURITY_NO_ADMIN | JOB_OBJECT_SECURITY_ONLY_TOKEN;

‎src/include/port/win32.h

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,13 @@
1111

1212
/*
1313
* Make sure _WIN32_WINNT has the minimum required value.
14-
* Leave a higher value in place. When building with at least Visual
15-
* Studio 2015 the minimum requirement is Windows Vista (0x0600) to
16-
* get support for GetLocaleInfoEx() with locales. For everything else
17-
* the minimum version is Windows XP (0x0501).
14+
* Leave a higher value in place. The minimum requirement is Windows 10.
1815
*/
19-
#if defined(_MSC_VER) && _MSC_VER >= 1900
20-
#define MIN_WINNT 0x0600
21-
#else
22-
#define MIN_WINNT 0x0501
23-
#endif
24-
25-
#if defined(_WIN32_WINNT) && _WIN32_WINNT < MIN_WINNT
16+
#ifdef _WIN32_WINNT
2617
#undef _WIN32_WINNT
2718
#endif
2819

29-
#ifndef _WIN32_WINNT
30-
#define _WIN32_WINNT MIN_WINNT
31-
#endif
20+
#define _WIN32_WINNT 0x0A00
3221

3322
/*
3423
* We need to prevent <crtdefs.h> from defining a symbol conflicting with

0 commit comments

Comments
 (0)
Failed to load comments.