SQLite Forum

Shortcut to change a non changing update or upsert in a noop
Login
> > I am sure you would agree that changes() should report actual inserts and rewrite of rows on update, regardless of whether the latter changed any bits.

> I don't agree, or disagree. "Changes()", like any other function, should report what its documentation claims for it to report.

(Hmmm, not so sure now ...) Well, I'm not going to argue with **that**. But I do think (and meant to say) that it's more sensible as "number of rows made to reflect intent of the DML".

> ... Whether or not this involves actual "bits on disk" changing or not I cannot seem to find reference to in its documentation

Me neither. This looks like a doc clarification (and API disambiguation) opportunity.

> ..., so have no basis to argue one or way or the other.

How about both?

> ... I'm not sure there is a better way to do it (i.e. avoid the updates) than what the OP described, should SQLite not avoid it internally.

I would think that this might better be an option offered by a VFS. There is little point to doing work to avoid some byte writes if a page is dirtied elsewhere anyway and has to be written out.