cockroachdb / cockroachdb/cockroach
stmtbundle: include transitive dependencies
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
Currently, in the stmt bundles we only include the data sources (tables, sequences, views) that are directly referenced by the metadata of the query as well as FK referencing and FK referenced tables. This can be insufficient when we have transitive dependencies:
```sql
CREATE DATABASE db_view;
USE db_view;
CREATE SCHEMA sc_seq;
CREATE SEQUENCE sc_seq.seq;
CREATE TABLE t (k INT PRIMARY KEY);
CREATE SCHEMA sc_view;
CREATE VIEW sc_view.v AS SELECT *, nextval('sc_seq.seq') FROM t;
RESET database;
CREATE DATABASE db_udf;
USE db_udf;
CREATE SCHEMA sc_udf;
CREATE FUNCTION sc_udf.f() RETURNS INT LANGUAGE SQL AS 'SELECT 1';
EXPLAIN ANALYZE (DEBUG) SELECT *, sc_udf.f() FROM db_view.sc_view.v;
```
In this example we currently forget to include CREATE statements for `sc_seq`, `sc_seq.seq`, and `db_udf` objects.
Jira issue: CRDB-45850
Contributor guide
Assessment
This issue has not been assessed yet.