fix(inputs.sql): cast measurement_column to string (#12323)
This commit is contained in:
parent
f2729298ed
commit
ad780bb1eb
|
|
@ -81,8 +81,12 @@ func (q *Query) parse(acc telegraf.Accumulator, rows *dbsql.Rows, t time.Time) (
|
||||||
|
|
||||||
for i, name := range columnNames {
|
for i, name := range columnNames {
|
||||||
if q.MeasurementColumn != "" && name == q.MeasurementColumn {
|
if q.MeasurementColumn != "" && name == q.MeasurementColumn {
|
||||||
var ok bool
|
switch raw := columnData[i].(type) {
|
||||||
if measurement, ok = columnData[i].(string); !ok {
|
case string:
|
||||||
|
measurement = raw
|
||||||
|
case []byte:
|
||||||
|
measurement = string(raw)
|
||||||
|
default:
|
||||||
return 0, fmt.Errorf("measurement column type \"%T\" unsupported", columnData[i])
|
return 0, fmt.Errorf("measurement column type \"%T\" unsupported", columnData[i])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue