Skip to content

Commit

Permalink
sql/randgen: avoid invalid inverted indexes in CREATE TABLE
Browse files Browse the repository at this point in the history
Previously, the create table made via the randgen component
could create invalid CREATE TABLE statements where the last
columns of an inverted index were descending. This could
lead to unexpected failures in certain workloads, which
expected valid statements from this components. To address
this, this patch stops randgen from generating CREATE table
statements with invalid inverted indexes.

Release note: None
  • Loading branch information
fqazi committed Aug 8, 2022
1 parent 40d59b5 commit 5eb35aa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/sql/randgen/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ func RandCreateTableWithColumnIndexNumberGenerator(
if foundOverlap {
continue
}
// Inverted indexes can only be ascending on the last column.
if col.Direction == tree.Descending {
continue
}
}
// Make forward indexes unique 50% of the time. Inverted indexes cannot
// be unique.
Expand Down

0 comments on commit 5eb35aa

Please sign in to comment.