Skip to content

Commit 87fca44

Browse files
committed
fix(connection): enhance Discover method to handle wildcard schemas in table filtering
1 parent 90405c6 commit 87fca44

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

core/dbio/connection/connection_discover.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,13 @@ func (c *Connection) Discover(opt *DiscoverOptions) (ok bool, nodes filesys.File
224224
}
225225

226226
var table database.Table
227+
schemaHadWildcard := false
227228
level := database.SchemataLevelSchema
228229
if opt.Pattern != "" {
229230
level = database.SchemataLevelTable
230231
table, _ = database.ParseTableName(opt.Pattern, c.Type)
231232
if strings.Contains(table.Schema, "*") || strings.Contains(table.Schema, "?") {
233+
schemaHadWildcard = true
232234
table.Schema = ""
233235
}
234236
if strings.Contains(table.Name, "*") || strings.Contains(table.Name, "?") {
@@ -260,7 +262,7 @@ func (c *Connection) Discover(opt *DiscoverOptions) (ok bool, nodes filesys.File
260262
}
261263

262264
// apply filter if table is not specified
263-
if len(patterns) > 0 && table.Name == "" {
265+
if len(patterns) > 0 && (table.Name == "" || schemaHadWildcard) {
264266
schemata = schemata.Filtered(opt.Level == database.SchemataLevelColumn, patterns...)
265267
}
266268

0 commit comments

Comments
 (0)