opening_date and date_closed were cast to char but are supposed to be
dates. When you try to group crm_lead_report by one of them, postgres
was not happy. Now, it properly tells postgres that they are of type
date.
id,
c.date_deadline,
- to_char(c.date_open, 'YYYY-MM-DD') as opening_date,
- to_char(c.date_closed, 'YYYY-mm-dd') as date_closed,
+ date(c.date_open) as opening_date,
+ date(c.date_closed) as date_closed,
date_trunc('day',c.date_last_stage_update) as date_last_stage_update,