• Tom Lane's avatar
    Make our parsing of INTERVAL literals spec-compliant (or at least a heck of · f867339c
    Tom Lane authored
    a lot closer than it was before).  To do this, tweak coerce_type() to pass
    through the typmod information when invoking interval_in() on an UNKNOWN
    constant; then fix DecodeInterval to pay attention to the typmod when deciding
    how to interpret a units-less integer value.  I changed one or two other
    details as well.  I believe the code now reacts as expected by spec for all
    the literal syntaxes that are specifically enumerated in the spec.  There
    are corner cases involving strings that don't exactly match the set of fields
    called out by the typmod, for which we might want to tweak the behavior some
    more; but I think this is an area of user friendliness rather than spec
    compliance.  There remain some non-compliant details about the SQL syntax
    (as opposed to what's inside the literal string); but at least we'll throw
    error rather than silently doing the wrong thing in those cases.
    f867339c
nabstime.c 36.4 KB