pgsql-server/src backend/utils/adt/timestamp.c ... - Mailing list pgsql-committers

From momjian@postgresql.org (Bruce Momjian - CVS)
Subject pgsql-server/src backend/utils/adt/timestamp.c ...
Date
Msg-id 20030320060301.C8E66475CA9@postgresql.org
Whole thread Raw
List pgsql-committers
CVSROOT:    /cvsroot
Module name:    pgsql-server
Changes by:    momjian@postgresql.org    03/03/20 01:03:01

Modified files:
    src/backend/utils/adt: timestamp.c
    src/test/regress/expected: horology-no-DST-before-1970.out
                               horology-solaris-1947.out
                               horology.out
    src/test/regress/sql: horology.sql

Log message:
    Attached is a patch that limits the range tested by horology to
    what is capable using integer-datatime timestamps. It does attempt
    to exercise the maximum allowable timestamp range.
    Also is a small error check when converting a timestamp from external
    to internal format that prevents out of range timestamps from being
    entered.

    Files patched:
    Index: src/backend/utils/adt/timestamp.c
    Added range check to prevent out of range timestamps
    from being used.

    Index: src/test/regress/sql/horology.sql
    Index: src/test/regress/expected/horology-no-DST-before-1970.out
    Index: src/test/regress/expected/horology-solaris-1947.out
    Limited range of timestamps being checked to
    Jan 1, 4713 BC  to Dec 31, 294276

    In creating this patch, I have seen some definite problems with integer
    timestamps and how they react when used near their limits. For example,
    the following statement gives the correct result:

    SELECT timestamp without time zone 'Jan 1, 4713 BC'
    + interval '109203489 days' AS "Dec 31, 294276";

    However, this statement which is the logical inverse of the above
    gives incorrect results:

    SELECT timestamp without time zone '12/31/294276'
    - timestamp without time zone 'Jan 1, 4713 BC' AS "109203489 Days";

    John Cochran


pgsql-committers by date:

Previous
From: momjian@postgresql.org (Bruce Momjian - CVS)
Date:
Subject: pgsql-server/src/bin/psql common.c common.h co ...
Next
From: momjian@postgresql.org (Bruce Momjian - CVS)
Date:
Subject: pgsql-server/ oc/src/sgml/libpq.sgml rc/interf ...