Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WrAiI-0000A4-If for pgsql-jdbc@arkaria.postgresql.org; Sun, 01 Jun 2014 18:42:34 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WrAiH-0006HT-9n for pgsql-jdbc@arkaria.postgresql.org; Sun, 01 Jun 2014 18:42:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1WrAiE-0006Gf-FU; Sun, 01 Jun 2014 18:42:30 +0000 Received: from smtp160.dfw.emailsrvr.com ([67.192.241.160]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1WrAi5-0005iI-Uj; Sun, 01 Jun 2014 18:42:27 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp16.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id 676F540286; Sun, 1 Jun 2014 14:42:14 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp16.relay.dfw1a.emailsrvr.com (Authenticated sender: david.wall-AT-yozons.com) with ESMTPSA id A96A140238; Sun, 1 Jun 2014 14:42:11 -0400 (EDT) Message-ID: <538B7404.7080601@computer.org> Date: Sun, 01 Jun 2014 11:42:12 -0700 From: David Wall User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: pgsql-general@postgresql.org, pgsql-jdbc@postgresql.org Subject: Re: [GENERAL] Upgrading from PG 8.3.3 to 9.3.4 - FATAL: invalid value for parameter "TimeZone": "PST" References: <538ACAFE.1050404@computer.org> <538ACC7D.9050302@hogranch.com> <538AD2C7.6080107@yozons.com> <538AD36A.3010002@computer.org> <538B4F3B.5070006@aklaver.com> In-Reply-To: <538B4F3B.5070006@aklaver.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org On 6/1/2014 9:05 AM, Adrian Klaver wrote: > > I ask because a look at the PG JDBC code shows this, which did not > show up until Sept 22, 2011. Not sure what release, but it looks like > 9.2+: > > // Construct and send a startup packet. > String[][] params = { > { "user", user }, > { "database", database }, > { "client_encoding", "UTF8" }, > { "DateStyle", "ISO" }, > { "extra_float_digits", "2" }, > { "TimeZone", > createPostgresTimeZone() }, > > > /** > * Convert Java time zone to postgres time zone. > * All others stay the same except that GMT+nn changes to GMT-nn and > * vise versa. > * > * @return The current JVM time zone in postgresql format. > */ > private String createPostgresTimeZone() { > String tz = TimeZone.getDefault().getID(); > if (tz.length() <= 3 || !tz.startsWith("GMT")) { > return tz; > } > char sign = tz.charAt(3); > String start; > if (sign == '+') { > start = "GMT-"; > } else if (sign == '-') { > start = "GMT+"; > } else { > // unknown type > return tz; > } > > return start + tz.substring(4); > > Ahh I see the problem. > > From here: > A time zone abbreviation, for example PST. Such a specification merely > defines a particular offset from UTC, in contrast to full time zone > names which can imply a set of daylight savings transition-date rules > as well. The recognized abbreviations are listed in the > pg_timezone_abbrevs view (see Section 47.70). You cannot set the > ^^^^^^^^^^^^^^^^^^ > configuration parameters TimeZone or log_timezone to a time zone > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > abbreviation, but you can use abbreviations in date/time input values > ^^^^^^^^^^^^^ > and with the AT TIME ZONE operator. > > > So: > > test=> select version(); > version > > ----------------------------------------------------------------------------------------------------------------------------- > > PostgreSQL 9.3.4 on i686-pc-linux-gnu, compiled by gcc (SUSE Linux) > 4.7.2 20130108 [gcc-4_7-branch revision 195012], 32-bit > (1 row) > > test=> set TimeZone='PST'; > ERROR: invalid value for parameter "TimeZone": "PST" > test=> set TimeZone='PST8PDT'; > SET > > The JDBC code above, if I am following correctly, is picking up a > default timezone of 'PST' and then in the first if returning that as > the tz value to SET TimeZone in the startup packet. > > Two things. > > 1) Where is it getting PST from ? > > 2) Should the driver even be returning an abbreviation given that > Postgres will not accept it as a TimeZone value? > Thanks for the extra help, Adrian. It led me to investigate the 35 webapps we deploy on Tomcat and I found 2 rogue apps that set their timezone to "PST". Once I fixed these two, all is working great again. I guess there's no bug, per se, except in our configuration. Once we changed it to PST8PDT, all was good again. Thanks, David -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc