From: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
---|---|
To: | Corey Huinker <corey(dot)huinker(at)gmail(dot)com> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Add generate_series(date, date) and generate_series(date, date, integer) |
Date: | 2016-01-25 06:12:07 |
Message-ID: | CAB7nPqQUuUh_W3s55eSiMnt901Ud3meF7f_96yPkKcqfd1ZaMg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Mon, Jan 25, 2016 at 3:00 PM, Corey Huinker <corey(dot)huinker(at)gmail(dot)com> wrote:
> This patch addresses a personal need: nearly every time I use
> generate_series for timestamps, I end up casting the result into date or the
> ISO string thereof. Like such:
>
> [...]
>
> One thing I discovered in doing this patch is that if you do a timestamp
> generate_series involving infinity....it tries to do it. I didn't wait to
> see if it finished.
Well, I would think that this is a bug that we had better address and
backpatch. It does not make much sense to use infinity for timestamps,
but letting it run infinitely is not good either.
> For the date series, I put in checks to return an empty set:
>
> SELECT d.date_val FROM generate_series('-infinity'::date,'1999-12-29'::date)
> as d(date_val);
> date_val
> ----------
> (0 rows)
>
> SELECT d.date_val FROM generate_series('1991-09-24'::date,'infinity'::date)
> as d(date_val);
> date_val
> ----------
> (0 rows)
Wouldn't a proper error be more adapted?
--
Michael
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2016-01-25 06:22:24 | Re: Add generate_series(date, date) and generate_series(date, date, integer) |
Previous Message | Corey Huinker | 2016-01-25 06:00:15 | Add generate_series(date, date) and generate_series(date, date, integer) |