Browse Source

dont expand variables in rawSql

Sven Klemm 7 years ago
parent
commit
070b556fd3
1 changed files with 5 additions and 11 deletions
  1. 5 11
      public/app/plugins/datasource/postgres/postgres_query.ts

+ 5 - 11
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() {