Skip to content

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

chore: throw multi error (#8944)

zll60056d1c160ee10
diff --git a/backend/plugin/advisor/mysqlwip/advisor_stmt_no_select_all.go b/backend/plugin/advisor/mysqlwip/advisor_stmt_no_select_all.go
index 59df4d3149..56bc0b6256 100644
--- a/backend/plugin/advisor/mysqlwip/advisor_stmt_no_select_all.go
+++ b/backend/plugin/advisor/mysqlwip/advisor_stmt_no_select_all.go
@@ -71,8 +71,7 @@ func (checker *noSelectAllChecker) EnterQuery(ctx *mysql.QueryContext) {
}
func (checker *noSelectAllChecker) EnterSelectItemList(ctx *mysql.SelectItemListContext) {
- // we only focus on the first MULT_OPERATOR.
- if ctx.MULT_OPERATOR() != nil && len(checker.adviceList) == 0 {
+ if ctx.MULT_OPERATOR() != nil {
checker.adviceList = append(checker.adviceList, advisor.Advice{
Status: checker.level,
Code: advisor.StatementSelectAll,
diff --git a/backend/plugin/advisor/mysqlwip/test/statement_select_no_select_all.yaml b/backend/plugin/advisor/mysqlwip/test/statement_select_no_select_all.yaml
index 3d7820b2e4..558acacbce 100644
--- a/backend/plugin/advisor/mysqlwip/test/statement_select_no_select_all.yaml
+++ b/backend/plugin/advisor/mysqlwip/test/statement_select_no_select_all.yaml
@@ -17,15 +17,23 @@
details: ""
- statement: |
SELECT a, b FROM t;
+ SELECT * FROM t;
SELECT a, b FROM (SELECT * from t1 JOIN t2) t;
want:
- status: WARN
code: 203
title: statement.select.no-select-all
content: |-
- "SELECT a, b FROM (SELECT * from t1 JOIN t2) t;" uses SELECT all
+ "SELECT * FROM t;" uses SELECT all
line: 2
details: ""
+ - status: WARN
+ code: 203
+ title: statement.select.no-select-all
+ content: |-
+ "SELECT a, b FROM (SELECT * from t1 JOIN t2) t;" uses SELECT all
+ line: 3
+ details: ""
- statement: |-
SELECT a, b FROM t;
SELECT * FROM t1
@@ -41,6 +49,15 @@
SELECT * FROM t2;" uses SELECT all
line: 2
details: ""
+ - status: WARN
+ code: 203
+ title: statement.select.no-select-all
+ content: |-
+ "SELECT * FROM t1
+ UNION
+ SELECT * FROM t2;" uses SELECT all
+ line: 4
+ details: ""
- statement: |-
SELECT a, b FROM t;
WITH cte AS (
@@ -56,6 +73,15 @@
) SELECT * FROM cte;" uses SELECT all
line: 3
details: ""
+ - status: WARN
+ code: 203
+ title: statement.select.no-select-all
+ content: |-
+ "WITH cte AS (
+ SELECT * FROM a
+ ) SELECT * FROM cte;" uses SELECT all
+ line: 4
+ details: ""
- statement: |-
SELECT a, b FROM t;
SELECT *