Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vbruw-000169-Ms for pgsql-bugs@arkaria.postgresql.org; Thu, 31 Oct 2013 13:04:06 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Vbruv-0001RG-TB for pgsql-bugs@arkaria.postgresql.org; Thu, 31 Oct 2013 13:04:05 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vbrut-0001R1-Uo for pgsql-bugs@postgresql.org; Thu, 31 Oct 2013 13:04:04 +0000 Received: from mahout.postgresql.org ([2001:4800:7903:4::123]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vbrum-0002q2-Jq for pgsql-bugs@postgresql.org; Thu, 31 Oct 2013 13:04:03 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by mahout.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vbrul-0003t9-9f for pgsql-bugs@postgresql.org; Thu, 31 Oct 2013 13:03:55 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.80) (envelope-from ) id 1Vbruf-0000CQ-QH for pgsql-bugs@postgresql.org; Thu, 31 Oct 2013 13:03:49 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: BUG #8572: Combination of SET TIME ZONEs and CAST gives wrong results To: pgsql-bugs@postgresql.org From: przemek@hadapt.com Message-Id: Date: Thu, 31 Oct 2013 13:03:49 +0000 X-Pg-Spam-Score: -2.4 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org The following bug has been logged on the website: Bug reference: 8572 Logged by: Combination of SET TIME ZONEs and CAST gives wrong results Email address: przemek@hadapt.com PostgreSQL version: 9.1.10 Operating system: Ubuntu 12.04.3 LTS Description: Reproduction: postgres=# set time zone 'Europe/Warsaw'; SET postgres=# set time zone '-1.5'; SET postgres=# select cast('2012-12-12 12:00 Europe/Warsaw' AS timestamp with time zone); timestamptz --------------------------- 2012-12-12 12:00:00-01:30 (1 row) The same happens for other timezones too, like: postgres=# set time zone 'Europe/London'; SET postgres=# set time zone '-1.5'; SET postgres=# select cast('2012-12-12 12:00 Europe/London' AS timestamp with time zone); timestamptz --------------------------- 2012-12-12 12:00:00-01:30 (1 row) Note, however, that it happens only if the first SET value matches the timezone given in timestamp string. If they differ, then the result is correct: postgres=# set time zone 'Europe/London'; SET postgres=# set time zone '-1.5'; SET postgres=# select cast('2012-12-12 12:00 Europe/Warsaw' AS timestamp with time zone); timestamptz --------------------------- 2012-12-12 09:30:00-01:30 (1 row) Bug exsists in 9.2.2 (tested on CentOS 6.3), 9.1.10 (Ubuntu 12.04.3 LTS) and 9.0.6 (CentOS 6.3) versions -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs