Re: 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: Re: Feature request: Improve allowed values for generate series
Date: 2020-11-11 19:07:09
Message-ID: 6210684162.20201111210709@yandex.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello Eugen,

Wednesday, November 11, 2020, 8:50:59 PM, you wrote:

> 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?

hm.... probably with step 0 we always should generate series of one
value and exit, despite on finish value.
Because with step 0 we always stay at current position, so there is
always should be just one value.

--
Best regards,
Eugen Konkov

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2020-11-11 19:07:28 Re: Feature request: Improve allowed values for generate series
Previous Message Eugen Konkov 2020-11-11 18:58:01 Re: Proposition for autoname columns