瀏覽代碼

fix where clause generation

Sven Klemm 7 年之前
父節點
當前提交
6143924ec6
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      public/app/plugins/datasource/postgres/postgres_query.ts

+ 2 - 2
public/app/plugins/datasource/postgres/postgres_query.ts

@@ -194,7 +194,7 @@ export default class PostgresQuery {
       query += ', ' + selectText;
     }
 
-    query += ' FROM ' + target.schema + '.' + target.table + ' WHERE ';
+    query += ' FROM ' + target.schema + '.' + target.table;
     var conditions = _.map(target.where, (tag, index) => {
       switch (tag.type) {
         case 'macro':
@@ -207,7 +207,7 @@ export default class PostgresQuery {
     });
 
     if (conditions.length > 0) {
-      query += conditions.join(' AND ');
+      query += ' WHERE ' + conditions.join(' AND ');
     }
 
     var groupBySection = '';