Re: User time zone ignored in JDBC/PostgreSql

Dave Cramer <[email protected]> Wed, 7 Dec 2016 08:45:48 -0500
Newsgroups gmane.comp.db.postgresql.interfaces
Message-ID <CADK3HHK03Z9bGZNtUH6wcDQCyjU_KqcT-jSzU=kGpnCrka3dnA@mail.gmail.com>
--001a11c1428039a734054311be90
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

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



Dave Cramer

[email protected]
www.postgresintl.com

On 6 December 2016 at 10:50, Clifton B. Sothoron Jr. <
[email protected]> wrote:

> I=E2=80=99ve created a user with a time zone of America/Chicago and a ser=
ver 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=E2=80=99t seem =
to be
> usable via JDBC.
>
>
>
> select now(), extract(timezone FROM now()), current_setting('TIMEZONE'),
> now()-interval '1 hour' as "1HourAgo"
>
>
>
> I don=E2=80=99t 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.
>
>
>

--001a11c1428039a734054311be90
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">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 run=
ning the application; not the server.<div><br></div><div>AFAIK we don&#39;t=
 even look at the user timezone.=C2=A0</div><div><br></div><div>Not sure th=
at helps</div><div><br></div><div><br></div></div><div class=3D"gmail_extra=
"><br clear=3D"all"><div><div class=3D"gmail_signature" data-smartmail=3D"g=
mail_signature"><div dir=3D"ltr"><div>Dave Cramer<br><br><a href=3D"mailto:=
[email protected]" target=3D"_blank">[email protected]</a></div><=
div><a href=3D"http://www.postgresintl.com" target=3D"_blank">www.postgresi=
ntl.com</a></div></div></div></div>
<br><div class=3D"gmail_quote">On 6 December 2016 at 10:50, Clifton B. Soth=
oron Jr. <span dir=3D"ltr">&lt;<a href=3D"mailto:Clifton.SothoronJr@logiana=
lytics.com" target=3D"_blank">[email protected]</a>&gt;<=
/span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8=
ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang=3D"EN-US" link=3D"#0563C1" vlink=3D"#954F72">
<div class=3D"m_-8363446987344580628WordSection1">
<p class=3D"MsoNormal">I=E2=80=99ve created a user with a time zone of Amer=
ica/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 igno=
red. It doesn=E2=80=99t seem to be usable via JDBC.<u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Co=
urier New&quot;;color:red">select now(), extract(timezone FROM now()), curr=
ent_setting(&#39;TIMEZONE&#39;), now()-interval &#39;1 hour&#39; as &quot;1=
HourAgo&quot;</span><span style=3D"color:red"><u></u><u></u></span></p>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
<p class=3D"MsoNormal">I don=E2=80=99t see any documented PostgreSQL JDBC c=
onnection 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?=C2=
=A0
<u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
<p class=3D"MsoNormal">Thanks in advance,<u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
<p class=3D"MsoNormal">Clifton Sothoron<u></u><u></u></p>
<p class=3D"MsoNormal">Senior Programmer<u></u><u></u></p>
<p class=3D"MsoNormal">Logi Analytics Inc.<u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
</div>
</div>

</blockquote></div><br></div>

--001a11c1428039a734054311be90--