Skip site navigation (1) Skip section navigation (2)

pgsql: Fix time_part and timetz_part (ie, EXTRACT() for those datatypes)

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix time_part and timetz_part (ie, EXTRACT() for those datatypes)
Date: 2009-07-29 22:19:18
Message-ID: 20090729221918.2BA4B75331E@cvs.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Log Message:
-----------
Fix time_part and timetz_part (ie, EXTRACT() for those datatypes) to
include a fractional part in the output for MILLISECOND and SECOND cases,
rather than truncating the source value.  This is what the float-timestamp
code has always done, and it was clearly the code author's intent to do
the same for integer timestamps, but he forgot about integer division in C.
The other datatypes supported by EXTRACT() already do this correctly.

Backpatch to 8.4, so that the default (integer) behavior of that branch will
match the default (float) behavior of older branches.  Arguably we should
patch further back, but it's possible that applications are expecting the
broken behavior in older branches.  8.4 is new enough that expectations
shouldn't be too settled.

Per report from Greg Stark.

Modified Files:
--------------
    pgsql/src/backend/utils/adt:
        date.c (r1.146 -> r1.147)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/date.c?r1=1.146&r2=1.147)

pgsql-committers by date

Next:From: Tom LaneDate: 2009-07-29 22:19:23
Subject: pgsql: Fix time_part and timetz_part (ie, EXTRACT() for those datatypes)
Previous:From: User DecibelDate: 2009-07-29 21:47:39
Subject: deny-updates - trunk: Switch to using temp table in deny test to make it

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group