Skip to content

Commit

Permalink
sqlsmith: bring back hide_sql_constants
Browse files Browse the repository at this point in the history
Now that cockroachdb#96555 and cockroachdb#97830 are fixed, add `hide_sql_constants` back to
sqlsmith. Also add some missing spaces to the info strings.

Epic: None

Release note: None
  • Loading branch information
michae2 committed Mar 3, 2023
1 parent cd80204 commit 247abc4
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 @@ -7683,7 +7683,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 @@ -7720,7 +7720,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 247abc4

Please sign in to comment.