Re: Re: Add generate_series(date, date) and generate_series(date, date, integer) - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: Re: Add generate_series(date, date) and generate_series(date, date, integer)
Date
Msg-id CANP8+jKcxi=NWf-vxAu+MGTTv+yKLC=b+MxqKAgAT1nQhBKogQ@mail.gmail.com
Whole thread Raw
In response to Re: Re: Add generate_series(date, date) and generate_series(date, date, integer)  (Corey Huinker <corey.huinker@gmail.com>)
Responses Re: Re: Add generate_series(date, date) and generate_series(date, date, integer)
List pgsql-hackers
On 2 February 2016 at 18:01, Corey Huinker <corey.huinker@gmail.com> wrote:
Doh, I left that comment to myself in there. :)

The corresponding structs in timestamp.c and int.c have no comment, so suggestions of what should be there are welcome. In the interim I put in this:
/* state for generate_series_date(date,date,[step]) */

Extra linefeed after struct removed.

Do you have any insight as to why the documentation test failed?

In the mean time, here's the updated patch.

[step] is in days, but is not documented as such.

My understanding is you want to replace this

SELECT d.dt::date as dt
FROM generate_series('2015-01-01'::date,
                     '2016-01-04'::date
                     interval '1 day') AS d(dt);

with this

SELECT d.dt
FROM generate_series('
2015-01-01'::date,
                     '2016-01-04'::date,
                     7) as d(dt);
 
Personally, I think writing  INTERVAL '7 days' to be clearer than just typing 7.

Other than that, the only difference is the ::date part. Is it really worth adding extra code just for that? I would say not.

No comments on the patch itself, which seems to do the job, so apologies to give this opinion on your work, I do hope it doesn't put you off further contributions.

--
Simon Riggs                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Spurious standby query cancellations
Next
From: Robert Haas
Date:
Subject: Re: checkpointer continuous flushing - V18