fixed sql when the query is longer than max allowed uri CDB-3077