Optional clauses not working as expected

Hi, I do a query that is like the following example:

select *
from table1
where (conditions)
[[and table1.id in
(select id
from table2
where {{variable}})]]

where variable is a column filter of table2

In the guide I read that if the variable is empty all the part of the query inside the brakets [[]] are ignored;

So, if variable filter is empty then I expect the result of the query:

select *
from table1
where (conditions)

Instead, I obtain is the result of the query like:

select *
from table1
where (conditions)
and table1.id in
(select id
from table2)

How can I solve this?

Hi @PGianlu
It looks like you’re having similar problem as this issue: