Can't use CTE or subquery

Hi ! I need to use CTE (or subquery table) in my query. But I always got permission issue when running the query. This is my sample query :

with date_range AS (SELECT DATE '2024-08-03' AS start_date) 
select * from date_range

And I got

But if I put it in 1 line like below, the result is shown.

with date_range AS (SELECT DATE '2024-08-03' AS start_date) select * from date_range

Anyone can help me to figure out whats the issue ?

Works for me! What version of Metabase and what's the source database?

I'm using metabase v0.49.5 with postgresql 11.11

I'm on Metabase 50.18 with Postgres 16.3.
Time to upgrade? Postgres 11 is now end of life.

Maybe need to upgrade. But another weird thing is, I can execute the query successfully from my local. (I'm using DBeaver on my local)

Try a connection to a different database type. See if that works, then you'll know if it's Postgres or Metabase.
Does seem very strange, I can't think of anything in either product that's changed regarding CTE.