Fix pg_truncate() on Windows.

Thomas Munro <tmunro@postgresql.org>

Commit: af209b7893f45af04f1b6f6304e9882069111da7
Author: Thomas Munro <tmunro@postgresql.org>
Date: 2023-01-06T03:50:23Z
Releases: 14.7
Fix pg_truncate() on Windows.

Commit 57faaf376 added pg_truncate(const char *path, off_t length), but
"length" was ignored under WIN32 and the file was unconditionally
truncated to 0.

There was no live bug, since the only caller passes 0.

Fix, and back-patch to 14 where the function arrived.

Author: Justin Pryzby <pryzby@telsasoft.com>
Discussion: https://postgr.es/m/20230106031652.GR3109%40telsasoft.com

Files

PathChange+/−
src/backend/storage/file/fd.c modified +1 −1

Discussion