Merge pull request #1432 from mattn/fix-vtable-update-rowid

Identify updated row by argv 0 in goVUpdate
This commit is contained in:
mattn
2026-07-29 04:24:56 +00:00
committed by GitHub
2 changed files with 22 additions and 1 deletions

View File

@@ -637,7 +637,15 @@ func goVUpdate(pVTab unsafe.Pointer, argc C.int, argv **C.sqlite3_value, pRowid
}
case argc > 1:
err = v.Update(vals[1], vals[2:])
// Per the xUpdate contract argv[0] identifies the row being
// updated while argv[1] is its new rowid. VTabUpdater has no
// way to convey a rowid change, so reject it instead of
// silently updating values under the old rowid.
if vals[0] != vals[1] {
err = fmt.Errorf("virtual %s table %sdoes not support changing the rowid", vt.module.name, tname)
} else {
err = v.Update(vals[0], vals[2:])
}
}
}