mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fix bug in query generation with metricColumn
This commit is contained in:
@@ -220,7 +220,7 @@ export default class PostgresQuery {
|
||||
|
||||
query += '\n ' + this.buildTimeColumn();
|
||||
if (this.hasMetricColumn()) {
|
||||
query += '\n ' + this.buildMetricColumn();
|
||||
query += ',\n ' + this.buildMetricColumn();
|
||||
}
|
||||
query += this.buildValueColumns();
|
||||
|
||||
|
||||
@@ -103,5 +103,9 @@ describe('PostgresQuery', function() {
|
||||
let query = new PostgresQuery(target, templateSrv);
|
||||
|
||||
expect(query.buildQuery()).toBe(result);
|
||||
|
||||
query.target.metricColumn = 'm';
|
||||
result = 'SELECT\n t AS "time",\n m AS metric,\n value\nFROM public.table\nORDER BY 1';
|
||||
expect(query.buildQuery()).toBe(result);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user