Fix windowing support for non-uppercased SELECT queries
This commit is contained in:
parent
0be9e47930
commit
2459aba2ba
4
NEWS.md
4
NEWS.md
@ -1,3 +1,7 @@
|
||||
1.4.1
|
||||
-----
|
||||
* Fix windowing support for non-uppercased SELECT queries
|
||||
|
||||
1.4.0
|
||||
-----
|
||||
* Add arraybuffer format
|
||||
|
@ -81,8 +81,8 @@ function sanitize_filename(filename) {
|
||||
// TODO:drop, fix in the UI (it's not documented in doc/API)
|
||||
//
|
||||
function window_sql (sql, limit, offset) {
|
||||
// only window select functions
|
||||
if (_.isNumber(limit) && _.isNumber(offset) && sql.match(/^\s*SELECT\s/) ) {
|
||||
// only window select functions (NOTE: "values" will be broken, "with" will be broken)
|
||||
if (_.isNumber(limit) && _.isNumber(offset) && sql.match(/^\s*SELECT\s/i) ) {
|
||||
return "SELECT * FROM (" + sql + ") AS cdbq_1 LIMIT " + limit + " OFFSET " + offset;
|
||||
}
|
||||
return sql;
|
||||
|
@ -163,11 +163,12 @@ function(done){
|
||||
},{ }, function(res) {
|
||||
assert.equal(res.statusCode, 200, res.body);
|
||||
assert.equal(res.headers['x-cache-channel'], 'cartodb_test_user_1_db:untitle_table_4');
|
||||
var parsed = JSON.parse(res.body);
|
||||
assert.equal(parsed.rows.length, 1);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
test('POST /api/v1/sql with SQL parameter on SELECT only. no database param, just id using headers', function(done){
|
||||
assert.response(app, {
|
||||
url: '/api/v1/sql',
|
||||
|
Loading…
Reference in New Issue
Block a user