Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Fix failing datetime comparison tests in Oracle #1813

Merged
merged 2 commits into from
Aug 1, 2023

Conversation

bog-walk
Copy link
Member

The following tests in exposed-java-time and exposed-kotlin-datetime fail when run using Oracle:

MiscTableTest/testSelect01()
MiscTableTest/testSelect02()

Fails with an internal equality comparison issue due to precision, which returns an empty collection when single() is called.

The datetime() column maps to TIMESTAMP without specifying a precision, so the DB defaults to a length of 6 digits, and the value is round up internally instead of being truncated.

For example, if the value "2023-07-31 13:00:21.871130789" is inserted, the value stored is 2023-07-31T13:00:21.871131. This causes an issue in the WHERE clause when the literal comparison value '2023-07-31 13:00:21.871' is used.

Explicitly casting the datetime literal in the WHERE clause causes the appropriate comparison to occur.

A new unit test specifically for this comparison issue showed that the same issue was also occurring in certain H2 modes, causing flaky local tests.

@bog-walk bog-walk requested review from Tapac, e5l and joc-a and removed request for Tapac July 31, 2023 17:14
In both exposed-java-time and exposed-kotlin-datetime modules:

MiscTableTest/testSelect01()
MiscTableTest/testSelect02()

Fails with an internal equality comparison issue due to precision.

The datetime() column maps to TIMESTAMP without specifying a precision, so each
DB defaults to a certain number of digits. This number is 6 in Oracle, and the
value is round up internally instead of being truncated.

Explicitly casting the datetime literal in the WHERE clause causes the appropriate
comparison to occur.

A new unit test specifically for this issue showed that the same issue was also
occurring in certain H2 modes, causing flaky local tests.
Rename database list that requires casting.
@bog-walk bog-walk force-pushed the bog-walk/fix-oracle-datetime-comparison branch from 3c9b19e to 834d762 Compare August 1, 2023 10:09
@bog-walk bog-walk merged commit 75a9aeb into main Aug 1, 2023
@bog-walk bog-walk deleted the bog-walk/fix-oracle-datetime-comparison branch August 1, 2023 13:11
saral pushed a commit to saral/Exposed that referenced this pull request Oct 3, 2023
* test: Fix failing datetime comparison tests in Oracle

In both exposed-java-time and exposed-kotlin-datetime modules:

MiscTableTest/testSelect01()
MiscTableTest/testSelect02()

Fails with an internal equality comparison issue due to precision.

The datetime() column maps to TIMESTAMP without specifying a precision, so each
DB defaults to a certain number of digits. This number is 6 in Oracle, and the
value is round up internally instead of being truncated.

Explicitly casting the datetime literal in the WHERE clause causes the appropriate
comparison to occur.

A new unit test specifically for this issue showed that the same issue was also
occurring in certain H2 modes, causing flaky local tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants