From: Ben Hood <ben@relops.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Domain based on TIMEZONE WITH TIME ZONE
Date: Thu, 10 May 2018 20:57:23 +0100
Message-ID: <06BC29A5-4A10-4FB7-A801-FC9A2B43947D@relops.com> (raw)
In-Reply-To: <f71d464b-2469-2f27-85a6-54c64b061bd5@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>
<CALd+dcdCxk00TnL0ey_1Yk-egwwqFjF3BJbiA_=8aJwSjWP6Yw@mail.gmail.com>
<D9289E35-E24B-4C3A-8E76-18220DF01719@relops.com>
<f71d464b-2469-2f27-85a6-54c64b061bd5@aklaver.com>
> On 10 May 2018, at 18:29, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
>
> Per my previous post a timestamp with timezone is going to be stored as UTC, so there is no ambiguity there. On reflection I realized your concern maybe with determining the original input timezone. That information is not stored by Postgres, so there can be ambiguity as to their value. Doing all timestamps in UTC is one one way to eliminate this. The potential issue I see is that you now push the ambiguity into the app. Namely just from looking at the database values you still do not know what the original timezone the app lives in is.
That’s very true, I hadn’t thought of that.
The use case I have is a schema that unites billing events from disparate telecoms systems from a bunch of different carriers. The source of the non-specific timestamps is party input data files that provide different local timestamps for systems in different systems, but also different apps that submit billing events. So there are many inconsistent feeds into the database.
So when we push the ambiguity into the app, at least what is happening is the the transaction is rejected which means the app breaks. When the app breaks, we can go in and fix the timestamp bug in the particular app. Often this is difficult, and we need to reason about the source data, but the breakage at least tells us that something is wrong. Otherwise we ingress the data, do complex billing queries and then the only time we find out about a bug is when a customer complains about a particular bill. When this happens, it is really difficult to determine whether there is a bug in the query logic or if the input is bogus.
So in this sense, the database is linting the the source data.
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: ben@relops.com
Subject: Re: Domain based on TIMEZONE WITH TIME ZONE
In-Reply-To: <06BC29A5-4A10-4FB7-A801-FC9A2B43947D@relops.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> <CALd+dcdCxk00TnL0ey_1Yk-egwwqFjF3BJbiA_=8aJwSjWP6Yw@mail.gmail.com> <D9289E35-E24B-4C3A-8E76-18220DF01719@relops.com> <f71d464b-2469-2f27-85a6-54c64b061bd5@aklaver.com> <06BC29A5-4A10-4FB7-A801-FC9A2B43947D@relops.com>
* 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