Skip to content

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

fix: allow set opr stmt for tidb in sql editor (#14182)

h3n4le42e5f1653ad
diff --git a/backend/plugin/parser/tidb/query.go b/backend/plugin/parser/tidb/query.go
index 84a1f61ff7..ae192d782f 100644
--- a/backend/plugin/parser/tidb/query.go
+++ b/backend/plugin/parser/tidb/query.go
@@ -30,6 +30,7 @@ func validateQuery(statement string) (bool, bool, error) {
for _, stmt := range stmtList {
switch stmt := stmt.(type) {
case *tidbast.SelectStmt:
+ case *tidbast.SetOprStmt:
case *tidbast.SetStmt:
hasExecute = true
case *tidbast.ShowStmt:
diff --git a/backend/plugin/parser/tidb/query_test.go b/backend/plugin/parser/tidb/query_test.go
index 5ec2b8f847..8fd1201a3a 100644
--- a/backend/plugin/parser/tidb/query_test.go
+++ b/backend/plugin/parser/tidb/query_test.go
@@ -13,6 +13,11 @@ func TestValidateSQLForEditor(t *testing.T) {
gotAllQuery bool
err bool
}{
+ {
+ statement: "SELECT 1 UNION ALL SELECT 2;",
+ valid: true,
+ gotAllQuery: true,
+ },
{
statement: "SHOW CREATE TABLE bytebase;",
valid: true,