Re: Inputting relative datetimes
От | Dean Rasheed |
---|---|
Тема | Re: Inputting relative datetimes |
Дата | |
Msg-id | CAEZATCWdeMr9SYUQcrYjcGykuhzBeeppXMKaB7+tp1c3=7HRPQ@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Inputting relative datetimes (Robert Haas <robertmhaas@gmail.com>) |
Ответы |
Re: Inputting relative datetimes
|
Список | pgsql-hackers |
On 28 August 2011 00:39, Robert Haas <robertmhaas@gmail.com> wrote: > On Sat, Aug 27, 2011 at 7:43 AM, Dean Rasheed <dean.a.rasheed@gmail.com> wrote: >> On 27 August 2011 12:29, Dean Rasheed <dean.a.rasheed@gmail.com> wrote: >>> ... if nothing else it has been a >>> fun exercise figuring out how the datetime string parsing code works. >> >> While looking through the current code, I spotted the following oddity: >> >> select timestamp 'yesterday 10:30'; >> timestamp >> --------------------- >> 2011-08-26 10:30:00 >> >> which is what you'd expect, however: >> >> select timestamp '10:30 yesterday'; >> timestamp >> --------------------- >> 2011-08-26 00:00:00 >> >> Similarly "today" and "tomorrow" reset any time fields so far, but >> ISTM that they should really be preserving the hour, min, sec fields >> decoded so far. > > Sounds right to me. Want to send a patch? > The attached patch makes "today", "tomorrow" and "yesterday" only set the year, month and day fields. All the other fields are already initialised to 0 at the start, and may be set non-zero before or after encountering these special date values. The result should now be independent of the order of the fields. Regards, Dean
Вложения
В списке pgsql-hackers по дате отправления: