Re: date_part()/EXTRACT(second) behaviour with time data type
От | Tom Lane |
---|---|
Тема | Re: date_part()/EXTRACT(second) behaviour with time data type |
Дата | |
Msg-id | 19958.1248884142@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | date_part()/EXTRACT(second) behaviour with time data type (Gregory Stark <stark@mit.edu>) |
Ответы |
Re: date_part()/EXTRACT(second) behaviour with time data
type
|
Список | pgsql-hackers |
Gregory Stark <stark@mit.edu> writes: > I think we broke date_part for extracting seconds from time arguments. It > appears we leave out the milliseconds whereas we don't for timestamp > arguments. This was not the case in 8.3 where we included the milliseconds for > both data types. It's not new. This appears to be a difference between the integer and float timestamp code paths, and I'd say it's probably a thinko: case DTK_SECOND: #ifdef HAVE_INT64_TIMESTAMP result = tm->tm_sec + fsec / USECS_PER_SEC; #else result = tm->tm_sec + fsec; #endif break; In the integer case, fsec is an integer and so the division loses the fraction. timestamptz_part does this instead: case DTK_SECOND: #ifdef HAVE_INT64_TIMESTAMP result = tm->tm_sec + fsec / 1000000.0; #else result = tm->tm_sec + fsec; #endif break; I agree that we should change it, but should we back-patch it, and if so how far? regards, tom lane
В списке pgsql-hackers по дате отправления: