turso-cli icon indicating copy to clipboard operation
turso-cli copied to clipboard

There's nothing stopping people from dropping internal tables

Open CodingDoug opened this issue 1 year ago • 4 comments

I don't know if this is the right repo for this issue, apologies if this is wrong.

→  select * from sqlite_schema;
TYPE   NAME                    TBL_NAME                ROOTPAGE  SQL
table  libsql_wasm_func_table  libsql_wasm_func_table  2         CREATE TABLE libsql_wasm_func_table (name text PRIMARY KEY, body text) WITHOUT ROWID
table  _litestream_seq         _litestream_seq         3         CREATE TABLE _litestream_seq (id INTEGER PRIMARY KEY, seq INTEGER)
table  _litestream_lock        _litestream_lock        4         CREATE TABLE _litestream_lock (id INTEGER)
→  drop table libsql_wasm_func_table;

→  drop table _litestream_seq;

→  drop table _litestream_lock;

→  select * from sqlite_schema;
TYPE  NAME  TBL_NAME  ROOTPAGE  SQL

Did I just do something very bad to this database? If I later create a replica, that db will have libsql_wasm_func_table, and then it reappears at the primary. But the litestream tables seem to be gone permanently.

SQLite stops important tables from being dropped:

→  drop table sqlite_schema;
Error: table sqlite_master may not be dropped

We should probably do the same. Also probably control read/write access on them as appropriate.

CodingDoug avatar Mar 11 '23 23:03 CodingDoug