fix: add missing nulls_not_distinct property to IndexStmt transformer #199
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix: add missing nulls_not_distinct property to IndexStmt transformer
Summary
Fixed a transformer issue where CREATE INDEX statements with
NULLS NOT DISTINCTclause were failing in the PostgreSQL v15-to-v16 transformer. TheIndexStmttransformer was missing thenulls_not_distinctproperty handling, causing test cases likecreate_index-72.sqlto be skipped.Changes:
nulls_not_distinctproperty handling to theIndexStmttransformer inv15-to-v16.tstransformer-errors.tsReview & Testing Checklist for Human
Risk Level: 🟡 Medium - Simple change following established patterns, but limited validation of SQL syntax and type definitions
nulls_not_distinctproperty exists in both PG15 and PG16IndexStmttype definitions in the schema fileslatest/postgres/create_index-72.sql) to understand the exact CREATE INDEX syntax being transformedIndexStmttransformer with similar transformers (likeConstraint) to see if other properties are missingCREATE UNIQUE INDEX idx ON tbl (col) NULLS NOT DISTINCTsyntax and verify it transforms correctlyDiagram
%%{ init : { "theme" : "default" }}%% graph TD subgraph "Transform Package" V15ToV16["packages/transform/src/transformers/v15-to-v16.ts"]:::major-edit Errors["packages/transform/test-utils/skip-tests/transformer-errors.ts"]:::minor-edit Tests["packages/transform/__tests__/kitchen-sink/15-16/latest-postgres-create_index.test.ts"]:::context end subgraph "SQL Test Files" SQL72["latest/postgres/create_index-72.sql"]:::context SQL83["latest/postgres/create_index-83.sql"]:::context SQL85["latest/postgres/create_index-85.sql"]:::context SQL184["latest/postgres/create_index-184.sql"]:::context end V15ToV16 -->|"transforms"| SQL72 V15ToV16 -->|"transforms"| SQL83 V15ToV16 -->|"transforms"| SQL85 V15ToV16 -->|"transforms"| SQL184 Tests -->|"runs"| SQL72 Tests -->|"runs"| SQL83 Tests -->|"runs"| SQL85 Tests -->|"runs"| SQL184 Errors -->|"controls skipping"| Tests subgraph Legend L1["Major Edit"]:::major-edit (green) L2["Minor Edit"]:::minor-edit (blue) L3["Context/No Edit"]:::context (white) end classDef major-edit fill:#90EE90 classDef minor-edit fill:#87CEEB classDef context fill:#FFFFFFNotes
Constrainttransformer wherenulls_not_distinctis already properly handledNULLS NOT DISTINCTis a PostgreSQL feature for unique indexes that treats NULL values as distinct from each other