dolt
dolt copied to clipboard
Dolt should block column renames when another column has a default dependency on it.
Consider the following table
CREATE TABLE `test` (
`pk` bigint NOT NULL,
`v2` int NOT NULL DEFAULT '100',
`v3` int DEFAULT ((`v2` + 1)),
PRIMARY KEY (`pk`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
Running the query alter table test rename column v2 to mycol
in MySQL returns the following
ERROR 3766 (HY000): Column 'v2' of table 'test' has a default value expression dependency and cannot be dropped or renamed.
The same query in Dolt successfully executes and modifies the schema
CREATE TABLE `test` (
`pk` bigint NOT NULL,
`mycol` int NOT NULL DEFAULT "100",
`v3` int DEFAULT ((mycol + 1)),
PRIMARY KEY (`pk`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
Skipped enginetest here