You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, CRDB does not support DROP TYPE CASCADE, but we don't check for dependencies when the type is being dropped as part of a DROP SCHEMA CASCADE. This is problematic when the type is involved in a cross schema reference.
To Reproduce
[email protected]:26257/movr> create schema sc;
CREATE SCHEMA
Time: 31ms total (execution 9ms / network 22ms)
[email protected]:26257/movr> create type sc.abc as enum ('a', 'b', 'c');
CREATE TYPE
Time: 8ms total (execution 8ms / network 0ms)
[email protected]:26257/movr> create table t(k INT PRIMARY KEY, a sc.abc);
CREATE TABLE
Time: 59ms total (execution 8ms / network 52ms)
[email protected]:26257/movr> DROP SCHEMA sc;
ERROR: schema "sc" is not empty and CASCADE was not specified
SQLSTATE: 2BP01
[email protected]:26257/movr> DROP SCHEMA sc CASCADE;
DROP SCHEMA
Time: 34ms total (execution 11ms / network 23ms)
[email protected]:26257/movr> Insert into t values(1, 'a');
ERROR: type with ID 60 does not exist
SQLSTATE: 42704
Expected behavior
Similar to DROP TYPE CASCADE, the column that uses the enum being dropped should be dropped.
Additional data / screenshots
In the short term, when dropping a schema which contains types, we should ascertain that none of the types have cross schema references. If they exist, we should fail the DROP SCHEMA CASCADE, until the user manually removes the columns that use that type.
In the long term, we should really be supporting DROP TYPE CASCADE : #51480
Describe the problem
Currently, CRDB does not support
DROP TYPE CASCADE
, but we don't check for dependencies when the type is being dropped as part of aDROP SCHEMA CASCADE
. This is problematic when the type is involved in a cross schema reference.To Reproduce
Expected behavior
Similar to
DROP TYPE CASCADE
, the column that uses the enum being dropped should be dropped.Additional data / screenshots
In the short term, when dropping a schema which contains types, we should ascertain that none of the types have cross schema references. If they exist, we should fail the
DROP SCHEMA CASCADE
, until the user manually removes the columns that use that type.In the long term, we should really be supporting
DROP TYPE CASCADE
: #51480Related to: #51889
The text was updated successfully, but these errors were encountered: