Context
PostgreSQL 15+ allows CREATE UNIQUE INDEX ... NULLS NOT DISTINCT, which changes how duplicate NULL values are treated compared to a plain unique index. pg-delta already models nulls_not_distinct in the index catalog, recreates indexes when that attribute changes, and emits create SQL from the captured definition.
Gap
There is no integration coverage that proves roundtrip fidelity for this feature end-to-end (catalog -> diff -> apply -> re-read). If the clause were ever dropped or mishandled, uniqueness semantics could be silently weakened without an obvious failure mode.
Proposed work
- Add PostgreSQL 15+ integration tests that cover:
- creating a unique index with
NULLS NOT DISTINCT and verifying it survives a full declarative/diff roundtrip
- transitioning between a plain unique index and the same index with
NULLS NOT DISTINCT in both directions
- Only if a test fails, adjust index modeling / serialization / apply logic so the clause is preserved consistently.
Success criteria
- Tests fail loudly if
NULLS NOT DISTINCT is lost or incorrectly toggled.
- The roundtrip no longer relies on manual inspection of generated SQL for this invariant.
Context
PostgreSQL 15+ allows
CREATE UNIQUE INDEX ... NULLS NOT DISTINCT, which changes how duplicateNULLvalues are treated compared to a plain unique index. pg-delta already modelsnulls_not_distinctin the index catalog, recreates indexes when that attribute changes, and emits create SQL from the captured definition.Gap
There is no integration coverage that proves roundtrip fidelity for this feature end-to-end (catalog -> diff -> apply -> re-read). If the clause were ever dropped or mishandled, uniqueness semantics could be silently weakened without an obvious failure mode.
Proposed work
NULLS NOT DISTINCTand verifying it survives a full declarative/diff roundtripNULLS NOT DISTINCTin both directionsSuccess criteria
NULLS NOT DISTINCTis lost or incorrectly toggled.