|
Re: [HACKERS] date_part()/EXTRACT(second) behaviour with time data type: msg#01918pgsql-hackers
Gregory Stark <stark@xxxxxxx> 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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
|
|
||||||||||||||||||||||||||
|
|
|
| News | Mail Home | sitemap | FAQ | advertise |