Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fGsJn-0006iw-KE for pgsql-general@arkaria.postgresql.org; Thu, 10 May 2018 20:37:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fGsJk-0007oU-41 for pgsql-general@arkaria.postgresql.org; Thu, 10 May 2018 20:37:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fGsJj-0007f5-O9 for pgsql-general@lists.postgresql.org; Thu, 10 May 2018 20:37:35 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fGsJf-0001ZX-Is for pgsql-general@lists.postgresql.org; Thu, 10 May 2018 20:37:34 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id CF8F120FDD; Thu, 10 May 2018 16:37:29 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 10 May 2018 16:37:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=relops.com; h= content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= mesmtp; bh=z4Njy7gtTeRpb2ZWgTppcHHDPNsaXlZhZGCfuUfjbYE=; b=R3KEL 8PzGZf1DZMlod+T9pYL+t53nkPlkAQU0llggg9Uanmjve5u9XqyEzNxXEW+47i1u 5fq+Ggw0bKkb/5bwypuxmWmMQb5LFDZZKwg/N30KcX+uCkEzCKwP8pEjLsbG0gLT uduh9eBqKcCRgz8fEzxyuOBXKFAM6GxuGfgr7M= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=z4Njy7gtTeRpb2ZWgTppcHHDPNsaX lZhZGCfuUfjbYE=; b=nf5+iMvDoEFPfYEw9B2TuIDjk523ISzxomV21RwWTBDtZ br4UIDpHcWuFlcOViDO2jTurNhAhccqDGXkMzVp+vXkNhK0Ki+wxcYLJM5cLaM6I YVqhS/dyc5b+QkMzJ5agg1La775E4cygWILO+jDhkkOgMo6y+ywNk4PxmX4aJpBI Dhw95YeGio/eejkpmnSXc4I3aHbvXJvLUMhpJr2I22zQJk2kHEdOI1iA1gTwKkEF M+is+55N5DthLJv4576+JYuer+VH+OhIwDEeRU5+Jk0eIbj1hKraOvY911uIctoM 42ZrG9JxUX18c3W9pW2H6dCxDuWI4qhR505Xw24sA== X-ME-Sender: Received: from [172.20.10.3] (unknown [148.252.128.195]) by mail.messagingengine.com (Postfix) with ESMTPA id 125F3E4488 for ; Thu, 10 May 2018 16:37:28 -0400 (EDT) From: Ben Hood Content-Type: multipart/alternative; boundary="Apple-Mail=_7BBEA858-7463-4DDB-BBFF-C83CE69F9F72" Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Subject: Re: Domain based on TIMEZONE WITH TIME ZONE Date: Thu, 10 May 2018 21:37:26 +0100 References: <06EAD729-DC35-4E48-AB25-C42F7FA19C28@relops.com> <188A0270-0A9A-4ADE-A928-9067E99AE7B7@relops.com> To: pgsql-general@lists.postgresql.org In-Reply-To: Message-Id: X-Mailer: Apple Mail (2.3445.6.18) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_7BBEA858-7463-4DDB-BBFF-C83CE69F9F72 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 10 May 2018, at 16:33, Francisco Olarte = wrote: >=20 > 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=20 CREATE DOMAIN UTC_TIMESTAMP AS TIMESTAMP WITH TIME ZONE CHECK = (EXTRACT(TIMEZONE FROM VALUE) =3D 0); This raises an exception when an app doesn=E2=80=99t use UTC. >=20 > 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.= --Apple-Mail=_7BBEA858-7463-4DDB-BBFF-C83CE69F9F72 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8


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) =3D 0);

This raises an exception when an app doesn=E2=80=99t= 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.
= --Apple-Mail=_7BBEA858-7463-4DDB-BBFF-C83CE69F9F72--