Repository navigation
fix(duckdb): show all tables and views on schema refresh on Windows - #653
Conversation
…ws all of them on Windows extractSchema opened the database file twice at once (tables and views via Promise.all). On Windows the second open fails on the file lock, so one list came back empty and items disappeared from the schema tree on refresh.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Closes #614
Problem
On Windows, refreshing a DuckDB connection's schema tree in the SQL Editor sometimes dropped tables or views, and they came back on a later refresh.
Cause
DuckDBSchemaExtractor.extractSchemaread the tables and the views at the same time withPromise.all, and each read opens the database file on its own. On Windows the second open fails while the first one still holds the file ("Cannot open file ... being used by another process"). The error was caught quietly, so that list came back empty. macOS and Linux don't lock the file this way, which is why it only happened on Windows.Fix
Read the tables first, then the views, so only one open of the file exists at a time. No Windows-only code: every OS runs the same lines. On macOS and Linux the only difference is that the two reads no longer overlap.
Testing (Windows)
tests/integration/connections/duckdb.extractor.test.ts: fails ondev("selects a schema whose name needs quoting"), passes with the fix (6 of 6 runs).dev: no new failures. The remaining failures also fail ondevwithout this change. Locally that's Docker-dependent Postgres tests, line endings ingit.service, a busy settings database file, and 30 known unit failures.Not tested on macOS or Linux by hand; the integration workflow covers Linux.
Summary by CodeRabbit