From 01b34ebd4d9f49ef2c5491ad42b74291f05efc18 Mon Sep 17 00:00:00 2001 From: Rebecca Taft Date: Tue, 15 Dec 2020 17:18:55 -0600 Subject: [PATCH] opt: generalize explain output for constraint checks 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. --- .../testdata/logic_test/explain_analyze_plans | 2 +- pkg/sql/opt/exec/execbuilder/testdata/delete | 4 +- pkg/sql/opt/exec/execbuilder/testdata/fk | 68 +++++++++---------- pkg/sql/opt/exec/explain/emit.go | 2 +- 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/pkg/sql/logictest/testdata/logic_test/explain_analyze_plans b/pkg/sql/logictest/testdata/logic_test/explain_analyze_plans index 0264566a5b2f..ae1edbaec97a 100644 --- a/pkg/sql/logictest/testdata/logic_test/explain_analyze_plans +++ b/pkg/sql/logictest/testdata/logic_test/explain_analyze_plans @@ -285,7 +285,7 @@ vectorized: │ spans: LIMITED SCAN │ limit: 1 │ -└── • fk-check +└── • constraint-check │ └── • error if rows │ actual row count: 0 diff --git a/pkg/sql/opt/exec/execbuilder/testdata/delete b/pkg/sql/opt/exec/execbuilder/testdata/delete index 3e2c78a0d438..37fef69ef74f 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/delete +++ b/pkg/sql/opt/exec/execbuilder/testdata/delete @@ -416,7 +416,7 @@ vectorized: true │ fk: fk_pid_ref_parent │ input: buffer 1 │ -└── • fk-check +└── • constraint-check │ └── • error if rows │ @@ -476,7 +476,7 @@ vectorized: true │ fk: fk_pid_ref_parent │ input: buffer 1 │ -└── • fk-check +└── • constraint-check │ └── • error if rows │ diff --git a/pkg/sql/opt/exec/execbuilder/testdata/fk b/pkg/sql/opt/exec/execbuilder/testdata/fk index 1ad69517cf17..d02dca60d793 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/fk +++ b/pkg/sql/opt/exec/execbuilder/testdata/fk @@ -29,7 +29,7 @@ vectorized: true │ └── • values │ size: 2 columns, 2 rows │ -└── • fk-check +└── • constraint-check │ └── • error if rows │ @@ -64,7 +64,7 @@ vectorized: true │ table: xy@primary │ spans: FULL SCAN │ -└── • fk-check +└── • constraint-check │ └── • error if rows │ @@ -102,7 +102,7 @@ vectorized: true │ └── • values │ size: 2 columns, 2 rows │ -└── • fk-check +└── • constraint-check │ └── • error if rows │ @@ -146,7 +146,7 @@ vectorized: true │ └── • values │ size: 4 columns, 2 rows │ -└── • fk-check +└── • constraint-check │ └── • error if rows │ @@ -194,7 +194,7 @@ vectorized: true │ └── • values │ size: 4 columns, 2 rows │ -├── • fk-check +├── • constraint-check │ │ │ └── • error if rows │ │ @@ -209,7 +209,7 @@ vectorized: true │ └── • scan buffer │ label: buffer 1 │ -└── • fk-check +└── • constraint-check │ └── • error if rows │ @@ -259,7 +259,7 @@ vectorized: true │ table: parent@primary │ spans: [/3 - /3] │ -├── • fk-check +├── • constraint-check │ │ │ └── • error if rows │ │ @@ -270,7 +270,7 @@ vectorized: true │ └── • scan buffer │ label: buffer 1 │ -└── • fk-check +└── • constraint-check │ └── • error if rows │ @@ -303,7 +303,7 @@ vectorized: true │ table: parent@primary │ spans: [/3 - /3] │ -├── • fk-check +├── • constraint-check │ │ │ └── • error if rows │ │ @@ -314,7 +314,7 @@ vectorized: true │ └── • scan buffer │ label: buffer 1 │ -├── • fk-check +├── • constraint-check │ │ │ └── • error if rows │ │ @@ -325,7 +325,7 @@ vectorized: true │ └── • scan buffer │ label: buffer 1 │ -└── • fk-check +└── • constraint-check │ └── • error if rows │ @@ -367,7 +367,7 @@ vectorized: true │ table: doubleparent@primary │ spans: [/10 - /10] │ -└── • fk-check +└── • constraint-check │ └── • error if rows │ @@ -403,7 +403,7 @@ vectorized: true │ spans: FULL SCAN │ locking strength: for update │ -└── • fk-check +└── • constraint-check │ └── • error if rows │ @@ -442,7 +442,7 @@ vectorized: true │ spans: [/10 - /10] │ locking strength: for update │ -└── • fk-check +└── • constraint-check │ └── • error if rows │ @@ -477,7 +477,7 @@ vectorized: true │ spans: FULL SCAN │ locking strength: for update │ -├── • fk-check +├── • constraint-check │ │ │ └── • error if rows │ │ @@ -503,7 +503,7 @@ vectorized: true │ table: child@child_p_idx │ spans: FULL SCAN │ -└── • fk-check +└── • constraint-check │ └── • error if rows │ @@ -552,7 +552,7 @@ vectorized: true │ spans: [/10 - /10] │ locking strength: for update │ -├── • fk-check +├── • constraint-check │ │ │ └── • error if rows │ │ @@ -568,7 +568,7 @@ vectorized: true │ └── • scan buffer │ label: buffer 1 │ -└── • fk-check +└── • constraint-check │ └── • error if rows │ @@ -610,7 +610,7 @@ vectorized: true │ spans: FULL SCAN │ locking strength: for update │ -└── • fk-check +└── • constraint-check │ └── • error if rows │ @@ -659,7 +659,7 @@ vectorized: true │ spans: FULL SCAN │ locking strength: for update │ -└── • fk-check +└── • constraint-check │ └── • error if rows │ @@ -696,7 +696,7 @@ vectorized: true │ spans: FULL SCAN │ locking strength: for update │ -└── • fk-check +└── • constraint-check │ └── • error if rows │ @@ -735,7 +735,7 @@ vectorized: true │ spans: FULL SCAN │ locking strength: for update │ -├── • fk-check +├── • constraint-check │ │ │ └── • error if rows │ │ @@ -751,7 +751,7 @@ vectorized: true │ table: parent@primary │ spans: FULL SCAN │ -└── • fk-check +└── • constraint-check │ └── • error if rows │ @@ -803,7 +803,7 @@ vectorized: true │ spans: FULL SCAN │ locking strength: for update │ -└── • fk-check +└── • constraint-check │ └── • error if rows │ @@ -845,7 +845,7 @@ vectorized: true │ spans: FULL SCAN │ locking strength: for update │ -└── • fk-check +└── • constraint-check │ └── • error if rows │ @@ -884,7 +884,7 @@ vectorized: true │ spans: FULL SCAN │ locking strength: for update │ -└── • fk-check +└── • constraint-check │ └── • error if rows │ @@ -1205,7 +1205,7 @@ vectorized: true │ └── • values │ size: 2 columns, 3 rows │ -└── • fk-check +└── • constraint-check │ └── • error if rows │ @@ -1244,7 +1244,7 @@ vectorized: true │ spans: [/1 - ] │ locking strength: for update │ -└── • fk-check +└── • constraint-check │ └── • error if rows │ @@ -1286,7 +1286,7 @@ vectorized: true │ spans: [/1 - ] │ locking strength: for update │ -└── • fk-check +└── • constraint-check │ └── • error if rows │ @@ -1326,7 +1326,7 @@ vectorized: true │ table: p@primary │ spans: [/1 - ] │ -└── • fk-check +└── • constraint-check │ └── • error if rows │ @@ -1381,7 +1381,7 @@ vectorized: true │ spans: [/1 - ] │ locking strength: for update │ -└── • fk-check +└── • constraint-check │ └── • error if rows │ @@ -1419,7 +1419,7 @@ vectorized: true │ spans: [/1 - ] │ locking strength: for update │ -└── • fk-check +└── • constraint-check │ └── • error if rows │ @@ -1454,7 +1454,7 @@ vectorized: true │ table: p@primary │ spans: [/1 - ] │ -└── • fk-check +└── • constraint-check │ └── • error if rows │ @@ -1505,7 +1505,7 @@ vectorized: true │ │ │ └── • emptyrow │ -└── • fk-check +└── • constraint-check │ └── • error if rows │ diff --git a/pkg/sql/opt/exec/explain/emit.go b/pkg/sql/opt/exec/explain/emit.go index 11c02eee7cae..3f0e835e7f41 100644 --- a/pkg/sql/opt/exec/explain/emit.go +++ b/pkg/sql/opt/exec/explain/emit.go @@ -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 }