From 210e420faab4c05bf7330f1a85c86bf25b656e09 Mon Sep 17 00:00:00 2001 From: Yahor Yuzefovich Date: Mon, 20 Oct 2025 18:03:35 +0000 Subject: [PATCH] sql: add comment about skipped FKs We just made a change to include skipped FKs (those that we deemed "irrelevant") in the commented out form. This commit improves that logic by adding a comment for why these FKs are commented out, to reduce possible confusion. Release note: None --- pkg/sql/explain_bundle.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/sql/explain_bundle.go b/pkg/sql/explain_bundle.go index df8ab1038192..619bf0b28814 100644 --- a/pkg/sql/explain_bundle.go +++ b/pkg/sql/explain_bundle.go @@ -880,9 +880,12 @@ func (b *stmtBundleBuilder) addEnv(ctx context.Context) { for _, addFK := range addFKs { fmt.Fprintf(&buf, "%s;\n", addFK) } - // Include FK constraints that were skipped in commented out form. - for _, skipFK := range skipFKs { - fmt.Fprintf(&buf, "-- %s;\n", skipFK) + if len(skipFKs) > 0 { + // Include FK constraints that were skipped in commented out form. + fmt.Fprintf(&buf, "-- NOTE: these FKs are active and are only commented out for ease of bundle recreation.\n--\n") + for _, skipFK := range skipFKs { + fmt.Fprintf(&buf, "-- %s;\n", skipFK) + } } } for i := range views {