From 070b556fd39e5c4169f779aa30245ff789e17ffb Mon Sep 17 00:00:00 2001 From: Sven Klemm Date: Sun, 15 Jul 2018 17:02:26 +0200 Subject: [PATCH] dont expand variables in rawSql --- .../datasource/postgres/postgres_query.ts | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/public/app/plugins/datasource/postgres/postgres_query.ts b/public/app/plugins/datasource/postgres/postgres_query.ts index 54ce0a96e26..60838814a7f 100644 --- a/public/app/plugins/datasource/postgres/postgres_query.ts +++ b/public/app/plugins/datasource/postgres/postgres_query.ts @@ -77,22 +77,16 @@ export default class PostgresQuery { render(interpolate?) { let target = this.target; - let query; - if (target.rawQuery) { - if (interpolate) { - return this.templateSrv.replace(target.rawSql, this.scopedVars, this.interpolateQueryStr); - } else { - return target.rawSql; - } + if (!target.rawQuery) { + target.rawSql = this.buildQuery(); } - query = this.buildQuery(); if (interpolate) { - query = this.templateSrv.replace(query, this.scopedVars, this.interpolateQueryStr); + return this.templateSrv.replace(target.rawSql, this.scopedVars, this.interpolateQueryStr); + } else { + return target.rawSql; } - this.target.rawSql = query; - return query; } buildTimeColumn() {