cockroachdb / cockroachdb/cockroach
sql: allow table and column renaming if only references are in udfs
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
Postgres allows tables and columns to be renamed using `ALTER TABLE` even if they are referenced by UDFs. For example, the following commands succeed in postgres:
```
CREATE TABLE t_twocol (a INT, b INT);
CREATE FUNCTION f_unqualified_twocol() RETURNS t_twocol AS
$$
SELECT * FROM t_twocol;
$$ LANGUAGE SQL;
-- CRDB failure: cannot rename column "a" because function "f_unqualified_twocol" depends on it
ALTER TABLE t_twocol RENAME COLUMN a TO d;
-- CRDB failure: cannot rename relation "t_twocol" because function "f_unqualified_twocol" depends on it
ALTER TABLE t_twocol RENAME TO t_twocol_prime;
```
This should be possible once we're able to rewrite queries with table and column IDs.
Jira issue: CRDB-27189
Contributor guide
Assessment
This issue has not been assessed yet.