Skip to content

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

feat: let sql editor support common table expression (#3736)

rebelice28cbba361769
diff --git a/server/sql.go b/server/sql.go
index 835cc988ad..6224c24a89 100644
--- a/server/sql.go
+++ b/server/sql.go
@@ -562,7 +562,7 @@ func validateSQLSelectStatement(sqlStatement string) bool {
}
// Allow SELECT and EXPLAIN queries only.
- whiteListRegs := []string{`^SELECT\s+?`, `^EXPLAIN\s+?`}
+ whiteListRegs := []string{`^SELECT\s+?`, `^EXPLAIN\s+?`, `^WITH\s+?`}
formattedStr := strings.ToUpper(strings.TrimSpace(sqlStatement))
for _, reg := range whiteListRegs {
matchResult, _ := regexp.MatchString(reg, formattedStr)