From 6143924ec67622192a60866d27e86f3eabc070cc Mon Sep 17 00:00:00 2001 From: Sven Klemm Date: Fri, 6 Jul 2018 10:56:47 +0200 Subject: [PATCH] fix where clause generation --- public/app/plugins/datasource/postgres/postgres_query.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/datasource/postgres/postgres_query.ts b/public/app/plugins/datasource/postgres/postgres_query.ts index 36660ecdd42..6a5a2925625 100644 --- a/public/app/plugins/datasource/postgres/postgres_query.ts +++ b/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 = '';