Skip to content

Commit

Permalink
Merge #39199
Browse files Browse the repository at this point in the history
39199: sql: Fix bug where dropping table didn't drop corresponding zone config. r=rohany a=rohany

This PR also addresses a bug where when an index was dropped
the subzone corresponding to that index was left as a
hanging subzone within the system.zones table.

Fixes #38392.

Co-authored-by: Rohan Yadav <rohany@alumni.cmu.edu>
  • Loading branch information
craig[bot] and rohany committed Aug 1, 2019
2 parents b327cae + 85a0551 commit 3c9e65d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/sql/crdb_internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -1901,10 +1901,11 @@ CREATE TABLE crdb_internal.zones (
var zoneSpecifier *tree.ZoneSpecifier
zs, err := config.ZoneSpecifierFromID(id, resolveID)
if err != nil {
// The database or table has been deleted so there is no way
// to refer to it anymore. We are still going to show
// something but the CLI specifier part will become NULL.
zoneSpecifier = nil
// We can have valid zoneSpecifiers whose table/database has been
// deleted because zoneSpecifiers are collected asynchronously.
// In this case, just don't show the zoneSpecifier in the
// output of the table.
continue
} else {
zoneSpecifier = &zs
}
Expand Down

0 comments on commit 3c9e65d

Please sign in to comment.