From 368260caafea50f4955c5459a7f38d4aa41c8212 Mon Sep 17 00:00:00 2001 From: Edon-Ameti Date: Tue, 17 Nov 2026 11:34:47 +0100 Subject: [PATCH] fix(duckdb): read tables and views one after the other so refresh shows 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. --- src/connections/duckdb/duckdb.extractor.main.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/connections/duckdb/duckdb.extractor.main.ts b/src/connections/duckdb/duckdb.extractor.main.ts index cfb037b0..ced25161 100644 --- a/src/connections/duckdb/duckdb.extractor.main.ts +++ b/src/connections/duckdb/duckdb.extractor.main.ts @@ -271,14 +271,13 @@ export default class DuckDBSchemaExtractor { } async extractSchema(): Promise<{ tables: Table[] }> { - const [tableRefsRaw, viewRefsRaw] = await Promise.all([ - this.getTables(), - this.getViews(), - ]); + // Read one after the other: each read opens the file, and on Windows a + // second open while the first is still open fails on the file lock, so + // that list came back empty. + const tableRefsRaw = await this.getTables(); + const viewRefsRaw = await this.getViews(); - // Deduplicate defensively: concurrent connections against the same - // database file (opened separately for the tables and views queries) - // have been observed to yield repeated rows on Windows. + // Deduplicate defensively against repeated rows. const tableRefs = uniqueRefs(tableRefsRaw); // Tables and views are read as two separate snapshots, so a name that // was replaced (table -> view or vice versa) mid-refresh could show up