pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Dean Rasheed <dean.a.rasheed@gmail.com>
Cc: Andrew Gierth <andrew@tao11.riddles.org.uk>
Cc: Christoph Berg <myon@debian.org>
Cc: Pablo Pumarino Delgado <pablopumarino@gmail.com>
Cc: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: BUG #14294: Problem in generate series between dates
Date: Thu, 01 Sep 2016 08:07:09 -0400
Message-ID: <18741.1472731629@sss.pgh.pa.us> (raw)
In-Reply-To: <CAEZATCW_MMOhUYV_yjOm-RZ4wcCfYAwmcUvN=k096Vq57=dqpQ@mail.gmail.com>
References: <20160824182920.15681.52285@wrigleys.postgresql.org>
	<28256.1472064660@sss.pgh.pa.us>
	<87oa4i9d8w.fsf@news-spur.riddles.org.uk>
	<31168.1472069440@sss.pgh.pa.us>
	<20160831153737.xubrne5yzfedscym@msg.df7cb.de>
	<87d1ko4t69.fsf@news-spur.riddles.org.uk>
	<15294.1472679204@sss.pgh.pa.us>
	<878tvc4nk4.fsf@news-spur.riddles.org.uk>
	<CAEZATCXeYX74QxFJD=5HMfHcZGLO+eL_MfyFs24QZbNyLLWjYg@mail.gmail.com>
	<CAEZATCUyeW_risKv0AgSy-ODug_c8YTfU7BDudCMWGNPzYi2YQ@mail.gmail.com>
	<874m604ih2.fsf@news-spur.riddles.org.uk>
	<CAEZATCW_MMOhUYV_yjOm-RZ4wcCfYAwmcUvN=k096Vq57=dqpQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Dean Rasheed <dean.a.rasheed@gmail.com> writes:
> On 1 September 2016 at 00:39, Andrew Gierth <andrew@tao11.riddles.org.uk> wrote:
> "Dean" == Dean Rasheed <dean.a.rasheed@gmail.com> writes:
>>>> Perhaps adding generate_series(date,date,interval) might work.

> Hmm, maybe, but since this is timezone-dependent, the existing code
> might be perfectly safe in the user's part of the world. I don't
> really have a feel for how likely this is to break people's code, but
> I think it's something we have to consider.

Consider this perfectly reasonable use-case:

# select generate_series(current_date,current_date+1,interval '1 hour');
    generate_series     
------------------------
 2016-09-01 00:00:00-04
 2016-09-01 01:00:00-04
 2016-09-01 02:00:00-04
 2016-09-01 03:00:00-04
 2016-09-01 04:00:00-04
 2016-09-01 05:00:00-04
 2016-09-01 06:00:00-04
 2016-09-01 07:00:00-04
 2016-09-01 08:00:00-04
 2016-09-01 09:00:00-04
 2016-09-01 10:00:00-04
 2016-09-01 11:00:00-04
 2016-09-01 12:00:00-04
 2016-09-01 13:00:00-04
 2016-09-01 14:00:00-04
 2016-09-01 15:00:00-04
 2016-09-01 16:00:00-04
 2016-09-01 17:00:00-04
 2016-09-01 18:00:00-04
 2016-09-01 19:00:00-04
 2016-09-01 20:00:00-04
 2016-09-01 21:00:00-04
 2016-09-01 22:00:00-04
 2016-09-01 23:00:00-04
 2016-09-02 00:00:00-04
(25 rows)

We can't make the data type of the output dependent on the interval size,
so decreeing that this now produces date not timestamp would break any
case with a fractional-day interval.

After reviewing the previous thread, I have no real desire to take
this up again.  The consensus then was that the added utility didn't
outweigh the likelihood of breaking existing queries, and we've not
covered anything here that wasn't discussed before.

Maybe we just need an example in the docs about working with dates.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (17+ messages)

Message-ID: <18741.1472731629@sss.pgh.pa.us>
Permalink:  ../18741.1472731629@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/18741.1472731629@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, dean.a.rasheed@gmail.com, andrew@tao11.riddles.org.uk, myon@debian.org, pablopumarino@gmail.com
  Subject: Re: BUG #14294: Problem in generate series between dates
  In-Reply-To: <18741.1472731629@sss.pgh.pa.us>
  References: <20160824182920.15681.52285@wrigleys.postgresql.org> <28256.1472064660@sss.pgh.pa.us> <87oa4i9d8w.fsf@news-spur.riddles.org.uk> <31168.1472069440@sss.pgh.pa.us> <20160831153737.xubrne5yzfedscym@msg.df7cb.de> <87d1ko4t69.fsf@news-spur.riddles.org.uk> <15294.1472679204@sss.pgh.pa.us> <878tvc4nk4.fsf@news-spur.riddles.org.uk> <CAEZATCXeYX74QxFJD=5HMfHcZGLO+eL_MfyFs24QZbNyLLWjYg@mail.gmail.com> <CAEZATCUyeW_risKv0AgSy-ODug_c8YTfU7BDudCMWGNPzYi2YQ@mail.gmail.com> <874m604ih2.fsf@news-spur.riddles.org.uk> <CAEZATCW_MMOhUYV_yjOm-RZ4wcCfYAwmcUvN=k096Vq57=dqpQ@mail.gmail.com> <18741.1472731629@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox