duckdb / duckdb-wasm

WebAssembly version of DuckDB
https://shell.duckdb.org
MIT License
1.02k stars 111 forks source link

CHECKPOINT / DETACH create invalid database files #1638

Open jknezek-locktera opened 4 months ago

jknezek-locktera commented 4 months ago

What happens?

I am trying to download a copy of the in-memory database. I have tried using CHECKPOINT and DETACH. In both cases, the WAL file has bytes that indicate it has some content, but after a CHECKPOINT or DETACH the resultant database file is only 1 byte large, and can't be ATTACHed as it is invalid.

To Reproduce

-- CHECKPOINT
attach 'file.db';
create table file.test_table as select * from generate_series(1, 5);
select * from file.test_table;
-- .files
checkpoint file;
-- .files
-- DETACH
attach 'file.db';
create table file.test_table as select * from generate_series(1, 5);
select * from file.test_table;
-- .files
detach file;
-- .files
attach 'file.db';

Browser/Environment:

Brave 1.62.162; Chromium 121

Device:

MacBook Pro M1

DuckDB-Wasm Version:

1.28.1-dev112.0

DuckDB-Wasm Deployment:

shell.duckdb.org

Full Name:

J Knezek

Affiliation:

Locktera