v0.17.1
Fixed
-
A scaled world left the identity sequence pointing at rows that came back,
a regression introduced by 0.17.0 and found by the consumer that prompted it.0.17.0 made
scaled_worldempty the tables its shape declares, so a session
world could sit under one, and the rows come back because the emptying happens
inside the transaction it rolls back. The sequence does not:setvalis
not transactional, so the counter kept whatever the scaled build moved it to.
A scaled world is usually smaller than the session world it was built over,
which left the counter below the ids that had just returned.The symptom was an
IntegrityErroron a primary key, in a later test, for a
row the failing test never wrote.The sequences are now recomputed once the transaction has ended -- from
max(pk)of whatever actually survived, rather than from a number captured on
the way in, so it is correct in both directions and correct too when the
caller's block raised partway through the build.The Postgres statement-count constant moved from 17 to 19: one reset per
declared table, a property of the declaration rather than the factor, so what
those tests pin is unchanged. The portable constant did not move, because
Django emits no sequence reset for a SQLite table withoutAUTOINCREMENT.