Qualify calls to cartodb extension so having it in the search_path isn't necessary

This commit is contained in:
Raúl Marín 2019-11-12 13:10:35 +01:00
parent 990aaadc16
commit 3c586caba4
6 changed files with 11 additions and 11 deletions

View File

@ -14,6 +14,7 @@ Announcements:
- Be able to set a coherent TTL in Cache-Control header to expire all resources belonging to a map simultaneously.
- When `cache buster` in request path is `0` set header `Last-Modified` to now, it avoids stalled content in 3rd party cache providers when they add `If-Modified-Since` header into the request.
- Adding a logger to MapStore (#1134)
- Qualify calls to cartodb extension so having it in the search_path isn't necessary.
## 7.2.0
Released 2019-09-30

View File

@ -8,7 +8,7 @@ var DataviewFactoryWithOverviews = require('../models/dataview/overviews/factory
const dbParamsFromReqParams = require('../utils/database-params');
var OverviewsQueryRewriter = require('../utils/overviews-query-rewriter');
var overviewsQueryRewriter = new OverviewsQueryRewriter({
zoom_level: 'CDB_ZoomFromScale(!scale_denominator!)'
zoom_level: 'cartodb.CDB_ZoomFromScale(!scale_denominator!)'
});
var dot = require('dot');

View File

@ -12,9 +12,9 @@ OverviewsMetadataBackend.prototype.getOverviewsMetadata = function (username, sq
// FIXME: Currently using internal function _cdb_schema_name
// CDB_Overviews should provide the schema information directly.
const query = `
SELECT *, _cdb_schema_name(base_table)
FROM CDB_Overviews(
CDB_QueryTablesText($windshaft$${queryUtils.substituteDummyTokens(sql)}$windshaft$)
SELECT *, cartodb._cdb_schema_name(base_table)
FROM cartodb.CDB_Overviews(
cartodb.CDB_QueryTablesText($windshaft$${queryUtils.substituteDummyTokens(sql)}$windshaft$)
);
`;
this.pgQueryRunner.run(username, query, function handleOverviewsRows(err, rows) {

View File

@ -31,11 +31,11 @@ var rendererConfig = _.defaults(global.environment.renderer || {}, {
});
rendererConfig.mapnik.queryRewriter = new OverviewsQueryRewriter({
zoom_level: 'CDB_ZoomFromScale(!scale_denominator!)'
zoom_level: 'cartodb.CDB_ZoomFromScale(!scale_denominator!)'
});
rendererConfig.mvt.queryRewriter = new OverviewsQueryRewriter({
zoom_level: 'CDB_ZoomFromScale(!scale_denominator!)'
zoom_level: 'cartodb.CDB_ZoomFromScale(!scale_denominator!)'
});
// Perform keyword substitution in statsd

View File

@ -8,7 +8,7 @@ module.exports.getQueryActualRowCount = function (query) {
};
function getQueryRowEstimation(query) {
return 'select CDB_EstimateRowCount($windshaft$' + substituteDummyTokens(query) + '$windshaft$) as rows';
return 'select cartodb.CDB_EstimateRowCount($windshaft$' + substituteDummyTokens(query) + '$windshaft$) as rows';
}
module.exports.getQueryRowEstimation = getQueryRowEstimation;

View File

@ -18,14 +18,13 @@ SET default_with_oids = false;
-- public user role
DROP USER IF EXISTS :PUBLICUSER;
CREATE USER :PUBLICUSER WITH PASSWORD ':PUBLICPASS';
GRANT USAGE ON SCHEMA cartodb TO :PUBLICUSER;
GRANT ALL ON CDB_TableMetadata TO :PUBLICUSER;
SELECT current_setting('search_path') AS my_path \gset
ALTER ROLE :PUBLICUSER SET search_path = :my_path, cartodb;
-- db owner role
DROP USER IF EXISTS :TESTUSER;
CREATE USER :TESTUSER WITH PASSWORD ':TESTPASS';
GRANT USAGE ON SCHEMA cartodb TO :TESTUSER;
GRANT ALL ON CDB_TableMetadata TO :TESTUSER;
ALTER ROLE :TESTUSER SET search_path = :my_path, cartodb;
-- regular user role 1
DROP USER IF EXISTS test_windshaft_regular1;