Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

builtins: internal error from crdb_internal.hide_sql_constants #97830

Closed
michae2 opened this issue Mar 1, 2023 · 1 comment
Closed

builtins: internal error from crdb_internal.hide_sql_constants #97830

michae2 opened this issue Mar 1, 2023 · 1 comment
Assignees
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-sql-queries SQL Queries Team

Comments

@michae2
Copy link
Collaborator

michae2 commented Mar 1, 2023

Looks like the array overload of crdb_internal.hide_sql_constants is returning a string instead of an array if it can't parse one of the array elements:

demo@127.0.0.1:26257/defaultdb> SELECT crdb_internal.hide_sql_constants(ARRAY['banana']);

ERROR: internal error: invalid datum type given: string, expected string[]
SQLSTATE: XX000
DETAIL: stack trace:
github.com/cockroachdb/cockroach/pkg/sql/rowenc/encoded_datum.go:197: DatumToEncDatum()
github.com/cockroachdb/cockroach/pkg/sql/plan_node_to_row_source.go:226: Next()
github.com/cockroachdb/cockroach/pkg/sql/colexec/columnarizer.go:240: Next()
github.com/cockroachdb/cockroach/pkg/sql/colflow/stats.go:118: next()
github.com/cockroachdb/cockroach/pkg/sql/colexecerror/error.go:92: CatchVectorizedRuntimeError()
github.com/cockroachdb/cockroach/pkg/sql/colflow/stats.go:126: Next()
github.com/cockroachdb/cockroach/pkg/sql/colflow/flow_coordinator.go:253: nextAdapter()
github.com/cockroachdb/cockroach/pkg/sql/colexecerror/error.go:92: CatchVectorizedRuntimeError()
github.com/cockroachdb/cockroach/pkg/sql/colflow/flow_coordinator.go:257: next()
github.com/cockroachdb/cockroach/pkg/sql/colflow/flow_coordinator.go:295: Run()
github.com/cockroachdb/cockroach/pkg/sql/colflow/vectorized_flow.go:309: Run()
github.com/cockroachdb/cockroach/pkg/sql/distsql_running.go:863: Run()
github.com/cockroachdb/cockroach/pkg/sql/distsql_running.go:1805: PlanAndRun()
github.com/cockroachdb/cockroach/pkg/sql/distsql_running.go:1553: PlanAndRunAll()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:1663: execWithDistSQLEngine()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:1276: dispatchToExecutionEngine()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:748: execStmtInOpenState()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:135: func1()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:2551: execWithProfiling()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:134: execStmt()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1988: func1()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1993: execCmd()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1911: run()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:866: ServeConn()
github.com/cockroachdb/cockroach/pkg/sql/pgwire/conn.go:731: func1()
GOROOT/src/runtime/asm_amd64.s:1594: goexit()

I think this was introduced by #96899

Jira issue: CRDB-24905

@michae2 michae2 added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-sql-queries SQL Queries Team labels Mar 1, 2023
@michae2 michae2 self-assigned this Mar 1, 2023
@michae2 michae2 changed the title builtin: internal error from crdb_internal.hide_sql_constants builtins: internal error from crdb_internal.hide_sql_constants Mar 1, 2023
michae2 added a commit to michae2/cockroach that referenced this issue Mar 1, 2023
Fix one of the error cases of `hide_sql_constants` to append an empty
string to the array, rather than returning an empty string. Also, add
`hide_sql_constants` back to sqlsmith now that cockroachdb#96555 is fixed.

Epic: None

Fixes: cockroachdb#97830

Release note: None
@michae2
Copy link
Collaborator Author

michae2 commented Mar 3, 2023

Fixed by #97853

@michae2 michae2 closed this as completed Mar 3, 2023
michae2 added a commit to michae2/cockroach that referenced this issue Mar 3, 2023
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
craig bot pushed a commit that referenced this issue Mar 3, 2023
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>
@mgartner mgartner moved this to Done in SQL Queries Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. T-sql-queries SQL Queries Team
Projects
Archived in project
Development

No branches or pull requests

1 participant