cockroachdb / cockroachdb/cockroach
sql: EXPLAIN (OPT, ENV) omits routine definitions
Open
A-sql-explain
A-sql-optimizer
A-sql-routine
branch-master
C-bug
O-agent
T-sql-queries
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
```sql
CREATE TABLE x (a INT PRIMARY KEY, b INT);
CREATE FUNCTION f() RETURNS INT VOLATILE LANGUAGE SQL AS 'SELECT count(*)::INT FROM x';
EXPLAIN (OPT, ENV) SELECT f();
```
It shows neither the definition of the table `x`, nor the defition of the udf `f`
Pre-existing limitation; reproduces on master. Relatedly, with deferred routine body building, `OPT, ENV` also drops tables referenced only inside a routine body unless scalars are shown. Related: #37402.
Jira issue: CRDB-64511
Contributor guide
Assessment
This issue has not been assessed yet.