diff --git a/pkg/internal/sqlsmith/relational.go b/pkg/internal/sqlsmith/relational.go index a13aaa3d3740..300d8bd91d41 100644 --- a/pkg/internal/sqlsmith/relational.go +++ b/pkg/internal/sqlsmith/relational.go @@ -14,6 +14,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/sql/randgen" "github.com/cockroachdb/cockroach/pkg/sql/sem/tree" "github.com/cockroachdb/cockroach/pkg/sql/types" + "github.com/lib/pq/oid" ) func (s *Smither) makeStmt() (stmt tree.Statement, ok bool) { @@ -235,6 +236,10 @@ func makeEquiJoinExpr(s *Smither, refs colRefs, forJoin bool) (tree.TableExpr, c for (cond == nil || s.coin()) && len(available) > 0 { v := available[0] available = available[1:] + // You can't compare voids. + if v[0].ResolvedType().Oid() == oid.T_void || v[1].ResolvedType().Oid() == oid.T_void { + continue + } expr := tree.NewTypedComparisonExpr(tree.MakeComparisonOperator(tree.EQ), v[0], v[1]) if cond == nil { cond = expr diff --git a/pkg/internal/sqlsmith/scalar.go b/pkg/internal/sqlsmith/scalar.go index 5dffa3108ef9..1f59d8db37bc 100644 --- a/pkg/internal/sqlsmith/scalar.go +++ b/pkg/internal/sqlsmith/scalar.go @@ -277,7 +277,7 @@ var compareOps = [...]tree.ComparisonOperatorSymbol{ } func makeCompareOp(s *Smither, typ *types.T, refs colRefs) (tree.TypedExpr, bool) { - if f := typ.Family(); f != types.BoolFamily && f != types.AnyFamily { + if f := typ.Family(); f != types.BoolFamily && f != types.AnyFamily && f != types.VoidFamily { return nil, false } typ = s.randScalarType()