Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: refine error message (#7159)

rebelicead6d271500c4
diff --git a/backend/plugin/advisor/code.go b/backend/plugin/advisor/code.go
index e07dbffa0a..6ff8a500a7 100644
--- a/backend/plugin/advisor/code.go
+++ b/backend/plugin/advisor/code.go
@@ -81,6 +81,7 @@ const (
NoDefault Code = 420
ColumnIsReferencedByView Code = 421
VarcharLengthExceedsLimit Code = 422
+ InvalidColumnDefault Code = 423
// 501 engine error code.
NotInnoDBEngine Code = 501
diff --git a/backend/plugin/advisor/sql_review.go b/backend/plugin/advisor/sql_review.go
index f686522387..a803f7b9d7 100644
--- a/backend/plugin/advisor/sql_review.go
+++ b/backend/plugin/advisor/sql_review.go
@@ -981,11 +981,19 @@ func convertWalkThroughErrorToAdvice(checkContext SQLReviewCheckContext, err err
Line: walkThroughError.Line,
Details: details,
})
+ case catalog.ErrorTypeInvalidColumnTypeForDefaultValue:
+ res = append(res, Advice{
+ Status: Error,
+ Code: InvalidColumnDefault,
+ Title: "Invalid column default value",
+ Content: walkThroughError.Content,
+ Line: walkThroughError.Line,
+ })
default:
res = append(res, Advice{
Status: Error,
Code: Internal,
- Title: "Failed to walk-through",
+ Title: fmt.Sprintf("Failed to walk-through with code %d", walkThroughError.Type),
Content: walkThroughError.Content,
Line: walkThroughError.Line,
})