pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Karsten Hilbert <Karsten.Hilbert@gmx.net>
To: pgsql-general@lists.postgresql.org
Subject: Re: Domain based on TIMEZONE WITH TIME ZONE
Date: Thu, 10 May 2018 16:17:21 +0200
Message-ID: <20180510141721.GE3622@hermes.hilbert.loc> (raw)
In-Reply-To: <adb8d193-e9a6-f141-2c59-9291ad6c5220@aklaver.com>
References: <06EAD729-DC35-4E48-AB25-C42F7FA19C28@relops.com>
	<CA+bJJbz0Gwo8mkyzHa_4qjcNcMV0M00yTZ_LjUtaJu=M=+bpyQ@mail.gmail.com>
	<188A0270-0A9A-4ADE-A928-9067E99AE7B7@relops.com>
	<20180510103608.GB3622@hermes.hilbert.loc>
	<BCC1C385-7AAC-42BD-B790-08D7624C9414@relops.com>
	<adb8d193-e9a6-f141-2c59-9291ad6c5220@aklaver.com>

On Thu, May 10, 2018 at 06:41:04AM -0700, Adrian Klaver wrote:

>> OK, so by using TIMESTAMP WITH TIME ZONE, you force all apps to submit timezone qualified timestamps in what language they are written in.
> 
> Not really:
> 
> https://www.postgresql.org/docs/10/static/datatype-datetime.html
> 
> "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 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 TimeZone parameter, and is converted to UTC using
> the offset for the timezone zone."

True enough, I didn't remember that behaviour.

And since a BEFORE UPDATE/INSERT trigger will see the data to
be inserted PG will have already done that while parsing from
on-the-wire data into in-memory ts-w-tz presentation so we
can't simply use a trigger to enforce explicit specification
of a timezone.

Therefore, a domain could work but will require client
language support for easy integration.

> > And because of the internal UTC representation, there is no room for ambiguous timezones.
> 
> Define ambiguous timezone?

OP likely means underspecified for his use case (= not
assuming "unspecified" to mean "TimeZone value"). But, then,
OP could always force TimeZone to UTC on his servers :-)

Karsten
-- 




view thread (36+ messages)  latest in thread

Message-ID: <20180510141721.GE3622@hermes.hilbert.loc>
Permalink:  ../20180510141721.GE3622@hermes.hilbert.loc/
Also on:    postgresql.org/message-id/20180510141721.GE3622@hermes.hilbert.loc

 · 

reply

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: Karsten.Hilbert@gmx.net
  Subject: Re: Domain based on TIMEZONE WITH TIME ZONE
  In-Reply-To: <20180510141721.GE3622@hermes.hilbert.loc>
  References: <06EAD729-DC35-4E48-AB25-C42F7FA19C28@relops.com> <CA+bJJbz0Gwo8mkyzHa_4qjcNcMV0M00yTZ_LjUtaJu=M=+bpyQ@mail.gmail.com> <188A0270-0A9A-4ADE-A928-9067E99AE7B7@relops.com> <20180510103608.GB3622@hermes.hilbert.loc> <BCC1C385-7AAC-42BD-B790-08D7624C9414@relops.com> <adb8d193-e9a6-f141-2c59-9291ad6c5220@aklaver.com> <20180510141721.GE3622@hermes.hilbert.loc>

* 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