The following statement works as expected in FB2.5 but fails in 3.0, returning "SQL error code = -104. Invalid expression in the select list (not contained in either an aggregate function or the GROUP BY clause)."
iif(D is null, 10, 0) + SYS as SYS,
(select d.RDB$RELATION_ID from RDB$DATABASE d) as D,
coalesce(r.RDB$SYSTEM_FLAG, 0) as SYS
from RDB$RELATIONS r)
group by 1