diff --git a/pkg/sql2pgroll/create_index.go b/pkg/sql2pgroll/create_index.go index 3637a0537..f2f5b3aa5 100644 --- a/pkg/sql2pgroll/create_index.go +++ b/pkg/sql2pgroll/create_index.go @@ -100,6 +100,10 @@ func canConvertCreateIndexStmt(stmt *pgq.IndexStmt) bool { if !stmt.GetRelation().GetInh() { return false } + // Indexes with NULLS NOT DISTINCT are not supported + if stmt.GetNullsNotDistinct() { + return false + } for _, param := range stmt.GetIndexParams() { if param.GetIndexElem().GetCollation() != nil { diff --git a/pkg/sql2pgroll/create_index_test.go b/pkg/sql2pgroll/create_index_test.go index 1c7ed07d5..8e785da8a 100644 --- a/pkg/sql2pgroll/create_index_test.go +++ b/pkg/sql2pgroll/create_index_test.go @@ -144,6 +144,8 @@ func TestUnconvertableCreateIndexStatements(t *testing.T) { "CREATE INDEX idx_name ON foo (bar opclass)", // Indexes created with ONLY are not supported "CREATE INDEX idx_name ON ONLY foo (bar)", + // Indexes with NULLS NOT DISTINCT are not supported + "CREATE INDEX idx_foo ON foo(a) NULLS NOT DISTINCT", } for _, sql := range tests {