-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sql,schemachanger: disallow dropping indexes when referenced in UDF/View #109611
sql,schemachanger: disallow dropping indexes when referenced in UDF/View #109611
Conversation
8bacd7c
to
7a4965e
Compare
This is ready for a look. CI failure is due to flaky tests unrelated to this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of minor comments but
Reviewed 9 of 9 files at r1, 6 of 6 files at r2, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @lidorcarmel and @Xiang-Gu)
-- commits
line 5 at r1:
minor typo
pkg/sql/rename_table.go
line 311 at r1 (raw file):
viewName = viewFQName.FQString() } return sqlerrors.NewDependingObjBlocksOpError(op, typeName, objName, "view", viewName)
Could we call this NewDependentBlocksOpError instead?
7a4965e
to
8e49387
Compare
This commit moves a common error message pattern "cannot drop something because something else depends on it" into sqlerrors package. Release note: None
This commits disallows schema changes to a table that would drop an index that is referenced explicitly via index hinting in a UDF or view body. Release note: None
8e49387
to
dcb2acf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TFTR!
bors r+
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @fqazi and @lidorcarmel)
pkg/sql/rename_table.go
line 311 at r1 (raw file):
Previously, fqazi (Faizan Qazi) wrote…
Could we call this NewDependentBlocksOpError instead?
Done.
🕐 Waiting for PR status (GitHub check) to be set, probably by CI. Bors will automatically try to run when all required PR statuses are set. |
Build succeeded: |
blathers backport 23.1 |
Encountered an error creating backports. Some common things that can go wrong:
You might need to create your backport manually using the backport tool. error creating merge commit from dcb2acf to blathers/backport-release-23.1-109611: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict [] you may need to manually resolve merge conflicts with the backport tool. Backport to branch 23.1 failed. See errors above. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
This PR disallows schema changes (in both legacy and declarative schema changers) that would drop indexes referenced explicitly via index hinting in UDF or view. They include
DROP INDEX
,ADD COLUMN
,DROP COLUMN
, andALTER PRIMARY KEY
.Fixes #108974
Epic: None
Release note: None