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 1fGjn4-0002SH-Rb for pgsql-general@arkaria.postgresql.org; Thu, 10 May 2018 11:31:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fGjn3-0002ZB-24 for pgsql-general@arkaria.postgresql.org; Thu, 10 May 2018 11:31:17 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fGjn2-0002Z1-0y for pgsql-general@lists.postgresql.org; Thu, 10 May 2018 11:31:16 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fGjmz-0005MI-3e for pgsql-general@lists.postgresql.org; Thu, 10 May 2018 11:31:14 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 0157121EB5; Thu, 10 May 2018 07:31:12 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 10 May 2018 07:31:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=relops.com; h= content-transfer-encoding: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=rAEjJ1Cy9kwr2YM7wBya1CvqIs 2Hbfv2hC0vOmwkai8=; b=KrUuJKsz5lQwVegrLDShgGBiBbQASshWOYDWPTFR+8 Lo3Rwm3TNaIynb/GWujxqzxbRwt0HCp0Q5kiy2+veBhJMfl1IxEURak264xmhzg8 n/pmcjLNk52YzXG+vVfldR+4iMwbZqPzT7trgdSt+6BeWBFp1do98F01MXvW7KJQ 8= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding: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=rAEjJ1 Cy9kwr2YM7wBya1CvqIs2Hbfv2hC0vOmwkai8=; b=TNZP3eiLycujNmv/gL7Ofo alkWnFQ6Uz3sXD+GMYFfyUTYHoYuJFFnn+9IhWbcKhG4iBuafQ/2o5Ln5Xr8Xwau o6ApeX/ypWE4uOfXNSZSj5XsShDbQwlJJnAyFpg2JYS4ce5tUxpqwKI1xD+gfNbw sW9zQnR8MjaCNn156J0+yRSqLHMYTYYZ0GHy+oQA24gTWueSQs8w50y4LhpCrdyD imoZbZamIn/hU3sXmPfEnSeoFpsjLHc00rNr2sn/1GVG9+ijeA1Gke/PvfXwciRc EIJpnX2yEsffQP/JFJqw5NXBRxNMc9zAxmrcedtFRVVZvBH04kGZPrlKW3Rgftzg == X-ME-Sender: Received: from [10.10.197.86] (unknown [31.6.55.187]) by mail.messagingengine.com (Postfix) with ESMTPA id 8967EE4488 for ; Thu, 10 May 2018 07:31:11 -0400 (EDT) From: Ben Hood Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 12:31:09 +0100 References: <06EAD729-DC35-4E48-AB25-C42F7FA19C28@relops.com> <188A0270-0A9A-4ADE-A928-9067E99AE7B7@relops.com> <20180510103608.GB3622@hermes.hilbert.loc> To: pgsql-general@lists.postgresql.org In-Reply-To: <20180510103608.GB3622@hermes.hilbert.loc> Message-Id: X-Mailer: Apple Mail (2.3445.6.18) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On 10 May 2018, at 11:36, Karsten Hilbert = wrote: >=20 > On Thu, May 10, 2018 at 11:19:36AM +0100, Ben Hood wrote: >=20 > I dare say it is one of PG's strengths' to be usable as a > "linter=E2=80=9D. Interesting that you share this view, because after thinking about why I = was doing this, using UTC domains is for PG to be a linter. > However, maybe rephrase to: >=20 > Is it an anti-pattern to use Postgres as a linter for > apps that forget to use ... timezones *appropriately* ... ? >=20 > As long as you can force apps to submit proper timestamp-with- > timezone data is there _really_ a need to care whether apps > do submit in UTC ? OK, so by using TIMESTAMP WITH TIME ZONE, you force all apps to submit = timezone qualified timestamps in what language they are written in. > After all, it is always converted to UTC > servside anyway ? And because of the internal UTC representation, there is no room for = ambiguous timezones. >=20 > In case you want to enforce only ever _handing out_ UTC data > you could wrap the table in a view with forces the output > timezone to UTC and only offers timestamp-withOUT-timezone to > the outside. Then force read access via the view. So on balance there is no need to use a domain for this? Or are we saying that domains are one way of achieving the timestamp = hygiene, but equally, you can get the same result as described above? Or is there a specific downside to using a domain for this purpose? =E2=80=A6..maybe I=E2=80=99ve just got a subjective prejudice for using = domains to refine and tighten built in data types=E2=80=A6.