pgjdbc/pgjdbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
From: vlsi (@vlsi) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: Re: [pgjdbc/pgjdbc] issue #1325: Additional jsr 310 support
Date: Mon, 28 Jul 2025 04:11:28 +0000
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

There are multiple demands mixed in the issue, so I decided to give it a try and implemented `Instant` for `timestamptz` and `timetz`.

See #3734

> marschall: I am against supporting Instant for TIMESTAMP

+1

---

Regarding `ZonedDateTime`. I believe we should support them as well.
The extra motivation is that PostgreSQL happily supports `'America/New_York'` in `timestamptz` literals, and it just converts the rich timezone name to a UTC.
If we do the same thing. For example if take `ZonedDateTime with rich ZoneRegion` and convert it to `OffsetDateTime` when sending the value to the DB, it is not much different from the case user went with `TIMESTAMP '... America/New_York'` literal.

---

> michalkoza: Instant is a moment in time in UTC. The same goes for TIMESTAMP type in PostgreSQL

@michalkoza , please check out https://wiki.postgresql.org/wiki/Don%27t_Do_This#Don.27t_use_timestamp_.28without_time_zone.29

> `timestamp` (also known as `timestamp without time zone`) doesn't do any of that, it just stores a date and time you give it. You can think of it being a picture of a calendar and a clock rather than a point in time. Without additional information - the timezone - **you don't know what time it records**. Because of that, arithmetic between timestamps from different locations or between timestamps from summer and winter **may give the wrong answer**.

> So if what you want to store is a point in time, rather than a picture of a clock, use `timestamptz`.

On top of that, there's an explicit `Don't use timestamp (without time zone) to store UTC times` section.

view thread (25+ 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 #1325: Additional jsr 310 support
  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