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 1tgARX-008G3u-OI for pgsql-docs@arkaria.postgresql.org; Thu, 06 Feb 2025 22:33:56 +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 1tgARV-00CmYM-Uw for pgsql-docs@arkaria.postgresql.org; Thu, 06 Feb 2025 22:33:53 +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 1tgARV-00CmXJ-Nn for pgsql-docs@lists.postgresql.org; Thu, 06 Feb 2025 22:33:53 +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 1tgART-003cvA-1W for pgsql-docs@lists.postgresql.org; Thu, 06 Feb 2025 22:33:52 +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 516MXlq21209686; Thu, 6 Feb 2025 17:33:47 -0500 From: Tom Lane To: Robert Treat cc: =?UTF-8?Q?=C3=81lvaro_Herrera?= , Laurenz Albe , bristleconeweb@gmail.com, pgsql-docs@lists.postgresql.org Subject: Re: timestamp with time zone ~> GMT In-reply-to: References: <202502031621.j4h5q2bp3orj@alvherre.pgsql> <410526.1738603387@sss.pgh.pa.us> Comments: In-reply-to Robert Treat message dated "Mon, 03 Feb 2025 16:43:04 -0500" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <1209626.1738881174.0@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Thu, 06 Feb 2025 17:33:47 -0500 Message-ID: <1209685.1738881227@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="UTF-8" Content-ID: <1209626.1738881174.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Robert Treat writes: > On Mon, Feb 3, 2025 at 12:23 PM Tom Lane wrote: >> Hmm, I kind of like the up-front statement that timestamptz stores >> UTC. How about this simpler change? > I thought the re-order made sense since the preceding paragraph talks > exclusively about behavior, so this paragraph first contrasts the > behavioral difference between the two, and then mentions the storage > aspects as part of that story. > I actually like the above as well, but if it were me I'd move all > mentions of storage (the existing + the above) to the end of the > paragraph after the behavior aspects. OK, it makes more sense when considering the previous para as well. Here's a combined proposal that also adds glossary entries. regards, tom lane ------- =_aaaaaaaaaa0 Content-Type: text/x-diff; name="v2-0001-Clarify-timestamptz-input-time-zone-behavior.patch"; charset="us-ascii" Content-ID: <1209626.1738881174.2@sss.pgh.pa.us> Content-Description: v2-0001-Clarify-timestamptz-input-time-zone-behavior.patch Content-Transfer-Encoding: quoted-printable diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml index 1d9127e94e..b20241feb5 100644 --- a/doc/src/sgml/datatype.sgml +++ b/doc/src/sgml/datatype.sgml @@ -2245,24 +2245,27 @@ TIMESTAMP '2004-10-19 10:23:54+02' TIMESTAMP WITH TIME ZONE '2004-10-19 10:23:54+02' + = - In a literal that has been determined to be timestamp without= time + + In a value that has been determined to be timestamp without t= ime zone, PostgreSQL will silently ig= nore any time zone indication. That is, the resulting value is derived from the date/time - fields in the input value, and is not adjusted for time zone. + fields in the input string, and is not adjusted for time zone. = - For timestamp with time zone, the internally stored - value is always in UTC (Universal - Coordinated Time, traditionally known as Greenwich Mean Time, - GMT). An input value that has an explicit - time zone specified is converted to UTC using the appropriate offse= t + For timestamp with time zone values, an input string + that includes an explicit time zone will be converted to UTC + (Universal Coordinated + Time) using the appropriate offset for that time zone. If no time zone is stated in the input string, then it is assumed to be in the time zone indicated by the system's parameter, and is converted to UTC= using the offset for the timezone zone. + In either case, the value is stored internally as UTC, and the + originally stated or assumed time zone is not retained. = diff --git a/doc/src/sgml/glossary.sgml b/doc/src/sgml/glossary.sgml index f54f25c1c6..c0f812e3f5 100644 --- a/doc/src/sgml/glossary.sgml +++ b/doc/src/sgml/glossary.sgml @@ -851,6 +851,11 @@ = + + GMT + + + Grant @@ -2047,6 +2052,17 @@ = + + UTC + + + Universal Coordinated Time, the primary global time reference, + approximately the time prevailing at the zero meridian of longitude. + Often but inaccurately referred to as GMT (Greenwich Mean Time). + + + + Vacuum ------- =_aaaaaaaaaa0--