Skip to main content
Solved

Devexpress error in Indicium log: "A custom SQL query should contain only SELECT statements"


Forum|alt.badge.img+13

Since our recent upgrade of the Thinkwise platform from 2023.3 to 2025.1 a report stopped working in Indicium with the following error:

Query maat_niveau failed to execute. ---> DevExpress.DataAccess.Sql.CustomSqlQueryValidationException: A custom SQL query should contain only SELECT statements.

The query contains a select statement over a subquery. No CTE's are used.

What else could be causing this? Or is there a possibility to skip this validation alltogether? The report runs fine in devexpress designer 1.70.

Best answer by Erwin Ekkel

We have noticed this problem before, in that case it was a bug in devexpress it self. In that case the problem was a replace() in the query for the report. Moving this functionality to the parameter it self solved this problem. Can you check if there is a replace() function in your sql code. And if that is causing the issue. 

View original
Did this topic help you find an answer to your question?

3 replies

Forum|alt.badge.img+17
  • Moderator
  • 761 replies
  • Answer
  • April 29, 2025

We have noticed this problem before, in that case it was a bug in devexpress it self. In that case the problem was a replace() in the query for the report. Moving this functionality to the parameter it self solved this problem. Can you check if there is a replace() function in your sql code. And if that is causing the issue. 


Forum|alt.badge.img+13
  • Author
  • Hero
  • 149 replies
  • April 29, 2025

Hi Erwin. There are two replace() functions in the query and removing them does indeed solve the issue. We use views for most report queries but this an edge case where a view isn't used for performance issues. The report parameters are inside the subquery and moving them to the outside of the query hits performance greatly making it less obvious to use a view here. The replaces are there for legibility reasons but as is often the case with SQL there's probably an alternative.

Is there any chance this Devexpress bug will be solved in the short term?


Forum|alt.badge.img+13
  • Author
  • Hero
  • 149 replies
  • April 29, 2025

I replaced these particular replace() functions with format() and now the report is working again in production. Thank you ​@Erwin Ekkel  for the input.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings