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 1fGivv-0007A9-Hw for pgsql-general@arkaria.postgresql.org; Thu, 10 May 2018 10:36:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fGivt-0001Lu-Fh for pgsql-general@arkaria.postgresql.org; Thu, 10 May 2018 10:36:21 +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 1fGivt-0001Ll-7x for pgsql-general@lists.postgresql.org; Thu, 10 May 2018 10:36:21 +0000 Received: from mout.gmx.net ([212.227.15.15]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fGivl-00042Y-QQ for pgsql-general@lists.postgresql.org; Thu, 10 May 2018 10:36:20 +0000 Received: from hermes ([84.165.107.44]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0LtJAR-1eKKtF0VpL-012t4i for ; Thu, 10 May 2018 12:36:10 +0200 Received: from ncq by hermes with local (Exim 4.91) (envelope-from ) id 1fGivh-0001ET-1d for pgsql-general@lists.postgresql.org; Thu, 10 May 2018 12:36:09 +0200 Date: Thu, 10 May 2018 12:36:08 +0200 From: Karsten Hilbert To: pgsql-general@lists.postgresql.org Subject: Re: Domain based on TIMEZONE WITH TIME ZONE Message-ID: <20180510103608.GB3622@hermes.hilbert.loc> References: <06EAD729-DC35-4E48-AB25-C42F7FA19C28@relops.com> <188A0270-0A9A-4ADE-A928-9067E99AE7B7@relops.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <188A0270-0A9A-4ADE-A928-9067E99AE7B7@relops.com> Ma_X_il-Followup-to: d Re_X_turn-receipt-to: Karsten.Hilbert@gmx.net Di_X_sposition-Notification-To: Karsten.Hilbert@gmx.net X-Confi_X_rm-Reading-To: Karsten.Hilbert@gmx.net X-Pri_X_ority: 2 (High) User-Agent: Mutt/1.9.5 (2018-04-13) Sender: X-Provags-ID: V03:K1:GEI1UD+BGUliGNUMATDRMF0ZWOSwOlO/KuhTVYq83tDb4K0gyJu rcRT31Qz10a7krcPzftMNf+rJvc7Jk7/HWBVjw8SDs1qSDd5AvMUwQNG+i+iRn2xpJPFMeN 81ttk6zuRvdP8m4O6VvJyDiRGBE8fUGCQEL50U0AB6M5nDYOVb7ZgRnTCVsp6/zdVw795xO 50wzAB1TUE/Dkj2LWs/VA== X-UI-Out-Filterresults: notjunk:1;V01:K0:Ax7gSmsAD44=:96Xn4ivn6ClKHX0PMZmeUc kGUPrWX2B1Gog6ZsT6sbRNZEG2tNkqtXPbAWvZH01u9NRV48okKIuAOC/qdDokZMOCXzdOKDo LYi6mtyp/tD/sn+qFr4jNOaJ45ciKKF1CEpCCvasmaPZpREG2Cv0/aRfx8CF1oo7LsehUfGdX T5R2qaHDJ7X+FQJa1sNvghH0cwsUe0KT7gi0vIvu0Jovyfpxl3BRneX/yH/6G8L2ZYR/N9p+S diBsjrNa0InLwAYQDTnu3LNzwI69HUmQ2sC55dTHIJyaUQJQpbJjZg24CeqkBzzOD0X7f4Lt/ zVVgzc0E+HLHrw82ZADMZWSCKJa95NCeRonG7nUstpO3pgGubtErIzCuNTk2x2GBHAMCiGRNf uXnNO0Y2nrP2PAj01Cf+L3T6SFQNG9/v04uNpU7SjYKo7jdFYlSLBQEac2ksKk9BqBUQQ47Ft ECo+dMg0vqQ9RZFHb0ZjLR4aGqjV18c3r94K3MwqQtIXMEMf4za4yAMkw8KKbxgemRhLbrmvS QCG4IzaCKG/IXKOx9kHZZxGAa8Qg9eSumJvgr4DcVz5qP7LGfdLc5pEvUYKrNaKwscZs0AO18 2p/TKeyOy6thCaH2O0y7PLvZlkz/NxuGXjrGGk31oabnIMVfoJgfITlwrTFW3hZJ2ljh2Bnwz Ntv9dpagKVKYfEGLCPKC2zQvJtOPla3vh+60Qp3c9NJuVVJrr9EIOY11lmXtLdRt09Ds6X7Gu Uzb+r5oAWICRuEWZO9hka4sz9Z9YZ5h6Z4pT3VgUXy1GYi9Xx3mI9jcR2UA= List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, May 10, 2018 at 11:19:36AM +0100, Ben Hood wrote: > The question should not be “how does Postgres store the timestamp internally”. > > Rather it should read “is enforcing the submission of UTC denominated timestamps in the server by using a domain a sensible way to enforce a policy that will blow up when apps attempt to use non-UTC timestamps (when they shouldn’t be)”. > > So the question is not how does the timestamp get stored, rather, is it an anti-pattern to use Postgres as a linter for apps that forget to use UTC exclusively? I dare say it is one of PG's strengths' to be usable as a "linter". However, maybe rephrase to: Is it an anti-pattern to use Postgres as a linter for apps that forget to use ... timezones *appropriately* ... ? 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 ? After all, it is always converted to UTC servside anyway ? 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. Karsten -- GPG key ID E4071346 @ eu.pool.sks-keyservers.net E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346