Skip to content

Commit

Permalink
sqlsmith: disable NAME type in postgres mode
Browse files Browse the repository at this point in the history
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 it 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: cockroachdb#107895

Release note: None
  • Loading branch information
Mark Sirek committed Aug 15, 2023
1 parent 7c51462 commit b475856
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 b475856

Please sign in to comment.