Обсуждение: User time zone ignored in JDBC/PostgreSql

Поиск
Список
Период
Сортировка

User time zone ignored in JDBC/PostgreSql

От
"Clifton B. Sothoron Jr."
Дата:
<div class="WordSection1"><p class="MsoNormal">I’ve created a user with a time zone of America/Chicago and a server
timezone of America/New York. I run the following query and America/New York is returned. The user time zone setting is
ignored.It doesn’t seem to be usable via JDBC.<p class="MsoNormal"> <p class="MsoNormal"><span
style="font-size:10.0pt;font-family:"CourierNew";color:red">select now(), extract(timezone FROM now()),
current_setting('TIMEZONE'),now()-interval '1 hour' as "1HourAgo"</span><span style="color:red"></span><p
class="MsoNormal"> <pclass="MsoNormal">I don’t see any documented PostgreSQL JDBC connection properties that cause the
usertime zone to be honored. Is there a way to via a JDBC connection to cause the user time zone to be used?  <p
class="MsoNormal"> <pclass="MsoNormal">Thanks in advance,<p class="MsoNormal"> <p class="MsoNormal">Clifton Sothoron<p
class="MsoNormal">SeniorProgrammer<p class="MsoNormal">Logi Analytics Inc.<p class="MsoNormal"> </div> 

Re: User time zone ignored in JDBC/PostgreSql

От
Dave Cramer
Дата:
This is actually an artifact of the JDBC spec which at the moment eludes me, but IIRC the time defaults to the time of the server running the application; not the server.

AFAIK we don't even look at the user timezone. 

Not sure that helps




On 6 December 2016 at 10:50, Clifton B. Sothoron Jr. <Clifton.SothoronJr@logianalytics.com> wrote:

I’ve created a user with a time zone of America/Chicago and a server time zone of America/New York. I run the following query and America/New York is returned. The user time zone setting is ignored. It doesn’t seem to be usable via JDBC.

 

select now(), extract(timezone FROM now()), current_setting('TIMEZONE'), now()-interval '1 hour' as "1HourAgo"

 

I don’t see any documented PostgreSQL JDBC connection properties that cause the user time zone to be honored. Is there a way to via a JDBC connection to cause the user time zone to be used? 

 

Thanks in advance,

 

Clifton Sothoron

Senior Programmer

Logi Analytics Inc.