diff --git a/pkg/cmd/roachtest/tests/sqlsmith.go b/pkg/cmd/roachtest/tests/sqlsmith.go index 9b725df6c958..7e0aa552d33a 100644 --- a/pkg/cmd/roachtest/tests/sqlsmith.go +++ b/pkg/cmd/roachtest/tests/sqlsmith.go @@ -123,10 +123,22 @@ WITH into_db = 'defaultdb', unsafe_restore_incompatible_version; t.Status("executing setup") t.L().Printf("setup:\n%s", strings.Join(setup, "\n")) for _, stmt := range setup { + logStmt(stmt) if _, err := conn.Exec(stmt); err != nil { + if strings.Contains(err.Error(), "does not exist") { + // This is likely to be an elusive 'pq: column + // "crdb_internal_idx_expr" does not exist' error that we + // cannot reproduce. The current hypothesis is that the + // CREATE TABLE statement contains some non-visible + // characters that get lost when printing as a string, so we + // will log this statement as a sequence of integers so that + // later we can reconstruct the stmt precisely. + for _, char := range stmt { + fmt.Fprintf(smithLog, "%d ", char) + } + fmt.Fprint(smithLog, "\n\n") + } t.Fatalf("error: %s\nstatement: %s", err.Error(), stmt) - } else { - logStmt(stmt) } }