Skip to content

V-L2-H1: temporal versions need UNIQUE partial index + valid_to CHECK #41

Description

@hyperpolymath

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

  • CREATE UNIQUE INDEX … WHERE valid_to IS NULL in generated DDL
  • CHECK constraint in generated DDL
  • DDL tests assert both

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken or behaves incorrectly

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions