Default Filter cause error when i select a value in filter

I add a question with default filter. No problem when i run it.
But if i select a value inside my filter and refresh the result: a error appears "Syntax error near SELECT"
Database is postgresql.
The query sql is:

FROM "dwh"."f_classement_groupe_discipline"
JOIN "dwh"."a_session" ON "dwh"."a_session"."ses_id" = "dwh"."f_classement_groupe_discipline"."cgd_ses_id"
WHERE "dwh"."a_session"."ses_date" = ([[{{Session}} #]] SELECT
  "dwh"."a_session"."ses_date" AS "ses_date"
ORDER BY "ses_date"
LIMIT 1  )

What is syntax error in my query?
Thanks for help