Skip to content

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

@mwinkels-bol

Description

@mwinkels-bol

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions