]> granicus.if.org Git - postgresql/commit
Make extract() do something more reasonable with infinite datetimes.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 22 Jan 2016 03:26:20 +0000 (22:26 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 22 Jan 2016 03:26:20 +0000 (22:26 -0500)
commit647d87c56ab6da70adb753c08d7cdf7ee905ea8a
treed0ea892d43d8f94c7171c04d934f9dad634027d0
parentd9b9289c837a98b78b948b597fabd9ab0a96c0db
Make extract() do something more reasonable with infinite datetimes.

Historically, extract() just returned zero for any case involving an
infinite timestamp[tz] input; even cases in which the unit name was
invalid.  This is not very sensible.  Instead, return infinity or
-infinity as appropriate when the requested field is one that is
monotonically increasing (e.g, year, epoch), or NULL when it is not
(e.g., day, hour).  Also, throw the expected errors for bad unit names.

BACKWARDS INCOMPATIBLE CHANGE

Vitaly Burovoy, reviewed by Vik Fearing
doc/src/sgml/func.sgml
src/backend/utils/adt/timestamp.c
src/test/regress/expected/date.out
src/test/regress/sql/date.sql