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

Internal error on EXPLAIN CREATE FUNCTION #96046

Closed
msirek opened this issue Jan 27, 2023 · 0 comments · Fixed by #96253
Closed

Internal error on EXPLAIN CREATE FUNCTION #96046

msirek opened this issue Jan 27, 2023 · 0 comments · Fixed by #96253
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

@msirek
Copy link
Contributor

msirek commented Jan 27, 2023

An Explain of a CREATE FUNCTION statement fails with an internal error.
Example:

EXPLAIN CREATE FUNCTION comp2() RETURNS RECORD IMMUTABLE LEAKPROOF LANGUAGE SQL AS 'SELECT ROW(1.1)';

ERROR: internal error: unhandled op 58
SQLSTATE: XX000
DETAIL: stack trace:
github.com/cockroachdb/cockroach/pkg/sql/opt/exec/explain/emit.go:269: nodeName()
github.com/cockroachdb/cockroach/pkg/sql/opt/exec/explain/emit.go:48: func1()
github.com/cockroachdb/cockroach/pkg/sql/opt/exec/explain/emit.go:66: Emit()
github.com/cockroachdb/cockroach/pkg/sql/explain_plan.go:228: emitExplain()
github.com/cockroachdb/cockroach/pkg/sql/explain_plan.go:132: startExec()
github.com/cockroachdb/cockroach/pkg/sql/plan.go:524: func2()
github.com/cockroachdb/cockroach/pkg/sql/walk.go:112: func1()
github.com/cockroachdb/cockroach/pkg/sql/walk.go:297: visitInternal()
github.com/cockroachdb/cockroach/pkg/sql/walk.go:79: visit()
github.com/cockroachdb/cockroach/pkg/sql/walk.go:43: walkPlan()
github.com/cockroachdb/cockroach/pkg/sql/plan.go:527: startExec()
github.com/cockroachdb/cockroach/pkg/sql/plan_node_to_row_source.go:173: Start()
github.com/cockroachdb/cockroach/pkg/sql/colexec/columnarizer.go:187: Init()
github.com/cockroachdb/cockroach/pkg/sql/colflow/stats.go:94: init()
github.com/cockroachdb/cockroach/pkg/sql/colexecerror/error.go:92: CatchVectorizedRuntimeError()
github.com/cockroachdb/cockroach/pkg/sql/colflow/stats.go:103: Init()
github.com/cockroachdb/cockroach/pkg/sql/colflow/flow_coordinator.go:247: func1()
github.com/cockroachdb/cockroach/pkg/sql/colexecerror/error.go:92: CatchVectorizedRuntimeError()
github.com/cockroachdb/cockroach/pkg/sql/colflow/flow_coordinator.go:246: init()
github.com/cockroachdb/cockroach/pkg/sql/colflow/flow_coordinator.go:286: Run()
github.com/cockroachdb/cockroach/pkg/sql/colflow/vectorized_flow.go:309: Run()
github.com/cockroachdb/cockroach/pkg/sql/distsql_running.go:857: Run()
github.com/cockroachdb/cockroach/pkg/sql/distsql_running.go:1793: PlanAndRun()
github.com/cockroachdb/cockroach/pkg/sql/distsql_running.go:1544: PlanAndRunAll()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:1638: execWithDistSQLEngine()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:1259: dispatchToExecutionEngine()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:744: execStmtInOpenState()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:130: func1()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:2527: execWithProfiling()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor_exec.go:129: execStmt()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1959: func1()
github.com/cockroachdb/cockroach/pkg/sql/conn_executor.go:1964: execCmd()

Jira issue: CRDB-23903

@msirek msirek 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 Jan 27, 2023
rharding6373 added a commit to rharding6373/cockroach that referenced this issue Jan 31, 2023
`EXPLAIN CREATE FUNCTION ...` now emits some output instead of failing.

Fixes cockroachdb#96046

Epic: none
Release note: none
craig bot pushed a commit that referenced this issue Jan 31, 2023
95179: changefeedccl: Add `changefeed_creation_timestamp` function r=miretskiy a=miretskiy

Add `changefeed_create_timestamp` function, which returns changefeed creation timestamp.

Changefeed transformations restrict access to some of the standard functions, including `now()`.
Without such function, it is difficult to express
changefeeds that want to emit events restricted
by time.  This function makes it possible to do
this.  For example, to create a changefeed that
emits events from the `accounts` table that
`last_withdrawal` happen starting 12 hours ago,
one could do:

```
CREATE CHANGEFEED ... AS
SELECT * FROM accounts WHERE last_withdrawal >
changefeed_create_timestamp() - interval '12 hours'
```

Epic: CRDB-17161

Release note (enterprise change): Changefeed expressions support `changefeed_create_timestamp` function.

95693: ui: fixes uri encoding for sql identifiers r=j82w a=j82w

The database, table, and index names were not properly escaped which causes the request to fail if it has a special character. The endpoint does not support names with /. This will not be an issue since all ui is being converted to sql-over-http.

part of: #94328

<img width="1016" alt="Screen Shot 2023-01-23 at 2 48 16 PM" src="https://user-images.githubusercontent.com/8868107/214447103-9a2afe69-9f1e-4bc0-9587-3f888092c547.png">

<img width="1536" alt="Screen Shot 2023-01-23 at 2 48 35 PM" src="https://user-images.githubusercontent.com/8868107/214447118-dbdeb1d7-ddbe-4cc0-b46e-d90fa4c4a61b.png">

<img width="1245" alt="Screen Shot 2023-01-23 at 2 48 52 PM" src="https://user-images.githubusercontent.com/8868107/214447178-7d1cc412-640b-4e3a-962f-173c2b2fade9.png">

Release note: none

96253: sql: explain create function op r=msirek,mgartner a=rharding6373

`EXPLAIN CREATE FUNCTION ...` now emits some output instead of failing.

Fixes #96046

Epic: none
Release note: none

Co-authored-by: Yevgeniy Miretskiy <[email protected]>
Co-authored-by: j82w <[email protected]>
Co-authored-by: rharding6373 <[email protected]>
@craig craig bot closed this as completed in 85cf1dc Jan 31, 2023
rharding6373 added a commit to rharding6373/cockroach that referenced this issue Jan 31, 2023
`EXPLAIN CREATE FUNCTION ...` now emits some output instead of failing.

Fixes cockroachdb#96046

Epic: none
Release note: none

Release justification: Low risk update that fixes a UDF bug in EXPLAIN
@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

Successfully merging a pull request may close this issue.

2 participants