Skip to content
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

scpb: remove IsRelationBeingDropped fields #89086

Merged
merged 1 commit into from
Oct 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions pkg/ccl/schemachangerccl/testdata/decomp/multiregion
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ ElementState:
computeExpr: null
familyId: 0
isNullable: true
isRelationBeingDropped: false
isVirtual: false
tableId: 110
type:
Expand All @@ -186,7 +185,6 @@ ElementState:
computeExpr: null
familyId: 0
isNullable: false
isRelationBeingDropped: false
isVirtual: false
tableId: 110
type:
Expand All @@ -212,7 +210,6 @@ ElementState:
computeExpr: null
familyId: 0
isNullable: true
isRelationBeingDropped: false
isVirtual: false
tableId: 110
type:
Expand All @@ -238,7 +235,6 @@ ElementState:
computeExpr: null
familyId: 0
isNullable: true
isRelationBeingDropped: false
isVirtual: false
tableId: 110
type:
Expand Down Expand Up @@ -413,7 +409,6 @@ ElementState:
computeExpr: null
familyId: 0
isNullable: true
isRelationBeingDropped: false
isVirtual: false
tableId: 109
type:
Expand All @@ -439,7 +434,6 @@ ElementState:
computeExpr: null
familyId: 0
isNullable: false
isRelationBeingDropped: false
isVirtual: false
tableId: 109
type:
Expand All @@ -465,7 +459,6 @@ ElementState:
computeExpr: null
familyId: 0
isNullable: true
isRelationBeingDropped: false
isVirtual: false
tableId: 109
type:
Expand All @@ -491,7 +484,6 @@ ElementState:
computeExpr: null
familyId: 0
isNullable: true
isRelationBeingDropped: false
isVirtual: false
tableId: 109
type:
Expand Down Expand Up @@ -686,7 +678,6 @@ ElementState:
computeExpr: null
familyId: 0
isNullable: false
isRelationBeingDropped: false
isVirtual: false
tableId: 108
type:
Expand All @@ -713,7 +704,6 @@ ElementState:
computeExpr: null
familyId: 0
isNullable: false
isRelationBeingDropped: false
isVirtual: false
tableId: 108
type:
Expand All @@ -739,7 +729,6 @@ ElementState:
computeExpr: null
familyId: 0
isNullable: true
isRelationBeingDropped: false
isVirtual: false
tableId: 108
type:
Expand All @@ -765,7 +754,6 @@ ElementState:
computeExpr: null
familyId: 0
isNullable: true
isRelationBeingDropped: false
isVirtual: false
tableId: 108
type:
Expand All @@ -791,7 +779,6 @@ ElementState:
computeExpr: null
familyId: 0
isNullable: true
isRelationBeingDropped: false
isVirtual: false
tableId: 108
type:
Expand Down
9 changes: 0 additions & 9 deletions pkg/ccl/schemachangerccl/testdata/decomp/partitioning
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ ElementState:
computeExpr: null
familyId: 0
isNullable: false
isRelationBeingDropped: false
isVirtual: false
tableId: 104
type:
Expand All @@ -175,7 +174,6 @@ ElementState:
computeExpr: null
familyId: 0
isNullable: false
isRelationBeingDropped: false
isVirtual: false
tableId: 104
type:
Expand All @@ -201,7 +199,6 @@ ElementState:
computeExpr: null
familyId: 0
isNullable: true
isRelationBeingDropped: false
isVirtual: false
tableId: 104
type:
Expand All @@ -227,7 +224,6 @@ ElementState:
computeExpr: null
familyId: 0
isNullable: true
isRelationBeingDropped: false
isVirtual: false
tableId: 104
type:
Expand All @@ -253,7 +249,6 @@ ElementState:
computeExpr: null
familyId: 0
isNullable: true
isRelationBeingDropped: false
isVirtual: false
tableId: 104
type:
Expand Down Expand Up @@ -507,7 +502,6 @@ ElementState:
computeExpr: null
familyId: 0
isNullable: false
isRelationBeingDropped: false
isVirtual: false
tableId: 105
type:
Expand All @@ -533,7 +527,6 @@ ElementState:
computeExpr: null
familyId: 0
isNullable: true
isRelationBeingDropped: false
isVirtual: false
tableId: 105
type:
Expand All @@ -559,7 +552,6 @@ ElementState:
computeExpr: null
familyId: 0
isNullable: true
isRelationBeingDropped: false
isVirtual: false
tableId: 105
type:
Expand All @@ -585,7 +577,6 @@ ElementState:
computeExpr: null
familyId: 0
isNullable: true
isRelationBeingDropped: false
isVirtual: false
tableId: 105
type:
Expand Down
4 changes: 2 additions & 2 deletions pkg/sql/opt/exec/execbuilder/testdata/show_trace

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func DropSequence(b BuildCtx, n *tree.DropSequence) {
scpb.ForEachSequenceOwner(
undroppedBackrefs(b, seq.SequenceID),
func(_ scpb.Status, _ scpb.TargetStatus, so *scpb.SequenceOwner) {
dropElementWhenDroppingDescriptor(b, so)
b.Drop(so)
},
)
toCheckBackrefs = append(toCheckBackrefs, seq.SequenceID)
Expand Down
21 changes: 3 additions & 18 deletions pkg/sql/schemachanger/scbuild/internal/scbuildstmt/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func dropRestrictDescriptor(b BuildCtx, id catid.DescID) (hasChanged bool) {
}
undropped.ForEachElementStatus(func(_ scpb.Status, target scpb.TargetStatus, e scpb.Element) {
b.CheckPrivilege(e, privilege.DROP)
dropElementWhenDroppingDescriptor(b, e)
b.Drop(e)
})
return true
}
Expand Down Expand Up @@ -128,21 +128,6 @@ func errMsgPrefix(b BuildCtx, id catid.DescID) string {
return fmt.Sprintf("%s %q", typ, name)
}

// dropElementWhenDroppingDescriptor is a helper to drop an element when
// dropping a descriptor which sets the bit to indicate that the descriptor
// is being dropped.
//
// TODO(postamar): remove this dirty hack ASAP, see column/index dep rules.
func dropElementWhenDroppingDescriptor(b BuildCtx, e scpb.Element) {
switch t := e.(type) {
case *scpb.ColumnType:
t.IsRelationBeingDropped = true
case *scpb.SecondaryIndexPartial:
t.IsRelationBeingDropped = true
}
b.Drop(e)
}

// dropCascadeDescriptor contains the common logic for dropping something with
// CASCADE.
func dropCascadeDescriptor(b BuildCtx, id catid.DescID) {
Expand Down Expand Up @@ -190,7 +175,7 @@ func dropCascadeDescriptor(b BuildCtx, id catid.DescID) {
// Don't actually drop any elements of virtual schemas.
return
}
dropElementWhenDroppingDescriptor(b, e)
b.Drop(e)
switch t := e.(type) {
case *scpb.EnumType:
dropCascadeDescriptor(next, t.ArrayTypeID)
Expand Down Expand Up @@ -224,7 +209,7 @@ func dropCascadeDescriptor(b BuildCtx, id catid.DescID) {
*scpb.ForeignKeyConstraint,
*scpb.SequenceOwner,
*scpb.DatabaseRegionConfig:
dropElementWhenDroppingDescriptor(b, e)
b.Drop(e)
}
})
}
Expand Down
Loading