-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: allow table and column renaming if only references are in udfs #101934
Copy link
Copy link
Open
Labels
A-sql-routineUDFs and Stored ProceduresUDFs and Stored ProceduresC-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.T-sql-queriesSQL Queries TeamSQL Queries Team
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-sql-routineUDFs and Stored ProceduresUDFs and Stored ProceduresC-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.T-sql-queriesSQL Queries TeamSQL Queries Team
Type
Projects
Status
Backlog