News for hackers. Stuff that matters.
Re:A C parser for CREATE and ALTER table SQLite statements by evanelias on Tuesday August 15, 2023 @10:19AM (#37134325)
No, that's not how it works. If the column is used in a foreign key constraint, MySQL will prevent you from dropping the column. In that case, the ALTER statement will immediately fail with an error and take no action.

Otherwise, assuming there's no FK and it proceeds:

If the dropped column is used in any indexes, the index definitions are adjusted to no longer be keyed on that column. And if there's a single-column index on that dropped column, the index is also dropped. It's pretty much what you would always want to happen, without forcing you to needlessly indicate how the indexes need to be adjusted.

It doesn't automatically adjust any views, triggers, procs, funcs, etc that reference the column though.

There are no comments on this comment yet.