Re: generate_series() Interpretation

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: generate_series() Interpretation
Дата
Msg-id 4E087F95020000250003EC64@gw.wicourts.gov
обсуждение исходный текст
Ответ на generate_series() Interpretation  ("David E. Wheeler" <david@kineticode.com>)
Ответы Re: generate_series() Interpretation  ("David E. Wheeler" <david@kineticode.com>)
Список pgsql-hackers
"David E. Wheeler" <david@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
>  2012-02-29 00:00:00
>  2012-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
> function to do it the way I want?
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 receptive to such use
cases.  I think you need to iterate through month intervals and add
those to the starting date for now.  If you want to start with the
last day of a month with less than 31 days, you may need to back up
a month or two to find a suitable month and offset your intervals by
the appropriate number of months.
I'd bet that if you encapsulate all that in a PostgreSQL function,
you're not the only one who would find it useful.
-Kevin


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: [COMMITTERS] pgsql: Make the visibility map crash-safe.
Следующее
От: Robert Haas
Дата:
Сообщение: Re: pg_upgrade defaulting to port 25432