pgsql: Make our parsing of INTERVAL literals spec-compliant (or at least - Mailing list pgsql-committers

From tgl@postgresql.org (Tom Lane)
Subject pgsql: Make our parsing of INTERVAL literals spec-compliant (or at least
Date
Msg-id 20080910182941.63F017545A3@cvs.postgresql.org
Whole thread Raw
List pgsql-committers
Log Message:
-----------
Make our parsing of INTERVAL literals spec-compliant (or at least a heck of
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.

Modified Files:
--------------
    pgsql/src/backend/parser:
        parse_coerce.c (r2.166 -> r2.167)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/parse_coerce.c?r1=2.166&r2=2.167)
    pgsql/src/backend/utils/adt:
        datetime.c (r1.190 -> r1.191)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/datetime.c?r1=1.190&r2=1.191)
        nabstime.c (r1.155 -> r1.156)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/nabstime.c?r1=1.155&r2=1.156)
        timestamp.c (r1.190 -> r1.191)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/timestamp.c?r1=1.190&r2=1.191)
    pgsql/src/include/utils:
        datetime.h (r1.69 -> r1.70)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/utils/datetime.h?r1=1.69&r2=1.70)
    pgsql/src/test/regress/expected:
        interval.out (r1.20 -> r1.21)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/interval.out?r1=1.20&r2=1.21)
    pgsql/src/test/regress/sql:
        interval.sql (r1.12 -> r1.13)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/interval.sql?r1=1.12&r2=1.13)

pgsql-committers by date:

Previous
From: alvherre@postgresql.org (Alvaro Herrera)
Date:
Subject: pgsql: Add "source file" and "source line" information to each GUC
Next
From: tgl@postgresql.org (Tom Lane)
Date:
Subject: pgsql: Tweak newly added set_config_sourcefile() so that the target