From 7f348f38360963d0fdbb79e35783175a28276c0b Mon Sep 17 00:00:00 2001 From: Sven Klemm Date: Sun, 15 Jul 2018 22:26:52 +0200 Subject: [PATCH] dont run queries if target has no table set --- public/app/plugins/datasource/postgres/postgres_query.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/postgres/postgres_query.ts b/public/app/plugins/datasource/postgres/postgres_query.ts index 0a172de850d..6bec3f87a85 100644 --- a/public/app/plugins/datasource/postgres/postgres_query.ts +++ b/public/app/plugins/datasource/postgres/postgres_query.ts @@ -17,7 +17,7 @@ export default class PostgresQuery { target.metricColumn = target.metricColumn || 'none'; target.groupBy = target.groupBy || []; - target.where = target.where || []; + target.where = target.where || [{ type: 'macro', params: ['$__timeFilter'] }]; target.select = target.select || [[{ type: 'column', params: ['value'] }]]; // handle pre query gui panels gracefully @@ -77,6 +77,10 @@ export default class PostgresQuery { render(interpolate?) { let target = this.target; + if (!('table' in this.target)) { + return ''; + } + if (!target.rawQuery) { target.rawSql = this.buildQuery(); }