JDBC and timetz again

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема JDBC and timetz again
Дата
Msg-id cb422c40-24c1-1e07-e516-360b8a609771@gmx.net
обсуждение исходный текст
Ответы Re: JDBC and timetz again  (Mark Rotteveel <mark@lawinegevaar.nl>)
Список pgsql-jdbc
Hello,

last year I asked[1] about not being able go use ResultSet.getObject(..., LocalTime.class) for columns defined as
timetz.
This typically happens when using "current_time" in a SELECT statement.

So I decided to switch to ResultSet.getTime() for those columns. However, it turns out this doesn't work properly when
DSTis in effect. 

Postgres runs locally on my laptop and my Windows is set to Europe/Berlin and to automatically adjust DST.

But when I run "SELECT current_time" at 10:00 ResultSet.getTime() returns 09:00.

I had a brief look at the source code, and it seems that the driver does try to adjust the time to the current TimeZone
(asreturned from Calendar). But still returning a time that is an hour off seems like a bug to me. 

I managed to work around that, by adding the TimeZone.getRawOffset() to the time retrieved from the driver. But that
seemswrong. 

Any ideas?


Regards
Thomas

[1] https://www.postgresql.org/message-id/flat/q89m8j%2463i8%241%40blaine.gmane.org



В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Vladimir Sitnikov
Дата:
Сообщение: [pgjdbc/pgjdbc] 9da297: chore: move code style verification to GitHubActi...
Следующее
От: Mark Rotteveel
Дата:
Сообщение: Re: JDBC and timetz again