瀏覽代碼

return values quotes for suggestions in where expression

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

+ 2 - 3
public/app/plugins/datasource/postgres/query_builder.ts

@@ -39,11 +39,10 @@ export class PostgresQueryBuilder {
   }
 
   buildValueQuery(column: string) {
-    var query = "SELECT DISTINCT " + this.queryModel.quoteIdentifier(column) + "::text";
+    var query = "SELECT DISTINCT quote_literal(" + column + ")";
     query += " FROM " + this.queryModel.quoteIdentifier(this.target.schema);
     query += "." + this.queryModel.quoteIdentifier(this.target.table);
-    query += " ORDER BY " + this.queryModel.quoteIdentifier(column);
-    query += " LIMIT 100";
+    query += " ORDER BY 1 LIMIT 100";
     return query;
   }