Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mdYJt-0002Ip-E3 for pgsql-bugs@arkaria.postgresql.org; Thu, 21 Oct 2021 13:41:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mdYJr-0003Eb-MU for pgsql-bugs@arkaria.postgresql.org; Thu, 21 Oct 2021 13:41:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mdYJr-0003ES-FC for pgsql-bugs@lists.postgresql.org; Thu, 21 Oct 2021 13:41:19 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mdYJk-0004Ws-8T for pgsql-bugs@lists.postgresql.org; Thu, 21 Oct 2021 13:41:19 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 19LDf0ee2402844; Thu, 21 Oct 2021 09:41:01 -0400 From: Tom Lane To: marek.lall@eesti.ee cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17240: at time zone ... ; wrong result In-reply-to: <17240-cdccc24b9eee2d2c@postgresql.org> References: <17240-cdccc24b9eee2d2c@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Thu, 21 Oct 2021 09:48:39 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2402842.1634823660.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 21 Oct 2021 09:41:00 -0400 Message-ID: <2402843.1634823660@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > # select now() > , now() at time zone 'America/Los_Angeles' as correct > , now() at time zone '-07:00:00' as wrong; Unfortunately, the pure-numeric syntax for time zone names follows the POSIX sign convention, which is opposite to the ISO convention used in pg_timezone_names.utc_offset (and in most other places in Postgres). So "at time zone '+07:00:00'" is what you needed to write to duplicate the 'America/Los_Angeles' result. See https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-TI= MEZONES Now, if you'd done this: select ... now() at time zone interval '-07:00:00' as fine you'd have gotten the ISO sign interpretation. But an undecorated literal string defaults to being of type text, meaning you get the time-zone-name logic path. The great thing about standards is there are so many to choose from :-( regards, tom lane