Re: BUG #14294: Problem in generate series between dates

From: John R Pierce <pierce(at)hogranch(dot)com>
To: pablopumarino(at)gmail(dot)com, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #14294: Problem in generate series between dates
Date: 2016-08-24 18:59:16
Message-ID: 56e85f55-6de8-3de6-65e6-12eca07074aa@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 8/24/2016 11:29 AM, pablopumarino(at)gmail(dot)com wrote:
> SELECT generate_series('2016-08-01', '2016-08-31', '1
> day'::interval)::date
>
> it gives me the corresponding list of days but for some reason it misses the
> day 2016-08-31.
> -I've tried this with other months and it works correctly, also if I use it
> for the same dates but on 2015 it works fine.
> -This started failing after we upgraded our system to the version 9.5.4,
> I've tryed it in an older release that we had installed and it worked.

I would write that as...

select generate_series(timestamp '2016-08-01', timestamp '2016-08-31',
interval '1 day')::date;

the notation type 'string value' is a native constant in that type,
while the notation 'string value'::type generates a text constant and
typecasts it.

--
john r pierce, recycling bits in santa cruz

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2016-08-24 19:13:01 Re: BUG #14294: Problem in generate series between dates
Previous Message Andrew Gierth 2016-08-24 18:58:37 Re: BUG #14290: materialized view refresh doesn't use temp_tablespace