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 1n8OSK-0006Hb-3d for pgsql-bugs@arkaria.postgresql.org; Fri, 14 Jan 2022 15:25:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n8OSI-0008G9-25 for pgsql-bugs@arkaria.postgresql.org; Fri, 14 Jan 2022 15:25:30 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n8OSH-0008G0-QL for pgsql-bugs@lists.postgresql.org; Fri, 14 Jan 2022 15:25:29 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n8OSB-0008C3-7I for pgsql-bugs@lists.postgresql.org; Fri, 14 Jan 2022 15:25:28 +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 20EFOqhn3379885; Fri, 14 Jan 2022 10:24:52 -0500 From: Tom Lane To: Francisco Olarte cc: dafoer_x@163.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17366: Error result returned in timestamp2timestamptz, expected to be off by one hour In-reply-to: References: <17366-8744a901d10fd9d1@postgresql.org> Comments: In-reply-to Francisco Olarte message dated "Fri, 14 Jan 2022 12:30:54 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3379883.1642173892.1@sss.pgh.pa.us> Date: Fri, 14 Jan 2022 10:24:52 -0500 Message-ID: <3379884.1642173892@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Francisco Olarte writes: > On Fri, 14 Jan 2022 at 11:15, PG Bug reporting form > wrote: >> postgres=# set timezone to "PST8PDT"; >> .. >> postgres=# select (timestamp '2021-03-14 02:00:00')::timestamptz; >> 2021-03-14 03:00:00-07 >> postgres=# select (timestamp '2021-03-14 03:00:00')::timestamptz; >> 2021-03-14 03:00:00-07 > You are playing around the DST changes, and timestamp must have unique > representations, for informal descriptions "time jumps from 2 to 3" is > fine, when dealing with real data you must decide if it jumps just > before or just after, it seems your expectations are wrong: Yeah. See https://www.postgresql.org/docs/devel/datetime-invalid-input.html (I'm pointing you to the devel version of that page because it contains a correction that hasn't yet propagated into the other versions) regards, tom lane