[HACKERS] generate_series() Interpretation

2011-06-27 Thread David E. Wheeler
Hackers, I'm curious about behavior such as this: bric=# select generate_series('2011-05-31'::timestamp , '2012-04-01'::timestamp, '1 month'); generate_series - 2011-05-31 00:00:00 2011-06-30 00:00:00 2011-07-30 00:00:00 2011-08-30 00:00:00 2011-09-30 00:00:00

Re: [HACKERS] generate_series() Interpretation

2011-06-27 Thread Steve Crawford
On 06/27/2011 10:49 AM, David E. Wheeler wrote: Hackers, I'm curious about behavior such as this: bric=# select generate_series('2011-05-31'::timestamp , '2012-04-01'::timestamp, '1 month'); generate_series - 2011-05-31 00:00:00 2011-06-30 00:00:00 2011-07-30

Re: [HACKERS] generate_series() Interpretation

2011-06-27 Thread David E. Wheeler
On Jun 27, 2011, at 10:54 AM, Steve Crawford wrote: That's just how intervals that represent varying periods of time work. You would need to write your own. But a series of end-of-month dates is pretty easy: select generate_series('2011-06-01'::timestamp , '2012-04-01'::timestamp, '1

Re: [HACKERS] generate_series() Interpretation

2011-06-27 Thread Kevin Grittner
David E. Wheeler da...@kineticode.com wrote: generate_series - 2011-05-31 00:00:00 2011-06-30 00:00:00 2011-07-31 00:00:00 2011-08-31 00:00:00 2011-09-30 00:00:00 2011-10-31 00:00:00 2011-11-30 00:00:00 2011-12-31 00:00:00 2012-01-31 00:00:00

Re: [HACKERS] generate_series() Interpretation

2011-06-27 Thread David E. Wheeler
On Jun 27, 2011, at 11:03 AM, Kevin Grittner wrote: It is precisely to support such fancy things that some products support a more abstract date type which allows 31 days in any month, and then normalizes to real dates as needed. The PostgreSQL developer community has generally not been

Re: [HACKERS] generate_series() Interpretation

2011-06-27 Thread Steve Crawford
On 06/27/2011 10:56 AM, David E. Wheeler wrote: On Jun 27, 2011, at 10:54 AM, Steve Crawford wrote: That's just how intervals that represent varying periods of time work. You would need to write your own. But a series of end-of-month dates is pretty easy: select

Re: [HACKERS] generate_series() Interpretation

2011-06-27 Thread David E. Wheeler
On Jun 27, 2011, at 11:36 AM, Steve Crawford wrote: The query is marginally trickier. But the better calendaring apps give a variety of options when selecting repeat: A user who selects June 30, 2011 and wants a monthly repeat might want: 30th of every month - skip months without a 30th

Re: [HACKERS] generate_series() Interpretation

2011-06-27 Thread Michael Nolan
On Mon, Jun 27, 2011 at 1:38 PM, David E. Wheeler da...@kineticode.comwrote: Yeah, which is why I said it was subject to interpretation. Of course there's no way to tell generate_series() which to use, which is what I figured. generate_series() is doing exactly what it was designed to do,

Re: [HACKERS] generate_series() Interpretation

2011-06-27 Thread Steve Crawford
Yeah, which is why I said it was subject to interpretation. Of course there's no way to tell generate_series() which to use, which is what I figured. Fortunately PostgreSQL uses the same interpretation for '1 month' when used in generate_series that it does everywhere else - to do otherwise

Re: [HACKERS] generate_series() Interpretation

2011-06-27 Thread Christopher Browne
On Mon, Jun 27, 2011 at 1:49 PM, David E. Wheeler da...@kineticode.com wrote: Hackers, I'm curious about behavior such as this: bric=# select generate_series('2011-05-31'::timestamp , '2012-04-01'::timestamp, '1 month');   generate_series -  2011-05-31 00:00:00  

Re: [HACKERS] generate_series() Interpretation

2011-06-27 Thread Christopher Browne
On Mon, Jun 27, 2011 at 2:36 PM, Steve Crawford scrawf...@pinpointresearch.com wrote: On 06/27/2011 10:56 AM, David E. Wheeler wrote: On Jun 27, 2011, at 10:54 AM, Steve Crawford wrote: That's just how intervals that represent varying periods of time work. You would need to write your own.

Re: [HACKERS] generate_series() Interpretation

2011-06-27 Thread David E. Wheeler
On Jun 27, 2011, at 12:36 PM, Christopher Browne wrote: I wrote something on this on pgsql-general about 5 years ago that still seems pretty relevant. http://archives.postgresql.org/pgsql-general/2006-02/msg00159.php iwantsandy.com (now defunct) originally had a solution like this. However