@@ -3,12 +3,12 @@ package diff
33import (
44 "errors"
55 "fmt"
6- "sort"
6+ "maps"
7+ "slices"
78 "strings"
89
910 "github.com/google/go-cmp/cmp"
1011 "github.com/stripe/pg-schema-diff/internal/schema"
11- "github.com/stripe/pg-schema-diff/internal/util"
1212)
1313
1414type materializedViewDiff struct {
@@ -45,7 +45,9 @@ func buildMaterializedViewDiff(
4545 // It's possible a dependent column was deleted (or recreated).
4646 td , ok := tableDiffsByName [t .GetName ()]
4747 if ! ok {
48- return materializedViewDiff {}, false , fmt .Errorf ("processing materialized view table dependencies: expected a table diff to exist for %q. have=\n %s" , t .GetName (), util .Keys (tableDiffsByName ))
48+ return materializedViewDiff {}, false , fmt .Errorf ("processing materialized view table dependencies: expected a table diff to exist for %q. have=\n %s" , t .GetName (),
49+ slices .Sorted (maps .Keys (tableDiffsByName )),
50+ )
4951 }
5052 deletedColumnsByName := buildSchemaObjByNameMap (td .columnsDiff .deletes )
5153 for _ , c := range t .Columns {
@@ -85,8 +87,7 @@ func (mvsg *materializedViewSQLGenerator) Add(mv schema.MaterializedView) (parti
8587 }
8688 // Sort kvs so the generated DDL is deterministic. This is unnecessarily verbose because the slices
8789 // package is not yet available.
88- // // TODO(https://github.com/stripe/pg-schema-diff/issues/227) - Remove this
89- sort .Strings (kvs )
90+ slices .Sort (kvs )
9091 materializedViewSb .WriteString (fmt .Sprintf (" WITH (%s)" , strings .Join (kvs , ", " )))
9192 }
9293 if len (mv .Tablespace ) > 0 {
0 commit comments