Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bfQmE-0005hF-DZ for pgsql-bugs@arkaria.postgresql.org; Thu, 01 Sep 2016 12:07:26 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bfQmC-0001Nm-V7 for pgsql-bugs@arkaria.postgresql.org; Thu, 01 Sep 2016 12:07:25 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bfQmC-0001Nf-8C for pgsql-bugs@postgresql.org; Thu, 01 Sep 2016 12:07:24 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bfQm7-0005Lg-4Q for pgsql-bugs@postgresql.org; Thu, 01 Sep 2016 12:07:22 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u81C79M7018742; Thu, 1 Sep 2016 08:07:09 -0400 From: Tom Lane To: Dean Rasheed cc: Andrew Gierth , Christoph Berg , Pablo Pumarino Delgado , "pgsql-bugs@postgresql.org" Subject: Re: BUG #14294: Problem in generate series between dates In-reply-to: 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> <874m604ih2.fsf@news-spur.riddles.org.uk> Comments: In-reply-to Dean Rasheed message dated "Thu, 01 Sep 2016 10:39:26 +0100" Date: Thu, 01 Sep 2016 08:07:09 -0400 Message-ID: <18741.1472731629@sss.pgh.pa.us> X-Pg-Spam-Score: -3.4 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Dean Rasheed writes: > On 1 September 2016 at 00:39, Andrew Gierth wrote: > "Dean" == Dean Rasheed 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