Covering the comparison between date and timestamp, tz, type

Started by Kwangwon Seoover 1 year ago3 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

appliessuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t51348
psql -h localhost -U postgres

Built from patchset v1 (message #1), September 20, 2026 at 03:39 AM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t51348_1 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t51348_1 && git checkout t51348_1

Patchset v1 (message #1) is on t51348_1

Jump to latest
#1Kwangwon Seo
anchovyseo@gmail.com

Hi,

Using the PostgreSQL code coverage report, I found that tests for
comparisons between date and timestamp[tz] are missing. Some of them have
only partial coverage.

Attached patch will cover following functions:

date_eq_timestamp
date_ne_timestamp
date_lt_timestamp
date_gt_timestamp // already covered
date_le_timestamp
date_ge_timestamp

date_eq_timestamptz
date_ne_timestamptz
date_lt_timestamptz // already covered
date_gt_timestamptz // already covered
date_le_timestamptz
date_ge_timestamptz

timestamp_eq_date
timestamp_ne_date
timestamp_lt_date
timestamp_gt_date // already covered
timestamp_le_date
timestamp_ge_date

timestamptz_eq_date
timestamptz_ne_date
timestamptz_lt_date
timestamptz_gt_date // already covered
timestamptz_le_date
timestamptz_ge_date // already covered

This is a minor patch, but I’d like to submit it to enhance test coverage.

Best regards,
Kwangwon Seo

Attachments:

t51348_1
v1-0001-Add-test-for-extra-comparison-between-date-and-timestamp.patchtext/x-patch; charset=US-ASCII; name=v1-0001-Add-test-for-extra-comparison-between-date-and-timestamp.patchDownload+212-1
#2Rustam ALLAKOV
rustamallakov@gmail.com
In reply to: Kwangwon Seo (#1)
Re: Covering the comparison between date and timestamp, tz, type

The following review has been posted through the commitfest application:
make installcheck-world: tested, passed
Implements feature: tested, passed
Spec compliant: tested, passed
Documentation: tested, passed

Hi Kwangwon,
I have reviewed your patch.

Funtions you mention are located at src/backend/utils/adt/date.c
I tested and generated coverage report at fb844b9f06568
lines hit: 888 total: 1209 Coverage: 73.4 %

applied your patch, tested and generated report again
lines hit: 960 total: 1209 Coverage: 79.4 %

all the functions listed are now covered

date_eq_timestamp // covered
date_ne_timestamp // covered
date_lt_timestamp // covered
date_gt_timestamp // already covered
date_le_timestamp // covered
date_ge_timestamp // covered

date_eq_timestamptz // covered
date_ne_timestamptz // covered
date_lt_timestamptz // already covered
date_gt_timestamptz // already covered
date_le_timestamptz // covered
date_ge_timestamptz // covered

timestamp_eq_date // covered
timestamp_ne_date // covered
timestamp_lt_date // covered
timestamp_gt_date // already covered
timestamp_le_date // covered
timestamp_ge_date // covered

timestamptz_eq_date // covered
timestamptz_ne_date // covered
timestamptz_lt_date // covered
timestamptz_gt_date // already covered
timestamptz_le_date // covered
timestamptz_ge_date // already covered

Thank you for the patch, your patch looks good to me!
Regards
Rustam

The new status of this patch is: Ready for Committer

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Kwangwon Seo (#1)
Re: Covering the comparison between date and timestamp, tz, type

Kwangwon Seo <anchovyseo@gmail.com> writes:

Using the PostgreSQL code coverage report, I found that tests for
comparisons between date and timestamp[tz] are missing. Some of them have
only partial coverage.
Attached patch will cover following functions:
...

I'm really not very excited about adding regression test cycles
forevermore just to make these functions show as covered in the
coverage report. They are all trivial wrappers around some
"internal" comparison function, and IMO what's important to
cover is that internal function. We don't necessarily need to
check every one of the wrappers, so long as the internal function
is fully exercised.

There are other functions in these files that'd be more worthy of
dedicated tests, because they are not just trivial wrappers around
something else. For instance, it doesn't look like date_decrement,
date_increment, date_skipsupport are reached at all.

regards, tom lane