Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u9bJs-003sIj-AY for pgsql-novice@arkaria.postgresql.org; Tue, 29 Apr 2025 03:07:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1u9bJp-004j7v-No for pgsql-novice@arkaria.postgresql.org; Tue, 29 Apr 2025 03:07:38 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u9bJp-004j7m-FO for pgsql-novice@lists.postgresql.org; Tue, 29 Apr 2025 03:07:38 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u9bJo-0006mz-16 for pgsql-novice@lists.postgresql.org; Tue, 29 Apr 2025 03:07:37 +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 53T37Zqs945500; Mon, 28 Apr 2025 23:07:35 -0400 From: Tom Lane To: H Witt cc: "pgsql-novice@lists.postgresql.org" Subject: Re: why at time zone tz_offset not equal tz_name? tz_name has same offset in pg_timezone_names In-reply-to: References: Comments: In-reply-to H Witt message dated "Tue, 29 Apr 2025 02:40:45 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <945498.1745896055.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 28 Apr 2025 23:07:35 -0400 Message-ID: <945499.1745896055@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk H Witt writes: > select > '2025-02-03 15:04:05'::timestamptz at time zone '+08:00', > '2025-02-03 15:04:05'::timestamptz at time zone 'Asia/Shanghai' They're different because '+08:00' is read as a POSIX time zone specification, which has the opposite sign convention to what you are thinking. See https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-TI= MEZONES and especially https://www.postgresql.org/docs/current/datetime-posix-timezone-specs.html and remember the adage "The great thing about standards is there are so many to choose from". Sadly, with only two relevant standards humanity has still managed to cover the design space of which direction from Greenwich gets the positive sign. regards, tom lane