posix rename, "renames a file, moving it between directories if required".
pgrename, win32 port uses MoveFileEx, to support rename files at Windows side, but, actually don't allow "renames a file, moving it between directories if required". To match the same characteristics as posix rename, we need to add a flag to MoveFileEx (MOVEFILE_COPY_ALLOWED) Which allows, if necessary, to move between volumes, drives and directories. Such a resource seems to decrease the chances of occurring, permission denied, when renaming the temporary statistics file.
allow_win32_rename_across_volumes.patch
Description: Binary data