postgres: fix value columns conversion to float when using timeseries query

(cherry picked from commit cf43007531)
This commit is contained in:
Marcus Efraimsson
2018-04-26 14:59:55 +02:00
parent ac22f85d37
commit 66938e80c9
2 changed files with 19 additions and 25 deletions
+3 -9
View File
@@ -245,16 +245,10 @@ func (e PostgresQueryEndpoint) transformToTimeSeries(query *tsdb.Query, rows *co
continue
}
switch columnValue := values[i].(type) {
case int64:
value = null.FloatFrom(float64(columnValue))
case float64:
value = null.FloatFrom(columnValue)
case nil:
value.Valid = false
default:
return fmt.Errorf("Value column must have numeric datatype, column: %s type: %T value: %v", col, columnValue, columnValue)
if value, err = tsdb.ConvertSqlValueColumnToFloat(col, values[i]); err != nil {
return err
}
if metricIndex == -1 {
metric = col
}