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
I attempted to iterate all objects where the first element of the composite key is 'Johnson' by using the following index range (using 'Johnson\0' as the first entry that shouldn't match):
const range = IDBKeyRange.bound(
['Johnson'],
['Johnson\0'],
/*lowerOpen=*/ false, /*upperOpen=*/true
);
This works as expected using native IndexedDb in a browser, but with indexeddbshim in node.js I get results like 'Johnson2 ...' that should be out of range. Based on the results I get, I think '\0' is being treated as '\...' or something (i.e. as a backslash instead of as a null character).
I suppose our escaping of NUL bytes could instead could begin with \x01, but I guess the only way to be truly faithful here would be to add our own sorting separate from SQLite's. (I'm speaking from memory that this is the way it is done.)
PR's welcome, as this would not be at the top of my priority list (and I'm low on energy and time these days)...
@brettz9 Thanks for the response! I worked around the issue, so this isn't at the top of my priority list either. So definitely feel free to deprioritize (maybe revisit if/when you switch to better-sqlite3).
I attempted to iterate all objects where the first element of the composite key is 'Johnson' by using the following index range (using 'Johnson\0' as the first entry that shouldn't match):
This works as expected using native IndexedDb in a browser, but with indexeddbshim in node.js I get results like 'Johnson2 ...' that should be out of range. Based on the results I get, I think '\0' is being treated as '\...' or something (i.e. as a backslash instead of as a null character).
Repro code:
Result with native IndexedDb on Chrome, Firefox, and Safari:
Result with indexedDb in node:
The last two entries shouldn't be there.
The text was updated successfully, but these errors were encountered: