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
When i set attach filestorage to UNIQUE example stop working
Expected result: Error: Cannot insert record, because it already exists in unique index
Actual Result: All row inserted
Code:
ATTACH FILESTORAGE DATABASE testdb("./testdb.json");
USE testdb;
CREATE TABLE usersTable (id INT UNIQUE, name NVARCHAR(255))
INSERT INTO usersTable VALUES (1,"Andrey")
INSERT INTO usersTable VALUES (2,"Kate")
INSERT INTO usersTable VALUES (3,"Kate")
INSERT INTO usersTable VALUES (3,"Andrey")
Tracked down the cause: CREATE TABLE on an engine-backed table (FILESTORAGE here) calls the engine's createTable() and returns before the code that wires up table.insert() — the function that actually checks PRIMARY KEY/UNIQUE. So FILESTORAGE tables never get table.insert() at all, and INSERT falls back to a plain append.
Opened a fix with a regression test covering both FILESTORAGE and LOCALSTORAGE (same root cause on that engine, with an extra wrinkle on reload): #2977
Activity
shaktimaan00 commentedon Nov 11, 2026
Tracked down the cause: CREATE TABLE on an engine-backed table (FILESTORAGE here) calls the engine's createTable() and returns before the code that wires up table.insert() — the function that actually checks PRIMARY KEY/UNIQUE. So FILESTORAGE tables never get table.insert() at all, and INSERT falls back to a plain append.
Opened a fix with a regression test covering both FILESTORAGE and LOCALSTORAGE (same root cause on that engine, with an extra wrinkle on reload): #2977