cockroachdb / cockroachdb/cockroach

sql: EXPLAIN (OPT, ENV) omits routine definitions

Open
#171,406 1 comment 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.