Skip to content

Commit

Permalink
Merge #97831
Browse files Browse the repository at this point in the history
97831: sqlsmith: bring back hide_sql_constants r=rharding6373 a=michae2

Now that #96555 and #97830 are fixed, add `hide_sql_constants` back to sqlsmith. Also add some missing spaces to the info strings.

Epic: None

Release note: None

Co-authored-by: Michael Erickson <michae2@cockroachlabs.com>
  • Loading branch information
craig[bot] and michae2 committed Mar 3, 2023
2 parents 6e547d4 + 247abc4 commit 007f794
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 0 additions & 3 deletions pkg/internal/sqlsmith/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -521,9 +521,6 @@ var functions = func() map[tree.FunctionClass]map[oid.Oid][]function {
"crdb_internal.revalidate_unique_constraint",
"crdb_internal.request_statement_bundle",
"crdb_internal.set_compaction_concurrency",
// TODO(96555): Temporarily disable crdb_internal.hide_sql_constants,
// which produces internal errors for some valid inputs.
"crdb_internal.hide_sql_constants",
// TODO(#97097): Temporarily disable crdb_internal.fingerprint
// which produces internal errors for some valid inputs.
"crdb_internal.fingerprint",
Expand Down
5 changes: 5 additions & 0 deletions pkg/sql/logictest/testdata/logic_test/builtin_function
Original file line number Diff line number Diff line change
Expand Up @@ -3736,6 +3736,11 @@ SELECT crdb_internal.hide_sql_constants(ARRAY('select 1', NULL, 'select ''hello'
----
{"SELECT _",NULL,"SELECT '_'","",""}

query T
SELECT crdb_internal.hide_sql_constants(ARRAY['banana'])
----
{""}

query T
SELECT crdb_internal.hide_sql_constants('SELECT ''yes'' IN (''no'', ''maybe'', ''yes'')')
----
Expand Down
4 changes: 2 additions & 2 deletions pkg/sql/sem/builtins/builtins.go
Original file line number Diff line number Diff line change
Expand Up @@ -7684,7 +7684,7 @@ expires until the statement bundle is collected`,
return tree.NewDString(sqlNoConstants), nil
},
types.String,
"Removes constants from a SQL statement. String provided must contain at most"+
"Removes constants from a SQL statement. String provided must contain at most "+
"1 statement.",
volatility.Immutable,
),
Expand Down Expand Up @@ -7721,7 +7721,7 @@ expires until the statement bundle is collected`,

return result, nil
},
Info: "Hide constants for each element in an array of SQL statements." +
Info: "Hide constants for each element in an array of SQL statements. " +
"Note that maximum 1 statement is permitted per string element.",
Volatility: volatility.Immutable,
},
Expand Down

0 comments on commit 007f794

Please sign in to comment.