Skip to content

Commit

Permalink
opt: generalize explain output for constraint checks
Browse files Browse the repository at this point in the history
This commit changes the explain output for constraint checks to
say "constraint-check" rather than "fk-check" so that it can be used
for uniqueness checks in addition to foreign key checks.

Release note (sql change): The explain output for foreign key checks
is now labeled constraint-check rather than fk-check. This change
is in preparation for adding support for unique constraint checks,
which will use the same label.
  • Loading branch information
rytaft committed Dec 21, 2020
1 parent 638c03a commit 01b34eb
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ vectorized: <hidden>
│ spans: LIMITED SCAN
│ limit: 1
└── • fk-check
└── • constraint-check
└── • error if rows
│ actual row count: 0
Expand Down
4 changes: 2 additions & 2 deletions pkg/sql/opt/exec/execbuilder/testdata/delete
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ vectorized: true
│ fk: fk_pid_ref_parent
│ input: buffer 1
└── • fk-check
└── • constraint-check
└── • error if rows
Expand Down Expand Up @@ -476,7 +476,7 @@ vectorized: true
│ fk: fk_pid_ref_parent
│ input: buffer 1
└── • fk-check
└── • constraint-check
└── • error if rows
Expand Down
68 changes: 34 additions & 34 deletions pkg/sql/opt/exec/execbuilder/testdata/fk
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ vectorized: true
│ └── • values
│ size: 2 columns, 2 rows
└── • fk-check
└── • constraint-check
└── • error if rows
Expand Down Expand Up @@ -64,7 +64,7 @@ vectorized: true
│ table: xy@primary
│ spans: FULL SCAN
└── • fk-check
└── • constraint-check
└── • error if rows
Expand Down Expand Up @@ -102,7 +102,7 @@ vectorized: true
│ └── • values
│ size: 2 columns, 2 rows
└── • fk-check
└── • constraint-check
└── • error if rows
Expand Down Expand Up @@ -146,7 +146,7 @@ vectorized: true
│ └── • values
│ size: 4 columns, 2 rows
└── • fk-check
└── • constraint-check
└── • error if rows
Expand Down Expand Up @@ -194,7 +194,7 @@ vectorized: true
│ └── • values
│ size: 4 columns, 2 rows
├── • fk-check
├── • constraint-check
│ │
│ └── • error if rows
│ │
Expand All @@ -209,7 +209,7 @@ vectorized: true
│ └── • scan buffer
│ label: buffer 1
└── • fk-check
└── • constraint-check
└── • error if rows
Expand Down Expand Up @@ -259,7 +259,7 @@ vectorized: true
│ table: parent@primary
│ spans: [/3 - /3]
├── • fk-check
├── • constraint-check
│ │
│ └── • error if rows
│ │
Expand All @@ -270,7 +270,7 @@ vectorized: true
│ └── • scan buffer
│ label: buffer 1
└── • fk-check
└── • constraint-check
└── • error if rows
Expand Down Expand Up @@ -303,7 +303,7 @@ vectorized: true
│ table: parent@primary
│ spans: [/3 - /3]
├── • fk-check
├── • constraint-check
│ │
│ └── • error if rows
│ │
Expand All @@ -314,7 +314,7 @@ vectorized: true
│ └── • scan buffer
│ label: buffer 1
├── • fk-check
├── • constraint-check
│ │
│ └── • error if rows
│ │
Expand All @@ -325,7 +325,7 @@ vectorized: true
│ └── • scan buffer
│ label: buffer 1
└── • fk-check
└── • constraint-check
└── • error if rows
Expand Down Expand Up @@ -367,7 +367,7 @@ vectorized: true
│ table: doubleparent@primary
│ spans: [/10 - /10]
└── • fk-check
└── • constraint-check
└── • error if rows
Expand Down Expand Up @@ -403,7 +403,7 @@ vectorized: true
│ spans: FULL SCAN
│ locking strength: for update
└── • fk-check
└── • constraint-check
└── • error if rows
Expand Down Expand Up @@ -442,7 +442,7 @@ vectorized: true
│ spans: [/10 - /10]
│ locking strength: for update
└── • fk-check
└── • constraint-check
└── • error if rows
Expand Down Expand Up @@ -477,7 +477,7 @@ vectorized: true
│ spans: FULL SCAN
│ locking strength: for update
├── • fk-check
├── • constraint-check
│ │
│ └── • error if rows
│ │
Expand All @@ -503,7 +503,7 @@ vectorized: true
│ table: child@child_p_idx
│ spans: FULL SCAN
└── • fk-check
└── • constraint-check
└── • error if rows
Expand Down Expand Up @@ -552,7 +552,7 @@ vectorized: true
│ spans: [/10 - /10]
│ locking strength: for update
├── • fk-check
├── • constraint-check
│ │
│ └── • error if rows
│ │
Expand All @@ -568,7 +568,7 @@ vectorized: true
│ └── • scan buffer
│ label: buffer 1
└── • fk-check
└── • constraint-check
└── • error if rows
Expand Down Expand Up @@ -610,7 +610,7 @@ vectorized: true
│ spans: FULL SCAN
│ locking strength: for update
└── • fk-check
└── • constraint-check
└── • error if rows
Expand Down Expand Up @@ -659,7 +659,7 @@ vectorized: true
│ spans: FULL SCAN
│ locking strength: for update
└── • fk-check
└── • constraint-check
└── • error if rows
Expand Down Expand Up @@ -696,7 +696,7 @@ vectorized: true
│ spans: FULL SCAN
│ locking strength: for update
└── • fk-check
└── • constraint-check
└── • error if rows
Expand Down Expand Up @@ -735,7 +735,7 @@ vectorized: true
│ spans: FULL SCAN
│ locking strength: for update
├── • fk-check
├── • constraint-check
│ │
│ └── • error if rows
│ │
Expand All @@ -751,7 +751,7 @@ vectorized: true
│ table: parent@primary
│ spans: FULL SCAN
└── • fk-check
└── • constraint-check
└── • error if rows
Expand Down Expand Up @@ -803,7 +803,7 @@ vectorized: true
│ spans: FULL SCAN
│ locking strength: for update
└── • fk-check
└── • constraint-check
└── • error if rows
Expand Down Expand Up @@ -845,7 +845,7 @@ vectorized: true
│ spans: FULL SCAN
│ locking strength: for update
└── • fk-check
└── • constraint-check
└── • error if rows
Expand Down Expand Up @@ -884,7 +884,7 @@ vectorized: true
│ spans: FULL SCAN
│ locking strength: for update
└── • fk-check
└── • constraint-check
└── • error if rows
Expand Down Expand Up @@ -1205,7 +1205,7 @@ vectorized: true
│ └── • values
│ size: 2 columns, 3 rows
└── • fk-check
└── • constraint-check
└── • error if rows
Expand Down Expand Up @@ -1244,7 +1244,7 @@ vectorized: true
│ spans: [/1 - ]
│ locking strength: for update
└── • fk-check
└── • constraint-check
└── • error if rows
Expand Down Expand Up @@ -1286,7 +1286,7 @@ vectorized: true
│ spans: [/1 - ]
│ locking strength: for update
└── • fk-check
└── • constraint-check
└── • error if rows
Expand Down Expand Up @@ -1326,7 +1326,7 @@ vectorized: true
│ table: p@primary
│ spans: [/1 - ]
└── • fk-check
└── • constraint-check
└── • error if rows
Expand Down Expand Up @@ -1381,7 +1381,7 @@ vectorized: true
│ spans: [/1 - ]
│ locking strength: for update
└── • fk-check
└── • constraint-check
└── • error if rows
Expand Down Expand Up @@ -1419,7 +1419,7 @@ vectorized: true
│ spans: [/1 - ]
│ locking strength: for update
└── • fk-check
└── • constraint-check
└── • error if rows
Expand Down Expand Up @@ -1454,7 +1454,7 @@ vectorized: true
│ table: p@primary
│ spans: [/1 - ]
└── • fk-check
└── • constraint-check
└── • error if rows
Expand Down Expand Up @@ -1505,7 +1505,7 @@ vectorized: true
│ │
│ └── • emptyrow
└── • fk-check
└── • constraint-check
└── • error if rows
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/opt/exec/explain/emit.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func Emit(plan *Plan, ob *OutputBuilder, spanFormatFn SpanFormatFn) error {
ob.LeaveNode()
}
for _, n := range plan.Checks {
ob.EnterMetaNode("fk-check")
ob.EnterMetaNode("constraint-check")
if err := walk(n); err != nil {
return err
}
Expand Down

0 comments on commit 01b34eb

Please sign in to comment.