function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Bryan WagstaffBryan Wagstaff 

SOQL command length, difference between NA1 and NA2 or other problem?

I am having an issue with my SOQL command.

I am getting a MALFORMED_QUERY exception. 

My query is a fairly straightforward, although long, select statement.  The total statement is 6428 bytes, well under the 10,000 byte limit stated in the documentation.

I have generated the same query in the sforce explorer, and it fails there too. 

Using the sforce explorer I reduced the list of criteria one at a time.  I kept removing blocks of code.  At length 4882 the query still failed.  At length 4221 it started failing.

We've been searching everything, including our version control.  We have pulled out an old version from source control dated June 14th.  We ran the tool on that date and it worked correctly.  When we attempted to run it today, it fails with the error.

One of our developers realised that something HAS changed, which is the migration to a new server.

Is anyone aware of a length problem?
Although the new servers went up and the split happened, there was no software changes released with the split. What's the error message that goes with the malformed_query exception code ?
Bryan WagstaffBryan Wagstaff
I'm not able to view the exception because it is captured inside a library that I can't debug in to.

In the sforce explorer, it gives the error message: Query failed: Input string was not in a correct format.

Again, when I reduce the size of the query by a few bytes it runs without a problem.
Bryan WagstaffBryan Wagstaff
The way I am reducing the length is by dropping fields, so it shouldn't be affecting the query in any way other than altering the number of fields showing up in the result set.  When I get the list of fields down small enough, it works great.
Are there formula fields included in the list of fields ?
There are limits on the number of formula fields you can query in one go, its not a fixed number, it depends on the complexity of the forumulas involved. Perhaps someone changed a formula which is why you're now over the complexity limit.
Bryan WagstaffBryan Wagstaff
Yes we are including them.  I've run into some other issues as well.

We are working through the SalesForce support process to get it figured out, so I'll just let the topic die until we get it figured out.  If it is appropriate for public posting, I'll describe what we discovered after we finish.