I have a table partitioned by year. With this query :
select *
from myTable
where year between '2018' and '2020'
the query plan is good, only 2018,2019,2020 partitions are used.
But with this query
select *
from myTable
where year between '2018' and extract(year from now())::text
the partitions 2021 and 2022 appears in the query plan, why ?