Re: generate_series() Interpretation

Поиск
Список
Период
Сортировка
От Michael Nolan
Тема Re: generate_series() Interpretation
Дата
Msg-id BANLkTi=y6jPhB506r2YvKwb7UBYgnCuw8A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: generate_series() Interpretation  ("David E. Wheeler" <david@kineticode.com>)
Список pgsql-hackers


On Mon, Jun 27, 2011 at 1:38 PM, David E. Wheeler <david@kineticode.com> wrote:

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, the imprecision regarding adding '1 month' to something that may or may not have been intended to be 'last day of the month' is a limitation in the interval code.

One way to change this would be to implement another interval type such as 'full_month'  which would take a date that is know to be the last day of the month and make it the last day of the appropriate month.  If the starting date is NOT the last day of a month, the existing logic would suffice. 

Or you can do as I have done and create your own last_day() function that takes any date and makes it the last day of that month, and apply it to the output of generate_series();
--
Mike Nolan
nolan@tssi.com

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

Предыдущее
От: Noah Misch
Дата:
Сообщение: Re: [v9.2] DROP Reworks Part.0 - 'missing_ok' support of get_object_address
Следующее
От: Steve Crawford
Дата:
Сообщение: Re: generate_series() Interpretation