From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-general@postgresql.org
Subject: Re: Converting timestamp to timestamptz without rewriting tables
Date: Mon, 18 Dec 2017 09:13:38 +0100
Message-ID: <p17t7n$8eh$1@blaine.gmane.org> (raw)
In-Reply-To: <CAPPfruwjvTkCBDdzukzkzHK1YHL4qwcL1qH=anhx3XXdsR=nNg@mail.gmail.com>
References: <CAPPfruwjvTkCBDdzukzkzHK1YHL4qwcL1qH=anhx3XXdsR=nNg@mail.gmail.com>
Tom Dunstan schrieb am 18.12.2017 um 09:08:
> We have generally been using timestamps without timezones in our
> system. As both our app servers and db server were set to UTC it so
> far hasn't been an issue. However, that may not always be the case,
> so we want to tighten things up a bit. We are also needing to do
> things like get the particular date that a timestamp in the db refers
> to, and thus need to be explicit about which timezone everything is
> in.
>
> All of the timestamps in our system represent an instant in time, not
> a clock date/time, so timestamp with time zone is more appropriate.
> All of the data that is currently on disk in timestamp columns was
> inserted in a db session in UTC, and represents that timestamp in
> UTC.
Are you aware of the fact that "timestamp with time zone" does NOT actually store the time zone?
A timestamptz stores everything as UTC and the value is converted to the session time zone upon retrieval.
Thomas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: spam_eater@gmx.net
Subject: Re: Converting timestamp to timestamptz without rewriting tables
In-Reply-To: <p17t7n$8eh$1@blaine.gmane.org>
References: <CAPPfruwjvTkCBDdzukzkzHK1YHL4qwcL1qH=anhx3XXdsR=nNg@mail.gmail.com> <p17t7n$8eh$1@blaine.gmane.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox