Context
verisimdb_temporal_versions has a non-unique partial index on (entity_id, table_name) WHERE valid_to IS NULL. Two concurrent writers can both insert a row with valid_to=NULL for the same entity.
What to do
Change the partial index to UNIQUE. Add CHECK valid_to IS NULL OR valid_to >= valid_from. Update DDL tests.
Acceptance
Context
verisimdb_temporal_versionshas a non-unique partial index on(entity_id, table_name) WHERE valid_to IS NULL. Two concurrent writers can both insert a row withvalid_to=NULLfor the same entity.What to do
Change the partial index to UNIQUE. Add CHECK
valid_to IS NULL OR valid_to >= valid_from. Update DDL tests.Acceptance
CREATE UNIQUE INDEX … WHERE valid_to IS NULLin generated DDL