From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-jdbc@postgresql.org
Subject: Retrieve the server's time zone
Date: Tue, 21 Nov 2017 08:01:39 +0100
Message-ID: <ov0j0b$nmt$1@blaine.gmane.org> (raw)
Hello,
it seems the JDBC driver (or Java?) makes it impossible to retrieve the server's time zone.
Apparently the driver changes the timezone setting so that it can't be reset to the original from the server.
When I run "show timezone" from within JDBC I *always* get the client's time zone, even if I do a "reset timezone" before that
When I do the same with psql I can see the server's time zone.
Ultimately I would like to get the server's time, e.g. by running something like:
select current_timestamp at time zone server_timezone
I already posted this to the general mailing list, because I initially thought this was a Postgres problem.
Tom Lane suggested, I could see the original time zone the server is set up with using:
select reset_val from pg_settings where name = 'TimeZone';
But that again returns the client's time zone through JDBC, but the real time zone through psql.
It seems the driver changes this setting permanently for the session.
If that is the case, can I prevent that somehow?
Thomas
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: spam_eater@gmx.net
Subject: Re: Retrieve the server's time zone
In-Reply-To: <ov0j0b$nmt$1@blaine.gmane.org>
References: <ov0j0b$nmt$1@blaine.gmane.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox