Ok, I found it. I was using
current_date - a non-constant
parameter, in the
where clause. Changing
current_date to a literal value, fixed it.
Constraint exclusion only works when the query's WHERE clause contains
constants. A parameterized query will not be optimized, since the
planner cannot know which partitions the parameter value might select
at run time. For the same reason, "stable" functions such as
CURRENT_DATE must be avoided.