Browse Source

Fix quoting to handle non-string values

Sven Klemm 7 years ago
parent
commit
6b863e3b0f
1 changed files with 3 additions and 3 deletions
  1. 3 3
      public/app/plugins/datasource/postgres/postgres_query.ts

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

@@ -44,15 +44,15 @@ export default class PostgresQuery {
   }
 
   quoteIdentifier(value) {
-    return '"' + value.replace(/"/g, '""') + '"';
+    return '"' + String(value).replace(/"/g, '""') + '"';
   }
 
   quoteLiteral(value) {
-    return "'" + value.replace(/'/g, "''") + "'";
+    return "'" + String(value).replace(/'/g, "''") + "'";
   }
 
   escapeLiteral(value) {
-    return value.replace(/'/g, "''");
+    return String(value).replace(/'/g, "''");
   }
 
   hasTimeGroup() {