diff --git a/pkg/sql/explain_bundle.go b/pkg/sql/explain_bundle.go index 68935656823d..2267bf2f11d3 100644 --- a/pkg/sql/explain_bundle.go +++ b/pkg/sql/explain_bundle.go @@ -888,9 +888,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 {