Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eH6OP-0000Yi-7X for pgsql-jdbc@arkaria.postgresql.org; Tue, 21 Nov 2017 11:07:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eH6ON-0006NL-If for pgsql-jdbc@arkaria.postgresql.org; Tue, 21 Nov 2017 11:07:03 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eH2ZO-0007q7-Gx for pgsql-jdbc@lists.postgresql.org; Tue, 21 Nov 2017 07:02:10 +0000 Received: from [195.159.176.226] (helo=blaine.gmane.org) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eH2ZF-0001F5-3I for pgsql-jdbc@postgresql.org; Tue, 21 Nov 2017 07:02:09 +0000 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1eH2Z0-0004Cb-8d for pgsql-jdbc@postgresql.org; Tue, 21 Nov 2017 08:01:46 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-jdbc@postgresql.org From: Thomas Kellerer Subject: Retrieve the server's time zone Date: Tue, 21 Nov 2017 08:01:39 +0100 Lines: 25 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@blaine.gmane.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 X-Mozilla-News-Host: news://news.gmane.org:119 Content-Language: en-GB X-Host-Lookup-Failed: Reverse DNS lookup failed for 195.159.176.226 (failed) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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