git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: 61cac71) | patch
Improve handling of date_trunc() units for infinite input values
2024年12月27日 04:32:40 +0000 (13:32 +0900)
2024年12月27日 04:32:40 +0000 (13:32 +0900)
commit d85ce012f99f63249bb45a78fcecb7a2383920b1
Improve handling of date_trunc() units for infinite input values

Previously, if an infinite value was passed to date_trunc(), then the
same infinite value would always be returned regardless of the field
unit given by the caller. This commit updates the function so that an
error is returned when an invalid unit is passed to date_trunc() with an
infinite value.

This matches the behavior of date_trunc() with a finite value and
date_part() with an infinite value, making the handling of interval,
timestamp and timestamptz more consistent across the board for these two
functions.

Some tests are added to cover all these new failure cases, with an
unsupported unit and infinite values for the three data types. There
were no test cases in core that checked all these patterns up to now.

Author: Joseph Koshakow
Discussion: https://postgr.es/m/CAAvxfHc4084dGzEJR0_pBZkDuqbPGc5wn7gK_M0XR_kRiCdUJQ@mail.gmail.com
src/backend/utils/adt/timestamp.c diff | blob | blame | history
src/test/regress/expected/interval.out diff | blob | blame | history
src/test/regress/expected/timestamp.out diff | blob | blame | history
src/test/regress/expected/timestamptz.out diff | blob | blame | history
src/test/regress/sql/interval.sql diff | blob | blame | history
src/test/regress/sql/timestamp.sql diff | blob | blame | history
src/test/regress/sql/timestamptz.sql diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /