Re: Feature request: Improve allowed values for generate series - Mailing list pgsql-hackers

From Eugen Konkov
Subject Re: Feature request: Improve allowed values for generate series
Date
Msg-id 6210684162.20201111210709@yandex.ru
Whole thread Raw
In response to Feature request: Improve allowed values for generate series  (Eugen Konkov <kes-kes@yandex.ru>)
Responses Re: Feature request: Improve allowed values for generate series
List 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




pgsql-hackers by date:

Previous
From: Eugen Konkov
Date:
Subject: Re: Proposition for autoname columns
Next
From: Pavel Stehule
Date:
Subject: Re: Feature request: Improve allowed values for generate series