Dolt should block column renames when another column has a default dependency on it.
- Dominant language
- Go
- Stars
- 24.4k
- Forks
- 873
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 108
Description
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
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.