Do not use dot module to build column type query

This commit is contained in:
Daniel García Aubert 2017-09-15 11:54:56 +02:00
parent 6b2e2b2241
commit 11f7b38c69

View File

@ -1,6 +1,3 @@
var dot = require('dot');
dot.templateSettings.strip = false;
function BaseDataview() {}
module.exports = BaseDataview;
@ -43,15 +40,14 @@ var DATE_OIDS = {
1184: true
};
var columnTypeQueryTpl = dot.template(
'SELECT pg_typeof({{=it.column}})::oid FROM ({{=it.query}}) _cdb_column_type limit 1'
);
var columnTypeQueryTpl = ctx => `SELECT pg_typeof(${ctx.column})::oid FROM (${ctx.query}) _cdb_column_type limit 1`;
BaseDataview.prototype.getColumnType = function (psql, column, query, callback) {
var readOnlyTransaction = true;
var columnTypeQuery = columnTypeQueryTpl({
column: column, query: query
column: column,
query: query
});
psql.query(columnTypeQuery, function(err, result) {