Skip to content

test(pg-delta): add PG15+ roundtrip coverage for NULLS NOT DISTINCT unique indexes#185

Open
Copilot wants to merge 4 commits intomainfrom
copilot/add-integration-tests-unique-index-null-not-distin
Open

test(pg-delta): add PG15+ roundtrip coverage for NULLS NOT DISTINCT unique indexes#185
Copilot wants to merge 4 commits intomainfrom
copilot/add-integration-tests-unique-index-null-not-distin

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 10, 2026

PostgreSQL 15+ unique indexes can use NULLS NOT DISTINCT, which changes duplicate-NULL semantics. pg-delta already models and serializes this attribute, but it lacked end-to-end integration coverage to prove the clause survives extract → diff → apply → re-read roundtrips and directional toggles.

  • Added PG15+ roundtrip coverage

    • Covers creating a unique index with NULLS NOT DISTINCT
    • Verifies full declarative/diff roundtrip fidelity for the clause
  • Added directional toggle coverage

    • Plain unique index → same index with NULLS NOT DISTINCT
    • NULLS NOT DISTINCT unique index → plain unique index
  • Made clause loss fail loudly

    • Added inline snapshots for generated migration statements so regressions are visible at the SQL level, not just via catalog equality
  • Scope

    • Test-only change in existing index integration coverage
    • No product code changes were needed

Example covered by the new tests:

CREATE UNIQUE INDEX idx_accounts_email
  ON test_schema.accounts USING btree (email)
  NULLS NOT DISTINCT;

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 10, 2026

⚠️ No Changeset found

Latest commit: 59cd705

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copilot AI changed the title [WIP] Add integration tests for unique indexes with nulls not distinct test(pg-delta): add PG15+ roundtrip coverage for NULLS NOT DISTINCT unique indexes Apr 10, 2026
Copilot AI requested a review from avallete April 10, 2026 17:11
@avallete avallete marked this pull request as ready for review April 15, 2026 17:23
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 15, 2026

Open in StackBlitz

npm i https://pkg.pr.new/supabase/pg-toolbelt/@supabase/pg-delta@185
npm i https://pkg.pr.new/supabase/pg-toolbelt/@supabase/pg-topo@185

commit: 59cd705

@avallete avallete enabled auto-merge April 15, 2026 20:27
@avallete avallete requested a review from jgoux April 15, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pg-delta: integration tests for UNIQUE indexes with NULLS NOT DISTINCT (PG15+)

2 participants