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

Error when storing BC dates (e.g. "0000-12-31T01:01:00Z") #578

Closed
mwinkels-bol opened this issue Jan 27, 2023 · 1 comment
Closed

Error when storing BC dates (e.g. "0000-12-31T01:01:00Z") #578

mwinkels-bol opened this issue Jan 27, 2023 · 1 comment
Labels
type: bug A general bug
Milestone

Comments

@mwinkels-bol
Copy link

mwinkels-bol commented Jan 27, 2023

Bug Report

When storing a date that is BC (Before Christ) an error is thrown.

Versions

  • Driver: 0.9.3.RELEASE
  • Database: 12.11 / 13.3
  • Java: 17
  • OS: MacOS / Ubuntu

Current Behavior

A date that is BC (e.g. Year 0) will throw an error e.g. [22008] date/time field value out of range: "0000-12-31T01:01:00Z"
The driver is using Instant::toString for conversion, but this ignores the ERA (BC) and the database does not accept this as a value.
PostgreSQL can properly store these dates, but the driver implementation now prevents users from inserting it.

Steps to reproduce

As part of AbstractCodecIntegrationTests

testCodec(Instant.class, Instant.parse("0000-12-31T01:01:00Z"), "TIMESTAMPTZ");

Expected behavior/code

Dates BC should also be inserted by the driver.

@mwinkels-bol mwinkels-bol added the status: waiting-for-triage An issue we've not yet triaged label Jan 27, 2023
@mp911de
Copy link
Collaborator

mp911de commented Feb 16, 2023

Looking into our temporal support, the way we handle overflow values and extremes aren't ideal. all of this requires a bit of revision to align with the awesome work done in the JDBC Postgres driver.

@mp911de mp911de added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 16, 2023
@mp911de mp911de added this to the 1.0.1.RELEASE milestone Feb 16, 2023
@mp911de mp911de changed the title Error when storing an instant BC (e.g. "0000-12-31T01:01:00Z") Error when storing BC dates (e.g. "0000-12-31T01:01:00Z") Feb 16, 2023
mp911de added a commit that referenced this issue Feb 16, 2023
We now revised text-encoded temporal value parsing to accomodate for proper timezone and ERA indicators. Also, we now translate infinity and -infinity values into the corresponding MAX (e.g. LocalDateTime.MAX) and MIN values.

[resolves #578]

Signed-off-by: Mark Paluch <mpaluch@vmware.com>
mp911de added a commit that referenced this issue Feb 16, 2023
Avoid now timestamps to avoid formatting issues that are not relevant to assertions.

[#578]

Signed-off-by: Mark Paluch <mpaluch@vmware.com>
mp911de added a commit that referenced this issue Feb 16, 2023
Avoid now timestamps to avoid formatting issues that are not relevant to assertions.

[#578]

Signed-off-by: Mark Paluch <mpaluch@vmware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants