camshaft quote_columns
This commit is contained in:
parent
69afee61e0
commit
f545b4d002
1
NEWS.md
1
NEWS.md
@ -5,6 +5,7 @@ Released 2019-mm-dd
|
||||
|
||||
Announcements:
|
||||
- Removed `jshint` as linter in favour of `eslint` to check syntax, find problems, and enforce code style.
|
||||
- Upgrade `camshaft` to [`0.65.0`](https://github.com/CartoDB/camshaft/blob/9e8e5cd09dbfc6886c40f3f4a356fb7f235e82be/CHANGELOG.md#0650): Use quoted identifiers for column names.
|
||||
|
||||
## 8.0.0
|
||||
Released 2019-11-13
|
||||
|
@ -75,6 +75,15 @@ const SKIP_COLUMNS = {
|
||||
the_geom_webmercator: true
|
||||
};
|
||||
|
||||
function stripQuotes(columnName) {
|
||||
const quotedName = columnName.length > 2 && columnName[0] === '"' && columnName[columnName.length - 1] === '"';
|
||||
if (quotedName)
|
||||
{
|
||||
return columnName.substring(1, columnName.length - 1);
|
||||
}
|
||||
return columnName;
|
||||
}
|
||||
|
||||
function getColumnsName (pg, query, callback) {
|
||||
const sql = schemaQuery({
|
||||
query: query
|
||||
@ -89,7 +98,7 @@ function getColumnsName (pg, query, callback) {
|
||||
|
||||
const fields = resultSet.fields || [];
|
||||
const columnNames = fields.map(field => field.name)
|
||||
.filter(columnName => !SKIP_COLUMNS[columnName]);
|
||||
.filter(columnName => !SKIP_COLUMNS[stripQuotes(columnName)]);
|
||||
|
||||
return callback(null, columnNames);
|
||||
}, true);
|
||||
|
@ -179,6 +179,16 @@ AnalysisMapConfigAdapter.prototype.getMapConfig = function (user, requestMapConf
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
function stripQuotes(columnName) {
|
||||
const quotedName = columnName.length > 2 && columnName[0] === '"' && columnName[columnName.length - 1] === '"';
|
||||
if (quotedName)
|
||||
{
|
||||
return columnName.substring(1, columnName.length - 1);
|
||||
}
|
||||
return columnName;
|
||||
}
|
||||
|
||||
var SKIP_COLUMNS = {
|
||||
the_geom: true,
|
||||
the_geom_webmercator: true
|
||||
@ -186,7 +196,7 @@ var SKIP_COLUMNS = {
|
||||
|
||||
function skipColumns (columnNames) {
|
||||
return columnNames
|
||||
.filter(function (columnName) { return !SKIP_COLUMNS[columnName]; });
|
||||
.filter(function (columnName) { return !SKIP_COLUMNS[stripQuotes(columnName)]; });
|
||||
}
|
||||
|
||||
var wrappedQueryTpl = dot.template([
|
||||
|
146
package-lock.json
generated
146
package-lock.json
generated
@ -94,7 +94,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@carto/mapnik/-/mapnik-3.6.2-carto.16.tgz",
|
||||
"integrity": "sha512-RX8ov5EpEheToESVKiKnV5yMPLA2KxaX2ANAs9W4856oKFPdbGmB2buDz54mLhwBDfler9GVo0Bzr2ayRVLO2A==",
|
||||
"requires": {
|
||||
"mapnik-vector-tile": "github:cartodb/mapnik-vector-tile#e7ca5471f9e5de81243e6035e70444321fc0a82f",
|
||||
"mapnik-vector-tile": "github:cartodb/mapnik-vector-tile#v1.6.1-carto.2",
|
||||
"nan": "2.14.0",
|
||||
"node-pre-gyp": "0.13.0"
|
||||
}
|
||||
@ -331,14 +331,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"boom": {
|
||||
"version": "4.3.1",
|
||||
"resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz",
|
||||
"integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=",
|
||||
"requires": {
|
||||
"hoek": "4.x.x"
|
||||
}
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
@ -387,9 +379,9 @@
|
||||
"integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo="
|
||||
},
|
||||
"camshaft": {
|
||||
"version": "0.64.2",
|
||||
"resolved": "https://registry.npmjs.org/camshaft/-/camshaft-0.64.2.tgz",
|
||||
"integrity": "sha512-BWXD8zoKmVaHZHAVFUVM/VrlXNQ+lcJFQSDSFcljRS4Yj4yuyEOs22DyULEI0dq3Xnkhwx14gUlhuFd/PgFxbA==",
|
||||
"version": "0.65.0",
|
||||
"resolved": "https://registry.npmjs.org/camshaft/-/camshaft-0.65.0.tgz",
|
||||
"integrity": "sha512-oOUQId9H/8zRH2dQPQ30D0dV+6O9iOxQiDm5KFkI2HnKFSq1lhwbU+WLi+etmg3HZpM3GfxeC3dlJelog5kxoQ==",
|
||||
"requires": {
|
||||
"async": "^1.5.2",
|
||||
"bunyan": "1.8.1",
|
||||
@ -397,45 +389,16 @@
|
||||
"cartodb-query-tables": "^0.6.1",
|
||||
"debug": "^3.1.0",
|
||||
"dot": "^1.0.3",
|
||||
"request": "2.85.0"
|
||||
"request": "^2.85.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"cartodb-query-tables": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/cartodb-query-tables/-/cartodb-query-tables-0.6.1.tgz",
|
||||
"integrity": "sha512-hQR9F5tQ6W6uGZk8Us/0fwkAsvYfbsHUzyKqBqDYue+jOa7FrGS+KpWokdLYHhR/ye3N3iR9RBTrIkwp6aoUww==",
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmjs.org/cartodb-query-tables/-/cartodb-query-tables-0.6.3.tgz",
|
||||
"integrity": "sha512-ijHl2Roh+0B1pP8SL3guEAu8tE6yNN3J/oxdUWCFOSKjHmXjwTzyJdjO+tONGcERmlWfS594SCFYElGIweSnQg==",
|
||||
"requires": {
|
||||
"decimal.js": "10.2.0"
|
||||
}
|
||||
},
|
||||
"request": {
|
||||
"version": "2.85.0",
|
||||
"resolved": "https://registry.npmjs.org/request/-/request-2.85.0.tgz",
|
||||
"integrity": "sha512-8H7Ehijd4js+s6wuVPLjwORxD4zeuyjYugprdOXlPSqaApmL/QOy+EB/beICHVCHkGMKNh5rvihb5ov+IDw4mg==",
|
||||
"requires": {
|
||||
"aws-sign2": "~0.7.0",
|
||||
"aws4": "^1.6.0",
|
||||
"caseless": "~0.12.0",
|
||||
"combined-stream": "~1.0.5",
|
||||
"extend": "~3.0.1",
|
||||
"forever-agent": "~0.6.1",
|
||||
"form-data": "~2.3.1",
|
||||
"har-validator": "~5.0.3",
|
||||
"hawk": "~6.0.2",
|
||||
"http-signature": "~1.2.0",
|
||||
"is-typedarray": "~1.0.0",
|
||||
"isstream": "~0.1.2",
|
||||
"json-stringify-safe": "~5.0.1",
|
||||
"mime-types": "~2.1.17",
|
||||
"oauth-sign": "~0.8.2",
|
||||
"performance-now": "^2.1.0",
|
||||
"qs": "~6.5.1",
|
||||
"safe-buffer": "^5.1.1",
|
||||
"stringstream": "~0.0.5",
|
||||
"tough-cookie": "~2.3.3",
|
||||
"tunnel-agent": "^0.6.0",
|
||||
"uuid": "^3.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -491,7 +454,7 @@
|
||||
},
|
||||
"carto": {
|
||||
"version": "github:cartodb/carto#85881d99dd7fcf2c4e16478b04db67108d27a50c",
|
||||
"from": "github:cartodb/carto#0.15.1-cdb5",
|
||||
"from": "github:cartodb/carto#master",
|
||||
"requires": {
|
||||
"mapnik-reference": "~6.0.2",
|
||||
"optimist": "~0.6.0",
|
||||
@ -519,7 +482,7 @@
|
||||
"integrity": "sha512-myLV2xo3q9oTT8m8M+c+UTD/ziDN7hrYtZ9yY00KvMnu2NsVeRQsTe8Yxq1GVS8vF9iYfcelwjVEGObPUdLtHw==",
|
||||
"requires": {
|
||||
"debug": "^3.1.0",
|
||||
"pg": "github:cartodb/node-postgres#5417d7b29b7272ca2e71bb396899ab3f177a9ae6",
|
||||
"pg": "github:cartodb/node-postgres#6.4.2-cdb2",
|
||||
"underscore": "~1.6.0"
|
||||
}
|
||||
},
|
||||
@ -729,24 +692,6 @@
|
||||
"which": "^1.2.9"
|
||||
}
|
||||
},
|
||||
"cryptiles": {
|
||||
"version": "3.1.4",
|
||||
"resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.4.tgz",
|
||||
"integrity": "sha512-8I1sgZHfVwcSOY6mSGpVU3lw/GSIZvusg8dD2+OGehCJpOhQRLNcH0qb9upQnOH4XhgxxFJSg6E2kx95deb1Tw==",
|
||||
"requires": {
|
||||
"boom": "5.x.x"
|
||||
},
|
||||
"dependencies": {
|
||||
"boom": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz",
|
||||
"integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==",
|
||||
"requires": {
|
||||
"hoek": "4.x.x"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"d3": {
|
||||
"version": "3.5.17",
|
||||
"resolved": "https://registry.npmjs.org/d3/-/d3-3.5.17.tgz",
|
||||
@ -2722,7 +2667,7 @@
|
||||
"carto": "0.16.3",
|
||||
"debug": "~3.1.0",
|
||||
"generic-pool": "~2.2.0",
|
||||
"millstone": "github:cartodb/millstone#eeeb308fba4586343bb848fbf8ae0d180192627d",
|
||||
"millstone": "github:cartodb/millstone#v0.6.17-carto.3",
|
||||
"postcss": "~5.2.8",
|
||||
"postcss-scss": "0.4.0",
|
||||
"postcss-strip-inline-comments": "0.1.5",
|
||||
@ -2883,17 +2828,6 @@
|
||||
"resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",
|
||||
"integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk="
|
||||
},
|
||||
"hawk": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz",
|
||||
"integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==",
|
||||
"requires": {
|
||||
"boom": "4.x.x",
|
||||
"cryptiles": "3.x.x",
|
||||
"hoek": "4.x.x",
|
||||
"sntp": "2.x.x"
|
||||
}
|
||||
},
|
||||
"he": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz",
|
||||
@ -2909,11 +2843,6 @@
|
||||
"nan": "^2.3.4"
|
||||
}
|
||||
},
|
||||
"hoek": {
|
||||
"version": "4.2.1",
|
||||
"resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz",
|
||||
"integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA=="
|
||||
},
|
||||
"hosted-git-info": {
|
||||
"version": "2.8.5",
|
||||
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.5.tgz",
|
||||
@ -4628,14 +4557,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"sntp": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz",
|
||||
"integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==",
|
||||
"requires": {
|
||||
"hoek": "4.x.x"
|
||||
}
|
||||
},
|
||||
"source-map": {
|
||||
"version": "0.5.7",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
|
||||
@ -4775,11 +4696,6 @@
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
|
||||
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ="
|
||||
},
|
||||
"stringstream": {
|
||||
"version": "0.0.6",
|
||||
"resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.6.tgz",
|
||||
"integrity": "sha512-87GEBAkegbBcweToUrdzf3eLhWNg06FJTebl4BVJz/JgWy8CvEr9dRtX5qWphiynMSQlxxi+QqN0z5T32SLlhA=="
|
||||
},
|
||||
"strip-ansi": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
|
||||
@ -4935,26 +4851,10 @@
|
||||
"resolved": "https://registry.npmjs.org/torque.js/-/torque.js-3.1.1.tgz",
|
||||
"integrity": "sha512-kfIrmI7TGqJT/J9DH8Mgvd9VEwcvAtnvyYyqymSN6WZ5L4BaVQEQ+zu5FgLChNAqCaRkqGc7bKp0Hj9A0rempA==",
|
||||
"requires": {
|
||||
"carto": "github:cartodb/carto#85881d99dd7fcf2c4e16478b04db67108d27a50c",
|
||||
"carto": "github:cartodb/carto#master",
|
||||
"d3": "3.5.17",
|
||||
"turbo-carto": "^0.21.1",
|
||||
"turf-jenks": "~1.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"carto": {
|
||||
"version": "github:cartodb/carto#85881d99dd7fcf2c4e16478b04db67108d27a50c",
|
||||
"from": "github:cartodb/carto#master",
|
||||
"requires": {
|
||||
"mapnik-reference": "~6.0.2",
|
||||
"optimist": "~0.6.0",
|
||||
"underscore": "1.8.3"
|
||||
}
|
||||
},
|
||||
"underscore": {
|
||||
"version": "1.8.3",
|
||||
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz",
|
||||
"integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI="
|
||||
}
|
||||
}
|
||||
},
|
||||
"tough-cookie": {
|
||||
@ -5155,7 +5055,7 @@
|
||||
"@carto/cartonik": "^0.7.0",
|
||||
"@carto/mapnik": "3.6.2-carto.16",
|
||||
"canvas": "^2.4.1",
|
||||
"carto": "github:cartodb/carto#85881d99dd7fcf2c4e16478b04db67108d27a50c",
|
||||
"carto": "github:cartodb/carto#0.15.1-cdb5",
|
||||
"cartodb-psql": "^0.14.0",
|
||||
"cartodb-query-tables": "^0.6.1",
|
||||
"debug": "3.1.0",
|
||||
@ -5166,6 +5066,15 @@
|
||||
"torque.js": "3.1.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"carto": {
|
||||
"version": "github:cartodb/carto#85881d99dd7fcf2c4e16478b04db67108d27a50c",
|
||||
"from": "github:cartodb/carto#0.15.1-cdb5",
|
||||
"requires": {
|
||||
"mapnik-reference": "~6.0.2",
|
||||
"optimist": "~0.6.0",
|
||||
"underscore": "1.8.3"
|
||||
}
|
||||
},
|
||||
"cartodb-query-tables": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmjs.org/cartodb-query-tables/-/cartodb-query-tables-0.6.3.tgz",
|
||||
@ -5173,6 +5082,11 @@
|
||||
"requires": {
|
||||
"decimal.js": "10.2.0"
|
||||
}
|
||||
},
|
||||
"underscore": {
|
||||
"version": "1.8.3",
|
||||
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz",
|
||||
"integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI="
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -5332,9 +5246,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"glob": {
|
||||
"version": "7.1.5",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.5.tgz",
|
||||
"integrity": "sha512-J9dlskqUXK1OeTOYBEn5s8aMukWMwWfs+rPTn/jn50Ux4MNXVhubL1wu/j2t+H4NVI+cXEcCaYellqaPVGXNqQ==",
|
||||
"version": "7.1.6",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
|
||||
"integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
|
||||
"requires": {
|
||||
"fs.realpath": "^1.0.0",
|
||||
"inflight": "^1.0.4",
|
||||
|
@ -27,7 +27,7 @@
|
||||
"@carto/fqdn-sync": "0.2.2",
|
||||
"basic-auth": "2.0.0",
|
||||
"body-parser": "1.18.3",
|
||||
"camshaft": "^0.64.2",
|
||||
"camshaft": "^0.65.0",
|
||||
"cartodb-psql": "0.14.0",
|
||||
"cartodb-query-tables": "^0.7.0",
|
||||
"cartodb-redis": "2.1.0",
|
||||
|
Loading…
Reference in New Issue
Block a user