From 483f6cc5e1d98e87784880227933d039bf2cba27 Mon Sep 17 00:00:00 2001 From: Sven Klemm Date: Thu, 30 Aug 2018 14:11:53 +0200 Subject: [PATCH] when changing table reset columns --- public/app/plugins/datasource/postgres/query_ctrl.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/postgres/query_ctrl.ts b/public/app/plugins/datasource/postgres/query_ctrl.ts index 686907a7dc0..e2fd89898c1 100644 --- a/public/app/plugins/datasource/postgres/query_ctrl.ts +++ b/public/app/plugins/datasource/postgres/query_ctrl.ts @@ -209,12 +209,22 @@ export class PostgresQueryCtrl extends QueryCtrl { this.timeColumnSegment.html = segment.html; this.timeColumnSegment.value = segment.value; + this.target.where = []; + this.target.updatePersistedParts(); this.timeColumnChanged(); } } }); - this.panelCtrl.refresh(); + this.datasource.metricFindQuery(this.metaBuilder.buildColumnQuery('value')).then(result => { + // check if value columns are still valid + if (result.length > 0) { + this.target.select = [[{ type: 'column', params: [result[0].text] }]]; + this.target.group = []; + } + this.updateProjection(); + this.panelCtrl.refresh(); + }); } getTimeColumnSegments() {