Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
108047: sql: emit NOTICEs when implicitly dropping indexes r=chrisseto a=chrisseto **sql: emit NOTICEs when implicitly dropping indexes** Previously, users would have to either know ahead of time or later discover if an index would be implicitly dropped by dropping a column that the index referenced. At best, this was mildly surprising. At worst, workloads could be dramatically impacted without much indication as to why. To ensure implicit drops do not go unnoticed, this commit updates `ALTER TABLE ... DROP COLUMN ...` to emit NOTICEs for each implicitly dropped index. Fixes: #106907 Release note (sql change): NOTICEs are now emitted for each index dropped by an `ALTER TABLE ... DROP COLUMN ...` statement. **sql: warn users that DROP COLUMN may drop indexes** Previously, `ALTER TABLE ... DROP COLUMN ...` statements would warn users that all data held by that column would be destroyed when `sql_safe_updates = on`. Unlike the [documentation for `DROP COLUMN`](https://www.cockroachlabs.com/docs/stable/alter-table#drop-column), this message does not indicate that indexes may be dropped. This commit extends the warning to also inform users that any indexes referencing that column will also be dropped to match the warnings in our documentation. Epic: none Informs: #106907 Release note: (sql change): Attempting to drop a column when `sql_safe_updates = on` now additionally warns users that indexes referencing that column will be automatically dropped. Co-authored-by: Chris Seto <[email protected]>
- Loading branch information