2

Can anyone check and let me know if the same thing happens for you?

A bug in force.com explorer

Adding a subquery in the SELECT portion before FROM reduces the number of records returned.

Also if I add a where clause in subquery it returns some 250 records if I remove that it returns 19 records

if I remove that subquery itself it returns 267 records...

I tried the same query in workbench and it worked without any problems.

I checked the same with two of my friends in my organization and the same thing is happening for them as well.


Here is the email that I have sent to the Forcedotcom team :-

Adding a subquery with a where clause in the SELECT portion before FROM reduces the number of records returned. Ex:- This returns 267 records.

Select Id, Name, URL__c, Country__c, (select DocumentID__c,Name from DocumentBelongsTo__r limit 1) FROM Asset__c where isdeleted=false  and ((Id IN (Select Asset__c from Exchange_Customer_Asset__c where isDeleted =false and Company__c ='001Z000000ABCPx' and (Asset__r.Title__c like '%message%' or Asset__r.Name like '%message%'))) ) LIMIT 10000

where as this returns 250 records :-

Select Id, Name, URL__c, Country__c, (select DocumentID__c,Name from DocumentBelongsTo__r limit 1), (Select Id,GroupLicense__c,Company__c From CustomerAsset__r Where Company__c = '001Z000000ABCPx') //This line is added
FROM Asset__c where isdeleted=false  and ((Id IN (Select Asset__c from Exchange_Customer_Asset__c where isDeleted =false and Company__c ='001Z000000ABCPx' and (Asset__r.Title__c like '%message%' or Asset__r.Name like '%message%'))) ) LIMIT 10000

where as if I remove the where clause in the highlighted line this returns 19 records :-

Select Id, Name, URL__c, Country__c, (select DocumentID__c,Name from DocumentBelongsTo__r)

, (Select Id,GroupLicense__c,Company__c From CustomerAsset__r) //This line is added

FROM Asset__c where isdeleted=false  and ((Id IN (Select Asset__c from Exchange_Customer_Asset__c where isDeleted =false and Company__c ='001Z000000ABCPx' and (Asset__r.Title__c like '%message%' or Asset__r.Name like '%message%'))) ) LIMIT 10000

Also when I remove the where clause in highlighted line or add a limit inside the highlighted line the no. of rows changes. Everything works perfectly fine in workbench.com

How can the data returned change based on subqueries inside select clause?

*Note :- I have hardcoded ids here just for querying

4
  • 3
    Can you share the queries? It's hard to verify without the test case. Also, have you tried this with different objects? Does the bug manifest itself with different objects?
    – Mike Chale
    Commented Sep 29, 2012 at 14:43
  • 1
    Have you tried the same query/queries in the Force.com IDE in Eclipse? Commented Sep 29, 2012 at 19:25
  • Havent tried in Eclipse, but i tried in Workbench and in Developer console. Its working fine in the other 2. I have even taken screenshots along with the queries and have raised a bug and sent it to forcedotcom team. anyways will post the queries shortly
    – Sathya
    Commented Oct 1, 2012 at 5:12
  • I'm not a big fan of Force.com explorer. I suspect it has something to do with batch size. Do you have there any kind of button that you suspect invokes the queryMore() call to see if you'll obtain more results eventually? salesforce.com/us/developer/docs/api/… & salesforce.com/us/developer/docs/dbcom_soql_sosl/… - client apps should call query more on childs before moving on to call it on the parent...
    – eyescream
    Commented Oct 25, 2012 at 10:43

1 Answer 1

1

This is expected server side behavour, the server controls the size of the response to keep it within reasonable bounds (as most clients will parse the response in memory, you don't want to give the client a gigantic response). The server uses many things to decide what to return including the number & type of fields, and the total number of records returned, i.e. both the top level main records, and the child records, and the batch size hint set by the client.

In your queries you are adding additional child select queries which will increase the total number of records in the query result, and this will then affect the number of top level records in the first response. Remember that query has its counterpart queryMore to allow you to chunk through the entire resultset of your query. Remember to check the done flag on the returned queryResult.

Perhaps the force.com explorer doesn't show the queryMore option as needed, if so that's a bug. (although i don't think anyone is maintaining it these days).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .