You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Give every storage engine one storage interface that saves the whole table definition and writes through the pipeline #2681
After #2716 to #2662 memory tables check their rules in one write pipeline. Tables in a storage engine still take their own path. With autocommit on, yy.Insert.compile (src/statements/insert.js) hands the rows to alasql.engines[engineid].intoTable, which appends them (LS.intoTable in src/storage/localstorage.js, FS.intoTable in src/storage/filestorage.js, IDB.intoTable in src/storage/indexeddb.js). Only identity and DEFAULT are applied.
Each engine saves its own list of table fields (LS.storeTable, FS.createTable, FS.commit), so keys, checks and foreign keys are lost when a table is saved and read again.
On FILESTORAGE, after CREATE TABLE t (id INT PRIMARY KEY, n INT DEFAULT 7, CHECK (id > 0)), inserting 1, 1 and -5 stores all three rows.
What to change
One storage interface. The memory table and each engine implement it.
interfaceStorage{load(table);// rows and definitioninsert(table,rows);update(table,changes);delete(table,rows);truncate(table);saveSchema(table,schema);// the whole definition from #3169}
saveSchema stores the definition object as it is, and load restores it. Remove the field lists in LS.storeTable, FS.createTable and FS.commit.
A table saved by 4.x has no stored definition beyond its old fields. load reads it as before and fills in the rest as empty.
The interface with localStorage can be one pull request, then FILESTORAGE, then IndexedDB.
What stays the same
Memory tables.
An engine table without keys, checks or foreign keys stores the same rows.
An engine table with them now rejects the rows a memory table rejects, with the same error texts.
Done when
A new test file named after this issue runs the same script against a memory table, localStorage (with the DOMStorage shim that test150.js uses) and FILESTORAGE. A duplicate primary key, a duplicate UNIQUE value, a failing CHECK and a missing foreign key parent each give the same error on all three, and a table saved and loaded again keeps its keys and checks.
A table file written by 4.x loads.
The full test suite and the CI checks (dialect test, parity check, run-state check, binding check) pass, and the pull request lists every parity difference.
changed the title [-]Review #2340 for code improvements: storage engine inserts skip the table's rules[/-][+]Give every storage engine one storage interface that saves the whole table definition and writes through the pipeline[/+]on Nov 26, 2026
Activity
[-]Review #2340 for code improvements: storage engine inserts skip the table's rules[/-][+]Give every storage engine one storage interface that saves the whole table definition and writes through the pipeline[/+]