diff --git a/pkg/sql/randgen/schema.go b/pkg/sql/randgen/schema.go index 2d6d2f6de08d..378f744e6b09 100644 --- a/pkg/sql/randgen/schema.go +++ b/pkg/sql/randgen/schema.go @@ -544,6 +544,11 @@ func randIndexTableDefFromCols( } } + // Last column for inverted indexes must always be ascending. + if i == nCols-1 && def.Inverted { + elem.Direction = tree.Ascending + } + if !stopPrefix { prefix = append(prefix, cols[i].Name) }