Skip to content

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

chore: add column information for syntax error advice (#7224)

rebelice1e950473e1b2
diff --git a/backend/legacyapi/task_check_run.go b/backend/legacyapi/task_check_run.go
index cae5233ca0..7fb85ea32d 100644
--- a/backend/legacyapi/task_check_run.go
+++ b/backend/legacyapi/task_check_run.go
@@ -95,6 +95,7 @@ type TaskCheckResult struct {
Title string `json:"title,omitempty"`
Content string `json:"content,omitempty"`
Line int `json:"line,omitempty"`
+ Column int `json:"column,omitempty"`
Details string `json:"details,omitempty"`
}
diff --git a/backend/plugin/advisor/advisor.go b/backend/plugin/advisor/advisor.go
index 54432e2981..750da84007 100644
--- a/backend/plugin/advisor/advisor.go
+++ b/backend/plugin/advisor/advisor.go
@@ -487,6 +487,7 @@ type Advice struct {
Title string `json:"title"`
Content string `json:"content"`
Line int `json:"line"`
+ Column int `json:"column"`
Details string `json:"details,omitempty"`
}
diff --git a/backend/plugin/advisor/sql_review.go b/backend/plugin/advisor/sql_review.go
index 6424cf3339..8dfddcf4a3 100644
--- a/backend/plugin/advisor/sql_review.go
+++ b/backend/plugin/advisor/sql_review.go
@@ -517,6 +517,7 @@ func mssqlSyntaxCheck(statement string) (any, []Advice) {
Title: SyntaxErrorTitle,
Content: syntaxErr.Message,
Line: syntaxErr.Line,
+ Column: syntaxErr.Column,
},
}
}
@@ -545,6 +546,7 @@ func snowflakeSyntaxCheck(statement string) (any, []Advice) {
Title: SyntaxErrorTitle,
Content: syntaxErr.Message,
Line: syntaxErr.Line,
+ Column: syntaxErr.Column,
},
}
}
@@ -573,6 +575,7 @@ func oracleSyntaxCheck(statement string) (any, []Advice) {
Title: SyntaxErrorTitle,
Content: syntaxErr.Message,
Line: syntaxErr.Line,
+ Column: syntaxErr.Column,
},
}
}
@@ -680,6 +683,7 @@ func mysqlSyntaxCheck(statement string) (any, []Advice) {
Title: SyntaxErrorTitle,
Content: syntaxErr.Message,
Line: syntaxErr.Line,
+ Column: syntaxErr.Column,
},
}
}
diff --git a/backend/runner/taskcheck/statement_advisor_composite_executor.go b/backend/runner/taskcheck/statement_advisor_composite_executor.go
index 05a0c4357f..8e839eeeff 100644
--- a/backend/runner/taskcheck/statement_advisor_composite_executor.go
+++ b/backend/runner/taskcheck/statement_advisor_composite_executor.go
@@ -178,6 +178,7 @@ func (e *StatementAdvisorCompositeExecutor) Run(ctx context.Context, taskCheckRu
Title: advice.Title,
Content: advice.Content,
Line: advice.Line,
+ Column: advice.Column,
Details: advice.Details,
})
}
@@ -190,6 +191,7 @@ func (e *StatementAdvisorCompositeExecutor) Run(ctx context.Context, taskCheckRu
Title: "OK",
Content: "",
Line: 0,
+ Column: 0,
Details: "",
})
}
diff --git a/backend/tests/test-data/sql_review_mysql.yaml b/backend/tests/test-data/sql_review_mysql.yaml
index 594ee18d3d..f648f4c86b 100644
--- a/backend/tests/test-data/sql_review_mysql.yaml
+++ b/backend/tests/test-data/sql_review_mysql.yaml
@@ -18,6 +18,7 @@
Syntax error at line 1:20
related text: CREATE TABLE user(id)
line: 1
+ column: 20
details: ""
run: false
- statement: CREATE TABLE userTable(id INT NOT NULL,name VARCHAR(255) CHARSET ascii,roomId INT,time_created TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE NOW() COMMENT 'comment',time_updated TIMESTAMP NOT NULL DEFAULT NOW() ON UPDATE NOW() COMMENT 'comment',content BLOB NOT NULL COMMENT 'comment',json_content JSON NOT NULL COMMENT 'comment',INDEX idx1(name),UNIQUE KEY uk1(id, name),FOREIGN KEY fk1(roomId) REFERENCES room(id),INDEX idx_userTable_content(content)) ENGINE = CSV COLLATE latin1_bin