I have a query the following query :
SELECT EXTRACT(YEAR FROM t::date),
EXTRACT(MONTH FROM t::date),t::date+ interval '1 month'- t::date
FROM generate_series('2015-04-01', '2016-02-09', '1 month'::interval) t
The query gives the correct number of days for all the months, except for the month of Feb, 2016 ie, I expect to get 9 days and not 29 days as the result. What change should I make to the query above? Thanks