Re: When exactly is a TIMESTAMPTZ converted to the sessions time zone?

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Thomas Kellerer <spam_eater(at)gmx(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: When exactly is a TIMESTAMPTZ converted to the sessions time zone?
Date: 2018-08-09 20:49:44
Message-ID: 20180809204944.GC14030@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jul 3, 2018 at 05:00:17PM -0400, Tom Lane wrote:
> Thomas Kellerer <spam_eater(at)gmx(dot)net> writes:
> > A recent discussion around timestamptz behaviour has lead me to question my own understanding on how a TIMESTAMPTZ is converted to the session's time zone.
> > I assumed this conversion happens *on the server* before the value is sent to the client.
>
> It's done in the datatype's output conversion function.
>
> > A co-worker of mine claims that this is purely a client side thing, and that the server will always send the "plain" UTC value that is stored in a timestamptz column.
>
> Your co-worker is certainly wrong so far as text output is concerned.
> If you retrieve data in binary format, though, it looks like you get
> the raw (un-rotated) timestamp value, so that any conversion would have
> to be done on the client side.

Wow, I am kind of surprised by that. Do any other data types have this
behavior?

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Paul Jungwirth 2018-08-09 21:08:20 Re: When exactly is a TIMESTAMPTZ converted to the sessions time zone?
Previous Message Bruce Momjian 2018-08-09 20:01:31 Re: Convert Existing Table to a Partition Table in PG10