• Tom Lane's avatar
    Be more careful about out-of-range dates and timestamps. · a70e13a3
    Tom Lane authored
    Tighten the semantics of boundary-case timestamptz so that we allow
    timestamps >= '4714-11-24 00:00+00 BC' and < 'ENDYEAR-01-01 00:00+00 AD'
    exactly, no more and no less, but it is allowed to enter timestamps
    within that range using non-GMT timezone offsets (which could make the
    nominal date 4714-11-23 BC or ENDYEAR-01-01 AD).  This eliminates
    dump/reload failure conditions for timestamps near the endpoints.
    To do this, separate checking of the inputs for date2j() from the
    final range check, and allow the Julian date code to handle a range
    slightly wider than the nominal range of the datatypes.
    
    Also add a bunch of checks to detect out-of-range dates and timestamps
    that formerly could be returned by operations such as date-plus-integer.
    All C-level functions that return date, timestamp, or timestamptz should
    now be proof against returning a value that doesn't pass IS_VALID_DATE()
    or IS_VALID_TIMESTAMP().
    
    Vitaly Burovoy, reviewed by Anastasia Lubennikova, and substantially
    whacked around by me
    a70e13a3
date.out 27.3 KB