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
...