Re: Support for DATETIMEOFFSET - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Support for DATETIMEOFFSET
Date
Msg-id 20200417232511.GA15836@alvherre.pgsql
Whole thread Raw
In response to Re: Support for DATETIMEOFFSET  (Jeremy Morton <admin@game-point.net>)
List pgsql-hackers
On 2020-Apr-17, Jeremy Morton wrote:

> How could the ORM use timestamptz when that doesn't actually store both a
> datetime and an offset?

There are lots of ways in which timestamptz can be used.  The most
typical one is to rely on the TimeZone configuration parameter; another
very typical one is to have a zone specification at the end of the
timestamp literal such as "+03" or "Europe/Madrid", as Andreas Karlsson
already mentioned.  In addition to those, the "AT TIME ZONE" operator
can be used with a bare timestamp.

The main point of the timestamptz type is that both the input and output
are timezone-aware.  This timezone is not *stored*, but in most cases it
doesn't need to be.  I have never seen a case where an application
needed a timezone to be *stored* together with each timestamp value.
It's just not useful.

If you want to set up an output timezone, you can set it for each
specific user (for example).  Then all timestamps you show to that user
will use that timezone.  It's a very easy and convenient thing.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Poll: are people okay with function/operator table redesign?
Next
From: "David G. Johnston"
Date:
Subject: Re: Poll: are people okay with function/operator table redesign?