Commit ebbc0798 by Sven Klemm Committed by Torkel Ödegaard

improve error message for invalid/unknown datatypes (#10834)

parent 60b30d3e
...@@ -220,14 +220,14 @@ func (e PostgresQueryEndpoint) transformToTimeSeries(query *tsdb.Query, rows *co ...@@ -220,14 +220,14 @@ func (e PostgresQueryEndpoint) transformToTimeSeries(query *tsdb.Query, rows *co
case time.Time: case time.Time:
timestamp = float64(columnValue.UnixNano() / 1e6) timestamp = float64(columnValue.UnixNano() / 1e6)
default: default:
return fmt.Errorf("Invalid type for column time, must be of type timestamp or unix timestamp") return fmt.Errorf("Invalid type for column time, must be of type timestamp or unix timestamp, got: %T %v", columnValue, columnValue)
} }
if metricIndex >= 0 { if metricIndex >= 0 {
if columnValue, ok := values[metricIndex].(string); ok == true { if columnValue, ok := values[metricIndex].(string); ok == true {
metric = columnValue metric = columnValue
} else { } else {
return fmt.Errorf("Column metric must be of type char,varchar or text") return fmt.Errorf("Column metric must be of type char,varchar or text, got: %T %v", values[metricIndex], values[metricIndex])
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment