Message-ID: From: "vlsi (@vlsi)" To: "pgjdbc/pgjdbc" Date: Mon, 28 Jul 2025 04:11:28 +0000 Subject: Re: [pgjdbc/pgjdbc] issue #1325: Additional jsr 310 support In-Reply-To: References: List-Id: X-GitHub-Author-Login: vlsi X-GitHub-Comment-Id: 3125340998 X-GitHub-Comment-Type: issue_comment X-GitHub-Edited-At: 2025-07-28T04:13:17Z X-GitHub-Issue: 1325 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-Type: comment X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/issues/1325#issuecomment-3125340998 Content-Type: text/plain; charset=utf-8 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.