I have queries that haven’t changed and were worki...
# suiteql
j
I have queries that haven’t changed and were working fine up until quite recently (last month at least they were working) and now are failing with “invalid or unsupported search”. I’ve narrowed down the issue to two particular columns I’m trying to retrieve. My query itself is super complex (lots of subquery logic, all mostly custom fields/ records) so I won’t paste it here, but basically I can do
SELECT a FROM
<whatever> and I can do
SELECT b FROM
<whatever> and both of those work, but if I do
SELECT a, b FROM
<whatever> I get the “invalid or unsupported search”. Has anyone encountered anything similar?
a and b aren’t interdependent in any way.
m
I unexpectedly started receiving SSS_SEARCH_ERROR_OCCURRED errors on 4/15. In my particular instance, my problem was with the performance of a specific subquery. I was regularly observing ~7sec execution times for my complete query -- but some unknown change (around 4/15) increased the same execution time to around 100sec. The error stopped once I deleted the offending subquery.
Our experiences are different, but the timing is conspicuous. Possibly a larger change to the query planner?
j
but it’s super weird that my query itself works fine if I get one field or the other….
at least I’m not the only one having problems, I don’t feel so alone
s
are "a" and "b" native fields from a native table? Also, what suitescript query command are you using?
Is it possible for you to provide a reproducible example (without IP stuff) we could try on different accounts to see the issue first hand?
j
everything is custom fields so not really
s
understood. what query command are you using?
j
not sure what you mean. it’s basically SELECT <columns> FROM <stuff> WHERE <things>
but with like… a bajillion layers of nesting and subqueries
but I stripped it right down as much as possible and still getting the same issue.
for context, the original query looks like this hahhah. It’s a bit terrifying TBH.
s
are you using query.runSuiteQL or query.runSuiteQLPaged? which ever one your are presently using, try the other to see if there results are different.
are you using grouping or Builtin.XXXX (like: builtin.DF(fieldname) on either one of those two fields?
j
I get the same error with paged or nonpaged (there are only about 40 expected results).
one of the fields is a long text so the reason it’s in the outer query is because it explicitly CANNOT be grouped, so I’m using a sub-select to get it. Something like
SELECT a, (SELECT b1 FROM <stuff> WHERE <otherstuff>) AS b
but it works fine if I’m not also getting
a
(and vice-versa).
a
is in the
GROUP BY
no builtins on these fields.
if I try to get another field in the subselect (one that isn’t a long text) it still fails.
s
I have noticed similar issues. Adjusting the query is your best option. maybe try to run a function on the column to convert it. to_char().
j
it’s just weird, it was working fine last week
NS must have changed SOMETHING
and I don’t get why the fact that another unrelated column also being in the same SELECT would matter.
there’s tons of other columns in there too, no issues with any of them
just this one combo it doesn’t like
s
I would keep attacking it with different tweaks. try substring the long text. try to_char(). Again, I have seen similar random issues before.
j
Appreciate all the help, I’ll keep trying. I’ve just been stuck for a day and half and still completely baffled. Doesn’t help that it takes almost a minute to try to run before failing. I’ve submitted a ticket.
s
Is that running the query ad-hoc?
j
what do you mean?
s
how does it run?
within a script?
j
I have a tool I created ages ago, similar to Tim Dietrich’s one.
but it fails anywhere I try it
I’m doing my debugging/testing in my tool tho
s
Limit the rows in the query to speed it up. also, keep cutting down the query until you only have the minimum that fails.
j
I did
I limited to one expected result
I tried with different source data sets (differnet vendors as the starting point)
it’s not the data itself, I can confirm that because I can run it in two halves and combine it, so long as both halves don’t have both a AND b
(in the SELECT)
again, this was working fine up till this week.
s
NS most likely changes something in their views / data definition. sorry I could not help you solve it. Please keep us posted, we would love to know the outcome.
j
will do
again I really appreciate all your suggestions!
🙏 1
it’s a weird one, for sure
but I always have the weird problems 😉
😁 1
c
Are you sure you are running with correct permissions? Did NetSuite change or did the role change by chance? If you're running as admin it's not going to be the role at least.
j
I’m admin.
c
I'm running into similar issues. In one case, it started happening at the end of March and only in one of our client accounts. Same exact query works fine in 30 other accounts, but in this one account it was failing. The solution was to alias two of the columns that we had referenced in an ORDER BY clause. NetSuite support has been unhelpful in determining the root cause. This was their response: "The specific error message “Search error occurred: Invalid or unsupported search” is a strong indicator that the query planner is not executing the statement as a pure SQL query. Instead, it is being translated into a NetSuite search or summary-style execution path. In this mode, sorting behavior becomes more restrictive compared to standard SQL, particularly when a
GROUP BY
clause is involved. Additionally, while this error can sometimes indicate a performance-related issue, such as inefficient sorting or a poorly structured query, our review of the backend logs did not show any signs of performance degradation in this case." That response does not explain why it happens in only one account nor does it address why it started failing suddenly (overnight). Numerous attempts to get those answers have resulted in just repeating the above response. In another situation, we have a query that fails about 80% of the time it runs and, again, only in one of our client accounts (and a different account than above). In 30 other accounts, it works fine, no errors. This particular account it started failing more and more often in mid-April. When it was deployed in February, it was failing less than 5% of the time. Both cases it throws the same error "Invalid or unsupported search".
❤️ 2
👍 1
j
“The solution was to alias two of the columns that we had referenced in an ORDER BY clause” can you elaborate a bit on what you mean here?
Their response sounds like it was written by AI…. at least the first sentence.
c
Instead of:
SELECT st.id, st.date, st.name FROM sometable AS st ORDER BY st.date DESC
Do this:
SELECT st.id, st.date AS st_date, st.name FROM sometable AS st ORDER BY st_date DESC
👍 1