On Thu, 13 Dec 2018 16:06:04 -0700
"Keith Medcalf" <kmedc...@dessus.com> wrote:

> You cannot do that.  The PRIMARY KEY is required to be unique at each
> "step" along the way, 

For the OP's benefit, this is  longstanding, er, idiosyncrasy of
SQLite.  It does not conform to the SQL standard.  

The SQL rule is there are no "steps".  Each statement is atomic; it is
either executed entirely or not at all.  The contraints on the table
apply to the *user-visible* view of the data: before the update begins,
and after it finishes. They do not apply during the time the DBMS is
updating the data, however it chooses to do so.  

> Letting alone why anyone would want to do such a thing

The following is legal in SQL for a unique column, 

        update T set a = a +1

*regardless* of the values in "a".  SQLite is the only DBMS I'm aware
of that prevents the update if "a" is unique and holds consecutive
values.  

That kind of update is neither absurd nor unusual.  An obvious example
is updating all records by 1 day (perhaps because originally
misrecorded).  

--jkl
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to