Re: stat() vs ERROR_DELETE_PENDING, round N + 1
Juan José Santamaría Flecha <juanjo.santamaria@gmail.com>
From: Juan José Santamaría Flecha <juanjo.santamaria@gmail.com>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Alexander Lakhin <exclusion@gmail.com>,
Michael Paquier <michael@paquier.xyz>, Tom Lane <tgl@sss.pgh.pa.us>, Andres Freund <andres@anarazel.de>, Kyotaro Horiguchi <horikyota.ntt@gmail.com>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2021-09-23T09:05:47Z
Lists: pgsql-hackers
On Thu, Sep 23, 2021 at 4:58 AM Thomas Munro <thomas.munro@gmail.com> wrote: > > One small detail I'd like to draw attention to is this bit, which > differs slightly from the [non-working] previous attempts by mapping > to two different errors: > > + * If there's no O_CREAT flag, then we'll pretend the file is > + * invisible. With O_CREAT, we have no choice but to report that > + * there's a file in the way (which wouldn't happen on Unix). > > ... > > + if (fileFlags & O_CREAT) > + err = ERROR_FILE_EXISTS; > + else > + err = ERROR_FILE_NOT_FOUND; > When GetTempFileName() finds a duplicated file name and the file is pending for deletion, it fails with an "ERROR_ACCESS_DENIED" error code. That may describe the situation better than "ERROR_FILE_EXISTS". Regards, Juan José Santamaría Flecha
Commits
-
Check for STATUS_DELETE_PENDING on Windows.
- e2f0f8ed251d 15.0 landed
-
Fix our Windows stat() emulation to handle file sizes > 4GB.
- bed90759fcbc 14.0 cited
-
Attempt to handle pending-delete files on Windows
- 9951741bbeb3 10.0 cited