generate_series() Interpretation - Mailing list pgsql-hackers

From David E. Wheeler
Subject generate_series() Interpretation
Date
Msg-id AC9381D0-1004-41CF-85E8-8F947565BA7D@kineticode.com
Whole thread Raw
Responses Re: generate_series() Interpretation
Re: generate_series() Interpretation
Re: generate_series() Interpretation
List pgsql-hackers
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:002011-06-30 00:00:002011-07-30 00:00:002011-08-30 00:00:002011-09-30
00:00:002011-10-3000:00:002011-11-30 00:00:002011-12-30 00:00:002012-01-30 00:00:002012-02-29 00:00:002012-03-29
00:00:00

It seems to me that this is subject to interpretation. If I was building a calendaring app, for example, I might rather
thatthe results were: 
  generate_series
---------------------2011-05-31 00:00:002011-06-30 00:00:002011-07-31 00:00:002011-08-31 00:00:002011-09-30
00:00:002011-10-3100:00:002011-11-30 00:00:002011-12-31 00:00:002012-01-31 00:00:002012-02-29 00:00:002012-03-31
00:00:00

Is there some way to change the interpretation of interval calculation like this? Or would I just have to write my own
functionto do it the way I want? 

Thanks,

David



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: pg_upgrade defaulting to port 25432
Next
From: Josh Berkus
Date:
Subject: Re: beta3?