Incorrect SOQL parsing
Issue #1798
resolved
I have the following code, utilizing a custom object Location__c with a geocoordinate field called Coordinates__c and with a related custom object called Site__c with a name, along with a latitude/longitude pair and a value for a maximum great circle distance:
Location touchLocation = Location.newInstance(latitude, longitude);
List<Location__c> locations = [ // CRUD/FLS False Positive: Location matching must take place regardless of user permissions
SELECT Id, Name, Site__c, Site__r.Name
FROM Location__c
WHERE DISTANCE(Coordinates__c, :touchLocation, 'km') < :maxDistance
ORDER BY DISTANCE(Coordinates__c, :touchLocation, 'km')
ASC LIMIT 1
];
The following errors are reported by IC2 but not by Salesforce:
<sobject field name> or GEOLOCATION expected, got ':'
ALL, FOR, GROUP, HAVING, LIMIT, OFFSET, ORDER, UPDATE or WITH expected, got ')'
The editor looks like:
Comments (4)
-
reporter -
repo owner The issue here is that I wasn't allowing a bind expression as an argument to the
DISTANCE
function. The fix will be included in the next build. -
repo owner - changed status to resolved
Delivered in 2.1.5.7.
-
repo owner - removed component
Removing component: Source Validation (automated comment)
- Log in to comment
Hmmm. I just re-generated the OST and reloaded the project. The error remains (I had to click to load the errors for that file again).