Re: Feature request: Improve allowed values for generate series

From: Eugen Konkov <kes-kes(at)yandex(dot)ru>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Feature request: Improve allowed values for generate series
Date: 2020-11-12 02:54:08
Message-ID: 726137393.20201112045408@yandex.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

<html><head><title>Re: Feature request: Improve allowed values for generate series</title>
</head>
<body>
<span style=" font-family:'Tahoma'; font-size: 9pt;">Hello David,<br>
<br>
I have a table with services, each service have a period. After which service is auto renewal<br>
<br>
Services also could be one-time. At this case its interval is '00:00:00'<br>
<br>
The renewal is calculated via generate_series, when interval '00:00:00' pass to that function<br>
query died =(<br>
<br>
Generate dates for one time service:<br>
test=&gt; SELECT * FROM generate_series( '2020-11-09', '2020-11-09', INTERVAL '00:00:00' );<br>
&nbsp; &nbsp; generate_series<br>
------------------------<br>
&nbsp;2020-11-09 00:00:00+02<br>
(1 row)<br>
<br>
Generate dates for auto-renew service:<br>
test=&gt; SELECT * FROM generate_series( '2020-11-09', '2020-11-10', INTERVAL '1 day' );<br>
&nbsp; &nbsp; generate_series &nbsp; &nbsp;<br>
------------------------<br>
&nbsp;2020-11-09 00:00:00+02<br>
&nbsp;2020-11-10 00:00:00+02<br>
(2 rows)<br>
<br>
So it is useful in my case. Also behavior is not surprising.<br>
<br>
<br>
<br>
Wednesday, November 11, 2020, 9:17:28 PM, you wrote:<br>
<br>
</span><table style =" border-collapse: collapse;" cellSpacing = 2>
<tr>
<td width=2 bgcolor= #0000ff style="border: 1px solid black;"><br>
</td>
<td style="border: 1px solid black;"><span style=" font-family:'Tahoma'; font-size: 9pt;">On Wed, Nov 11, 2020 at 12:12 PM Eugen Konkov &lt;</span><a style=" font-family:'tahoma'; font-size: 9pt;" href="mailto:kes-kes(at)yandex(dot)ru">kes-kes(at)yandex(dot)ru</a><span style=" font-family:'Tahoma'; font-size: 9pt;">&gt; wrote:<br>
</span><table style =" border-collapse: collapse;" cellSpacing = 2>
<tr>
<td width=2 bgcolor= #3200ff style="border: 1px solid black;"><br>
</td>
<td style="border: 1px solid black;"><br><br>
<span style=" font-family:'Tahoma'; font-size: 9pt;">&gt; So &nbsp; I &nbsp; feature &nbsp;request &nbsp;to &nbsp;allow &nbsp;zero size step for cases when start point is equest to finish<br>
<br>
&gt; What do you think?<br>
<br>
<br>
<br>
hm.... &nbsp;probably &nbsp;with &nbsp;step 0 we always should generate series of one<br>
value and exit, despite on finish value.<br>
Because &nbsp;with &nbsp;step &nbsp;0 we always stay at current position, so there is<br>
always should be just one value.<br>
</td>
</tr>
</table>
<br>
<span style=" font-family:'Tahoma'; font-size: 9pt;">How is this better than writing "VALUES (start date)"?<br>
<br>
David J.<br>
</td>
</tr>
</table>
<br>
<br>
<br>
<span style=" font-family:'tahoma'; font-size: 9pt; color: #c0c0c0;"><i>--<br>
Best regards,<br>
Eugen Konkov</body></html>

Attachment Content-Type Size
unknown_filename text/html 2.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2020-11-12 03:16:55 Re: logical streaming of xacts via test_decoding is broken
Previous Message tsunakawa.takay@fujitsu.com 2020-11-12 02:46:08 RE: Disable WAL logging to speed up data loading