pgjdbc/pgjdbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
From: AFulgens (@AFulgens) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: Re: [pgjdbc/pgjdbc] issue #3930: Revert semantic calendar changes introduced with #3837
Date: Fri, 06 Feb 2026 09:41:59 +0000
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

Simple example for clarity:

Java code:
```
String insert;
insert = "insert into public.testtable(this_is_a_date) values (?)";
statement = connection.prepareStatement(insert);
statement.setDate(1, java.sql.Date.valueOf("1000-01-01"));
statement.executeUpdate();
insert = "insert into public.testtable(this_is_a_date) values ('1000-01-01')";
statement = connection.prepareStatement(insert);
statement.executeUpdate();

String select = "SELECT * FROM public.testtable";
statement = connection.prepareStatement(select);
resultSet = statement.executeQuery();

while (resultSet.next()) {
    String str = resultSet.getString(2);
    java.sql.Date date = resultSet.getDate(2);
    System.out.println("As String: " + str);
    System.out.println("As sql.Date: " + date);
    System.out.println("Epoch within sql.Date: " + date.getTime());
}
```

**Results with driver 42.7.8:**
Output:
```
As String: 1000-01-01
As sql.Date: 1000-01-01
Epoch within sql.Date: -30609795600000
As String: 1000-01-01
As sql.Date: 1000-01-01
Epoch within sql.Date: -30609795600000
```

psql:
```
postgres=# select * from public.testtable;
 id | this_is_a_date
----+----------------
 48 | 1000-01-01
 49 | 1000-01-01
(2 rows)
```


**Result with driver 42.7.9:**
Output:
```
As String: 1000-01-06
As sql.Date: 1000-01-01
Epoch within sql.Date: -30609795600000
As String: 1000-01-01
As sql.Date: 0999-12-27
Epoch within sql.Date: -30610227600000
```

psql:
```
postgres=# select * from public.testtable;
 id | this_is_a_date
----+----------------
 42 | 1000-01-06
 43 | 1000-01-01
(2 rows)
```

view thread (24+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: github://pgjdbc/pgjdbc
  Cc: [email protected], [email protected]
  Subject: Re: [pgjdbc/pgjdbc] issue #3930: Revert semantic calendar changes introduced with #3837
  In-Reply-To: <<[email protected]>>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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