Skip to content

Commit

Permalink
Fix database quoting problem in collector 'info_schema.tables'
Browse files Browse the repository at this point in the history
  • Loading branch information
oblitorum committed Jan 16, 2025
1 parent c407e35 commit 7899ff0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions collector/info_schema_tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package collector

import (
"context"
"fmt"
"log/slog"
"strings"

Expand All @@ -40,7 +39,7 @@ const (
ifnull(DATA_FREE, '0') as DATA_FREE,
ifnull(CREATE_OPTIONS, 'NONE') as CREATE_OPTIONS
FROM information_schema.tables
WHERE TABLE_SCHEMA = '%s'
WHERE TABLE_SCHEMA = ?
`
dbListQuery = `
SELECT
Expand Down Expand Up @@ -121,7 +120,7 @@ func (ScrapeTableSchema) Scrape(ctx context.Context, instance *instance, ch chan
}

for _, database := range dbList {
tableSchemaRows, err := db.QueryContext(ctx, fmt.Sprintf(tableSchemaQuery, database))
tableSchemaRows, err := db.QueryContext(ctx, tableSchemaQuery, database)
if err != nil {
return err
}
Expand Down

0 comments on commit 7899ff0

Please sign in to comment.