Since the 7.17.0 version, the sql function requires a query ID ad the first parameter. It is no longer possible to run an arbitrary query from the Issue Navigator: only trusted users can write and save queries to get a Query ID
It also supports parameters now...
sql(#ID, parameters,...)
About the custom JQLs
...
And finally, it was transformed to JQL again:
issue in sql(..)
Nesting (N-transformation level)
Since the built-in sql() JQL function is a standard JQL function it can be used as an input of a new SQL query (JQL → SQL → JQL → SQL → JQL...)
...