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 21:37:26 +0100
Message-ID: <D03AF820-9FFF-414F-8747-B3589FBB9224@relops.com> (raw)
In-Reply-To: <CA+bJJbyNTns-AMVUbztjb+zeNZ-z0gH=6vXykZCmjCJiK1GogA@mail.gmail.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>
<CA+bJJbyNTns-AMVUbztjb+zeNZ-z0gH=6vXykZCmjCJiK1GogA@mail.gmail.com>
> On 10 May 2018, at 16:33, Francisco Olarte <folarte@peoplecall.com> wrote:
>
> For what you want to do I think you'll have to parse the text value,
> maybe by definig a view with a text columns and using some
> rule/trigger magic for insert / updates.
Sorry for being unclear - the solution I have in production appears to work with
CREATE DOMAIN UTC_TIMESTAMP AS TIMESTAMP WITH TIME ZONE CHECK (EXTRACT(TIMEZONE FROM VALUE) = 0);
This raises an exception when an app doesn’t use UTC.
>
> It seems you want to force your users to use an explcit time zone.
> This may be better handled above the database.
This is what I wanted to achieve and the approach so far seems to work.
It is just that most people think the approach is weird. And this is the reason for the OP - a knowledgable person on a different list saw this approach, thought it was weird and suggested that I should educate myself. Which led me to asking on this list.
And the consensus appears to be that the approach is weird and that there are other ways to achieve timezone explicitness, one of which is to gain a deep understanding of how Postgres handles and stores timestamps.=
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: <D03AF820-9FFF-414F-8747-B3589FBB9224@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> <CA+bJJbyNTns-AMVUbztjb+zeNZ-z0gH=6vXykZCmjCJiK1GogA@mail.gmail.com> <D03AF820-9FFF-414F-8747-B3589FBB9224@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