Re: Re: Add generate_series(date, date) and generate_series(date, date, integer)

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
Cc: David Steele <david(at)pgmasters(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Re: Add generate_series(date, date) and generate_series(date, date, integer)
Date: 2016-02-21 02:58:49
Message-ID: CANP8+jKcxi=NWf-vxAu+MGTTv+yKLC=b+MxqKAgAT1nQhBKogQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2 February 2016 at 18:01, Corey Huinker <corey(dot)huinker(at)gmail(dot)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/
<http://www.2ndquadrant.com/>
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John R Pierce 2016-02-21 03:26:34 Re: JDBC behaviour
Previous Message Simon Riggs 2016-02-21 02:29:39 Re: Spurious standby query cancellations