Skip to content

Fix AUTOINCREMENT not populating identity columns in IndexedDB tables - #2526

Draft
mathiasrw with Copilot wants to merge 2 commits into
developfrom
copilot/fix-autoincrement-indexeddb
Draft

Fix AUTOINCREMENT not populating identity columns in IndexedDB tables#2526
mathiasrw with Copilot wants to merge 2 commits into
developfrom
copilot/fix-autoincrement-indexeddb

Conversation

Copilot AI commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

AUTOINCREMENT (mapped to IDENTITY) columns were silently dropped when inserting into IndexedDB-backed tables — the column was absent entirely from query results rather than receiving an auto-incremented value.

Root cause

IDB.intoTable passed records directly to IndexedDB without applying the table's identities counter, bypassing the logic that both the in-memory table.insert path and LS.intoTable (LocalStorage) already handle.

Changes

  • src/91indexeddb.jsIDB.intoTable: Before writing records to the object store, iterate table.identities and assign the current counter value to any record missing that column, then advance the counter (or sync it forward if the user supplied an explicit value ≥ the current counter).
// Before: records inserted as-is, identity column absent
tb.add(value[i]);

// After: identity values applied, counter advanced per record
if (!userProvided) value[i][columnid] = ident.value;
if (userProvided && +value[i][columnid] >= ident.value) {
    ident.value = +value[i][columnid] + ident.step;
} else {
    ident.value += ident.step;
}
  • test/test861.js: Browser-only tests verifying AUTOINCREMENT values are populated on insert and continue incrementing across multiple INSERT statements.

Co-authored-by: mathiasrw <1063454+mathiasrw@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix autoincrement not working for IndexedDB Fix AUTOINCREMENT not populating identity columns in IndexedDB tables Aug 20, 2026
Copilot AI requested a review from mathiasrw August 20, 2026 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AUTOINCREMENT for INDEXEDDB does not seem to work

2 participants