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.96) (envelope-from ) id 1wNUhB-000qxK-2i for pgsql-docs@arkaria.postgresql.org; Thu, 14 May 2026 11:57:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wNUh8-00Bzk0-2D for pgsql-docs@arkaria.postgresql.org; Thu, 14 May 2026 11:57:38 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wNUh8-00Bzjs-17 for pgsql-docs@lists.postgresql.org; Thu, 14 May 2026 11:57:38 +0000 Received: from mail-vk1-xa32.google.com ([2607:f8b0:4864:20::a32]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wNUh5-00000000Z9E-3j0p for pgsql-docs@lists.postgresql.org; Thu, 14 May 2026 11:57:38 +0000 Received: by mail-vk1-xa32.google.com with SMTP id 71dfb90a1353d-575124e716fso2825635e0c.1 for ; Thu, 14 May 2026 04:57:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1778759854; cv=none; d=google.com; s=arc-20240605; b=Qcs3O3HmmagAJkoiQxkxipGPlxMb0+hAXT8TT+0WYOpw22bE2p69phlg70lnKLfwxx 39xgop8AOsXctFOG1Z7EJaw3jN9NwzjrZyS/VD0RK6AVReb7ZLgPQvQzC+vlfNQANfSl aXM7wKGGFoMcNqDVszCT5DjuY886w6Am+f2dTbQykj4KW0jprgNF4FP+M8pWe7bfBH0v 2H7KQJlATyyhsG/Szs6Q1rsQbcMDyH21D+N/nnRKa2dVC3psIolWk6HxgW5c0oY11M8j YPUIQ9GjvqqceguJ+XyIrwNo15xC84pRGbHmn+QVeU8LZPmHqiWVlNuNEMq7jfQwuO+l Bhlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=XTWzTA+JISRpr2683/1/0uJtxbNTz2UovUwuWkcEkY8=; fh=sEjFQNWymo5rs7r228ZO9koyDez1xGS816S5QiwFGQw=; b=W3z/BNiz8/FNJiTZhQhq8r23AGnDF8WHhcHSPBK+XCZS51JDw8laBi2CkpRCdl37Fq Hd6rUtT116MyfZBcbZbMr3SKVAYeUKdwcqEMUQMBDNSr1daQzu7VOoBRGbp7M9fJ3EUv nLlwbcZ5pPghQMA+C1xHQ9MD+qhTtoLOj5ZBHX07REy3abwFQH1WzGhiASm6R8TB7RCh AQYoyM6wzrF1K0HkITiekFf/dnjuEyN9eBnA4VVphmrsSxz4UCwbxMubpX6G1yhVIxAa tvfea432Zx5SjpYRR/W5GNXkShCPNafIegw3hBOeBTXTxLY4fgbcX0x4WeQkz2YFiJhg 5zbw==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xzilla-net.20251104.gappssmtp.com; s=20251104; t=1778759854; x=1779364654; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=XTWzTA+JISRpr2683/1/0uJtxbNTz2UovUwuWkcEkY8=; b=tv8FNPWLFE+d5mvkn0qj4u/o9jOLgbGbGVdvI13fhiht9OzA+qj2ZnxbBzmZDE4ogL Jd9ux0qDviwGQ49N4EEM+YWXlqSTItiecB0qakmhCD4iDsYvtiRG5U3YDnVpngj+X3Pr rQauk1jU4Kpvi4ZFVY2mlyxT4+qs4Q9b+J5fVlnce4UwAClEYKC0urJJ3O+sDqg0Mg1k 8EZoaPpdClaq9+e5jdPZsSfkbl3VJi85uBCBjtVrtPaxA8oe/QPk/5e+U1eeRipoPwDD 2itqHBVUDrvoqr01k5tj8yATv3JFIPUBTAz6JLu0Xbm+O2vJwMLfX111aTrh3vLJDRwt +5EQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778759854; x=1779364654; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=XTWzTA+JISRpr2683/1/0uJtxbNTz2UovUwuWkcEkY8=; b=CaTq0Il+K8YbxWrlFWxJtYP2QDpNcvRSAF/1XUiNi9qC0S9CVOzOegh9qjluMUiekn 3jwuwriNouMDOhmCn783NewJrtoygkLnr8mS/LxbAUjWd7SiHwx5dVJorMcaSgw4Asqx kwqCqw+UyktTP0bkd7y3y69pktgaB8Yb4lRqiCtkqYvjN+SbnLV8Ke5zXAoaQ5Kxazay 2mLP6h3GbHnXP7XRlRwD9DkfNED3Jf1ytUgnDVvUgJrrleXCm1N4hpyqZfOApxfV2D6z wIeirLS7Xl82oV5q+iCsy8Ro84hXJqaTzqxhKP3JyBisnYFhUxPbbPPNGmCdRBG9OZE1 R11A== X-Forwarded-Encrypted: i=1; AFNElJ8QHj/qIcc4zhFkmb0b5M/6nvlmTT5djyUkn+X0BqCQdNdhjwsprLM/m4yq5Ov3NXC7Gw3qK6xfxzwa@lists.postgresql.org X-Gm-Message-State: AOJu0Yzm6MAEymHJ/yP+19rHdC5TQJMYtyd8KsaxrgfpcHitsNWCn61J BBBxPF0NOCflbAUwY7ikKzpkK6u2N4Sf1YG/BTtTaAcfCUzNOxul0DBNM+7YKfSi4vjHpBepH41 WYQL0qQt0u+TZ+9BGIcgJAWyyCDt276pO7VL8H63hRQ== X-Gm-Gg: Acq92OE3XBfDng1vPU1/mLznnqXzu/4YrN2XzXVLjhYNBXC31NnpRILTqISBkO1Lwpl n6Nah/o1nfrxyrbpHYxGamchh843GVHMnt7JI/3ygkiUKmkIbAX02vIzRllOg5onVl/iffrURoB 37WytPCRMl7RvZjMbDQOlpzplfJxgm36UlveRzknsBhWEPCjZVSIJXIjDjCAOdFMp9oJP6VSeuf 2/gJPylN5lFxczMVPuBQwqg78z+cUaONCSeCk9F4ta3ALhEb4SzpRdwrqE/7lO93RwnfF5voAFv s5rKa7wqYWlPYlsE0Q== X-Received: by 2002:a05:6102:4a83:b0:631:28c1:155c with SMTP id ada2fe7eead31-63771a7f15emr3691586137.7.1778759853980; Thu, 14 May 2026 04:57:33 -0700 (PDT) MIME-Version: 1.0 References: <177685804902.403059.7237129094698721575@wrigleys.postgresql.org> In-Reply-To: From: Robert Treat Date: Thu, 14 May 2026 07:57:21 -0400 X-Gm-Features: AVHnY4JuzQCQB2N5ztR_03ONTPM6aTuNYmJfI_LkiNfhS1pjZoT-GnXSSXsWXYI Message-ID: Subject: Re: Please clarify that Timestamp with Timezone doesn't preserve the timezone. To: Bruce Momjian Cc: Kirk Parker , Richard Neill , github@richardneill.org, pgsql-docs@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, May 13, 2026 at 1:45=E2=80=AFPM Bruce Momjian wr= ote: > On Wed, May 13, 2026 at 08:57:54AM -0700, Kirk Parker wrote: > > On Wed, May 13, 2026 at 6:13=E2=80=AFAM Bruce Momjian wrote: > > > > On Wed, May 13, 2026 at 03:21:11AM +0100, Richard Neill wrote: > > > Hi Bruce, > > > > > > Thanks for your reply. Yes I think it does need to be stated more= boldly > > - > > > from a "Poka-Yoke" perspective (and despite using Postgresql for = years), > > I > > > didn't properly understand it the first time. > > > > > > I think it's a gotcha, because, to me, the name suggests a differ= ent > > > behaviour. > > > I understood "timestamp with timezone" as "a data type which stor= es the > > > timestamp, and stores the timezone WITH (i.e. alongside) it". > > > > Yes, the name is confusing. > > > > If it could be done over, naming it "universal timestamp" or "utc times= tamp" > > would be better, But of course there is no possibility of changing i= t at > > this late date. > > Yes, the SQL standard requires the syntax we currently support. > > > > While looking at the docs, I can also see 3 other things that wou= ld be > > > helpful to add: > > > > > > 1. How to actually store "timestamp_and_timezone" ? (i.e. I want = to store > > > the UTC value, and I want to store and retrieve the original offs= et). > > > Presumably the answer is to store both timestamptz AND the intege= r > > tz_offset > > > (is there a "timezone" datatype, or should that just be a string?= ) > > > > Yes. > > > > Yes, not sure why this is a difficult concept. "A unique and universal > > representation of a specific moment of terrestrial timekeeping" is what= the > > timestamptz stores. If you want to record the offset (or timezone regio= n, which > > is not exactly the same thing) from the user's perspective, go ahead an= d create > > a column for that. FWIW I can't think of a single time in over 3 decad= es of > > building databases where I would have wanted that, but if your use case= needs > > it the implementation is simple and obvious. > > True, I have never seen this requested either. > It is actually requested so often, there is an extension for it. https://pgxn.org/dist/timestampandtz/ That said, I would note that most people who go down that path usually find that it has a hard time holding up, due to general complexity and misunderstanding of how time, dates, and timezones really work. For example, both upthread examples of where this would apply are not always true; new years don't always start at midnight (some lunar calendars mark the new year based on visibility of the moon, not a specific time like midnight; not to mention places that may operate under multiple (ie local vs official timezones). Similarly, if you can find a global business that will let you measure its business statistics 9-5 m-f, well, what a way to make a living I guess. But my point here is that if you think this is what you need, check out the extension above. > > How could we usefully make a single recommendation? The only plausible > > recommenation is "use the datatype that best suits your purposes", and = if the > > documentation doesn't do an adequate job of describing the differences = and > > applicability, that's what should be addressed, rather than asking for = a > > one-size-fits-all recommendation. > > Agreed. > > > And looking at the chapter again, I think table 8.9 does foster the con= fusion: > > > > Name Description > > timestamp [ without time zone ] =3D=3D both date and time (no tim= e zone) > > timestamp with time zone =3D=3D both date and time, with t= ime zone > > > > Here Description is presented generally, but in fact it only describes = the i/o > > presentation of the two types. *Storage* for both types is identical (= or at > > least appears that way to the user). > > > > What about something like: "Timestamp [Without Time Zone] takes the the= date/ > > time verbatim without any reference to time zones, whereas Timestamp Wi= th Time > > Zone converts from the specified offset (or session's time zone if no o= ffset is > > specified) to UTC for storage, and on retrieval converts to the session= 's time > > zone". That's fairly wordy for a table entry, but it does do a better = job of > > conveying what's actually happening and omits the implication that we s= tore the > > session's time zone or offset along with the UTC timestamp. > > I see your point. I went with adding the wording "no time zone > adjustment" and "with time zone adjustment" in the table. Patch > attached. You can see the output at: > The quibble I have with the term "time zone adjustment" is that it implies there will be some adjustment, but while you can change your timezone preferences to display a timestamptz value in whatever time zone you want, the value itself is never adjusted; it is stored as a universal moment in time that doesn't change, regardless of the window dressing around it. For this reason I have taken to describing that difference between the two as that timestamptz stores the date and time with timezone awareness, and timestamp is date and time with no timezone awareness. Perhaps that might work better here as well? Robert Treat https://xzilla.net