diff --git a/src/client/stdlib/duckdb.js b/src/client/stdlib/duckdb.js index 18ce36b36..c4d6093ac 100644 --- a/src/client/stdlib/duckdb.js +++ b/src/client/stdlib/duckdb.js @@ -255,8 +255,10 @@ async function insertFile(database, name, file, options) { if (/\.parquet$/i.test(file.name)) { return await connection.query(`CREATE VIEW '${name}' AS SELECT * FROM parquet_scan('${file.name}')`); } - // Lastly, let DuckDB guess: it may be a .duckdb (or .db or .ddb) database file. - return await connection.query(`ATTACH '${file.name}' AS ${name} (READ_ONLY)`); + if (/\.(db|ddb|duckdb)$/i.test(file.name)) { + return await connection.query(`ATTACH '${file.name}' AS ${name} (READ_ONLY)`); + } + throw new Error(`unknown file type: ${file.mimeType}`); } } finally { await connection.close();