Skip to content

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

fix(query-span): allow cross database query for TiDB (#11399)

h3n4l4e22817e5c26
diff --git a/backend/plugin/parser/tidb/query_span_extractor.go b/backend/plugin/parser/tidb/query_span_extractor.go
index 7289ad1295..0d97f07477 100644
--- a/backend/plugin/parser/tidb/query_span_extractor.go
+++ b/backend/plugin/parser/tidb/query_span_extractor.go
@@ -571,13 +571,10 @@ func (q *querySpanExtractor) getAllTableColumnSources(databaseName, tableName st
func (q *querySpanExtractor) getFieldColumnSource(databaseName, tableName, fieldName string) (base.SourceColumnSet, bool) {
findInTableSource := func(tableSource base.TableSource) (base.SourceColumnSet, bool) {
- if databaseName != "" && databaseName != tableSource.GetDatabaseName() {
+ if databaseName != "" && !strings.EqualFold(databaseName, tableSource.GetDatabaseName()) {
return nil, false
}
- if databaseName == "" && tableSource.GetDatabaseName() != "" && tableSource.GetDatabaseName() != q.connectedDB {
- return nil, false
- }
- if tableName != "" && tableName != tableSource.GetTableName() {
+ if tableName != "" && !strings.EqualFold(tableName, tableSource.GetTableName()) {
return nil, false
}
// If the table name is empty, we should check if there are ambiguous fields,