SQLite changes() counts non-changing UPDATEs SQLite changes() counts non-changing UPDATEs sqlite sqlite

SQLite changes() counts non-changing UPDATEs


The database does not compare old and new values; any UPDATEd row always counts as "changed" even if the values happen to be the same.The documentation says that

the UPDATE affects … those rows for which the result of evaluating the WHERE clause expression as a boolean expression is true.

If you want to check the old value, you have to do it explicitly:

UPDATE People SET Name = 'Emma' WHERE Id = 1 AND Name IS NOT 'Emma';