cockroachdb / cockroachdb/cockroach
Clarify error message when dropping a table referenced by a trigger
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
Consider the following log from my QA testing on CTEs within stored procedures:
```
demo@127.0.0.1:26257/defaultdb> show create table test_log;
table_name | create_statement
-------------+--------------------------------------------------------------
test_log | CREATE TABLE public.test_log (
| log_value INT8 NULL,
| rowid INT8 NOT VISIBLE NOT NULL DEFAULT unique_rowid(),
| CONSTRAINT test_log_pkey PRIMARY KEY (rowid ASC)
| )
(1 row)
Time: 33ms total (execution 32ms / network 1ms)
demo@127.0.0.1:26257/defaultdb> drop table test_log;
ERROR: cannot drop table test_log because other objects depend on it
SQLSTATE: 2BP01
```
This error message is doubly confusing. Not only does the show create for test_log not say anything about external references, we don't even say what kind of reference we're looking for in the error message!
Alternatively, we should allow dropping of tables referenced by triggers, which is what Postgres does.
Jira issue: CRDB-46988
Contributor guide
Assessment
This issue has not been assessed yet.