Skip to content

fix(windows): make a new DuckDB file instead of failing with access denied - #4306

Merged
datlechin merged 4 commits into
mainfrom
fix/windows-duckdb-new-file
Nov 16, 2026
Merged

datlechin merged 4 commits into
mainfrom
fix/windows-duckdb-new-file

Conversation

@datlechin

@datlechin datlechin commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Summary

  • New file then Connect for a DuckDB connection failed on Windows with "Windows refused access to the file". The DuckDB driver flushed the new database through File::open, a read-only handle, and Windows' FlushFileBuffers needs write access (ERROR_ACCESS_DENIED, measured on windows-11-arm in run 43823425428). The flush now goes through a handle open for writing, as storage/upgrade_copies.rs already does.
  • SQLite's New file was not affected: it flushes the handle it created for writing.
  • The New file picker no longer asks to replace a file that is there, since the form never replaces it: it opens it as it is, as macOS does. The form now says so ("This file exists, so it opens as it is") instead of "The file is made when you connect".
  • The DuckDB and SQLite create_file tests run on every platform now, with the Unix permission checks kept to Unix, and one more for a new file where none was. A DuckDB test that makes a symbolic link is kept to Unix, so the crate's tests build on Windows.

Test plan

  • UI test ANewFileNamedInTheSavePickerIsMadeAndConnects (DuckDB and SQLite, light and dark): names the file in the save picker, connects, the workspace opens. On main it fails for DuckDB on x64 and Arm64 with the form stuck on "Windows refused access to the file" (run 43823425428); SQLite passes.
  • UI test AnExistingFileNamedForANewOneOpensAsItIsWithoutAReplaceQuestion: no Replace question, the status says the file opens as it is, and its tables are there after Connect.
  • Interop test NewFileTests (DuckDB and SQLite): make the file, open it again, write to it. Runs on the Windows x64, Arm64 and macOS jobs.
  • cargo test -p tablepro-driver-duckdb --lib create_file and -p tablepro-driver-sqlite --lib create_file: pass on macOS, and on windows-11-arm with this fix (run 43825619545).

Screenshots

Before, on main (x64 runner, #4304's run): Connect leaves the form on the error.

Before, light
Before, dark

After: a new file waits for Connect, which now opens the workspace (the UI test checks it on x64 and Arm64).

New file named, light
New file named, dark

After: a file that is there opens as it is, with no Replace question.

Existing file, light
Existing file, dark

@datlechin
datlechin merged commit 008b2fa into main Nov 16, 2026
36 of 37 checks passed
@datlechin
datlechin deleted the fix/windows-duckdb-new-file branch November 17, 2026 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant