pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Improve tests of date_trunc() with infinity and unsupported unit
2+ messages / 1 participants
[nested] [flat]

* pgsql: Improve tests of date_trunc() with infinity and unsupported unit
@ 2025-08-07 02:50  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Paquier @ 2025-08-07 02:50 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Improve tests of date_trunc() with infinity and unsupported units

Commit d85ce012f99f has added some new error handling code to
date_trunc() of timestamp, timestamptz, and interval with infinite
values.

However, the new test cases added by that commit did not actually test
all of the new code, missing coverage for the following cases:
1) For timestamp without time zone:
1-1) infinite value with valid unit
1-2) infinite value with unsupported unit
1-3) finite value with unsupported unit, for a code path older than
d85ce012f99f.
2) For timestamp with time zone, without a time zone specified for the
truncation:
2-1) infinite value with valid unit
2-2) infinite value with unsupported unit
2-3) finite value with unsupported unit, for a code path older than
d85ce012f99f.
3) For timestamp with time zone, with a time zone specified for the
truncation:
3-1) infinite value with valid unit.
3-2) infinite value with unsupported unit.

This commit also provides coverage for the bug fixed in 2242b26ce472,
through cases 2-1) and 3-1), when using an infinite value with a valid
unit, with[out] the optional time zone parameter used for the
truncation.

Author: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/2d320b6f-b4af-4fbc-9eec-5d0fa15d187b@eisentraut.org
Discussion: https://postgr.es/m/4bf60a84-2862-4a53-acd5-8eddf134a60e@eisentraut.org
Backpatch-through: 18

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/572c0f1b0e2a9ed61816239f59d568217079bb8c

Modified Files
--------------
src/test/regress/expected/timestamp.out   | 10 ++++++++++
src/test/regress/expected/timestamptz.out | 18 ++++++++++++++++++
src/test/regress/sql/timestamp.sql        |  4 +++-
src/test/regress/sql/timestamptz.sql      |  7 +++++--
4 files changed, 36 insertions(+), 3 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Improve tests of date_trunc() with infinity and unsupported unit
@ 2025-08-07 02:50  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Paquier @ 2025-08-07 02:50 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Improve tests of date_trunc() with infinity and unsupported units

Commit d85ce012f99f has added some new error handling code to
date_trunc() of timestamp, timestamptz, and interval with infinite
values.

However, the new test cases added by that commit did not actually test
all of the new code, missing coverage for the following cases:
1) For timestamp without time zone:
1-1) infinite value with valid unit
1-2) infinite value with unsupported unit
1-3) finite value with unsupported unit, for a code path older than
d85ce012f99f.
2) For timestamp with time zone, without a time zone specified for the
truncation:
2-1) infinite value with valid unit
2-2) infinite value with unsupported unit
2-3) finite value with unsupported unit, for a code path older than
d85ce012f99f.
3) For timestamp with time zone, with a time zone specified for the
truncation:
3-1) infinite value with valid unit.
3-2) infinite value with unsupported unit.

This commit also provides coverage for the bug fixed in 2242b26ce472,
through cases 2-1) and 3-1), when using an infinite value with a valid
unit, with[out] the optional time zone parameter used for the
truncation.

Author: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/2d320b6f-b4af-4fbc-9eec-5d0fa15d187b@eisentraut.org
Discussion: https://postgr.es/m/4bf60a84-2862-4a53-acd5-8eddf134a60e@eisentraut.org
Backpatch-through: 18

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/67ffe1987d0acab35c2efaa8ffcbe092db333113

Modified Files
--------------
src/test/regress/expected/timestamp.out   | 10 ++++++++++
src/test/regress/expected/timestamptz.out | 18 ++++++++++++++++++
src/test/regress/sql/timestamp.sql        |  4 +++-
src/test/regress/sql/timestamptz.sql      |  7 +++++--
4 files changed, 36 insertions(+), 3 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2025-08-07 02:50 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-08-07 02:50 pgsql: Improve tests of date_trunc() with infinity and unsupported unit Michael Paquier <michael@paquier.xyz>
2025-08-07 02:50 pgsql: Improve tests of date_trunc() with infinity and unsupported unit Michael Paquier <michael@paquier.xyz>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox