Skip to main content

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.

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. 


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?


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