Feature request: Improve allowed values for generate series

From: Eugen Konkov <kes-kes(at)yandex(dot)ru>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Feature request: Improve allowed values for generate series
Date: 2020-11-11 18:50:59
Message-ID: 126735173.20201111205059@yandex.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello Pgsql-hackers,

Seems I fall into corner case:

test=> SELECT * FROM generate_series( '2020-11-09', '2020-11-09', INTERVAL '00:00:00' );
ERROR: step size cannot equal zero

But:
test=> SELECT * FROM generate_series( '2020-11-09', '2020-11-10', INTERVAL '1 day' );
generate_series
------------------------
2020-11-09 00:00:00+02
2020-11-10 00:00:00+02
(2 rows)

Here we start at 2020-11-09, add interval of one day and finish at 2020-11-10
Done! series is generated.

In first case I expect that I start at 2020-11-09, add interval of zero and finish at 2020-11-09
Everything is consistent.

test=> SELECT * FROM generate_series( '2020-11-09', '2020-11-09', INTERVAL '00:00:00' );
generate_series
------------------------
2020-11-09 00:00:00+02
(1 row)

So I feature request to allow zero size step for cases when start point is equest to finish

What do you think?

--
Best regards,
Eugen Konkov

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jacob Champion 2020-11-11 18:57:02 Re: Support for NSS as a libpq TLS backend
Previous Message Fujii Masao 2020-11-11 18:28:06 Re: Allow some recovery parameters to be changed with reload