Skip to content

Commit

Permalink
Merge #108811
Browse files Browse the repository at this point in the history
108811: sqlsmith: disable NAME type in postgres mode r=michae2 a=msirek

The NAME type is known to have different behavior in CRDB than in postgres, in that casting to name truncates a string to 63 characters in postgres, but not in CRDB, causing sqlsmith test failures. For backwards compatibility, CRDB behavior is not being changed to match postgres, at least for now.

The fix is to prevent sqlsmith tests which use postgres mode (which implies it is comparing CRDB results with postgres) from generating NAME as a random type for testing.

Fixes: #107895

Release note: None

Co-authored-by: Mark Sirek <[email protected]>
  • Loading branch information
craig[bot] and Mark Sirek committed Aug 16, 2023
2 parents c167946 + 2f22b2a commit e0de1f1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/internal/sqlsmith/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ func (s *Smither) randType() *types.T {
(s.disableOIDs && typ.Family() == types.OidFamily) {
continue
}
if s.postgres && typ == types.Name {
// Name type in CRDB doesn't match Postgres behavior. Exclude for tests
// which compare CRDB behavior to Postgres.
continue
}
break
}
return typ
Expand Down

0 comments on commit e0de1f1

Please sign in to comment.