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 1fGmRs-0003lb-GU for pgsql-general@arkaria.postgresql.org; Thu, 10 May 2018 14:21:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fGmRr-0000Zf-8u for pgsql-general@arkaria.postgresql.org; Thu, 10 May 2018 14:21:35 +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 1fGmNv-0005Gu-1R for pgsql-general@lists.postgresql.org; Thu, 10 May 2018 14:17:31 +0000 Received: from mout.gmx.net ([212.227.17.20]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fGmNr-0000ci-Hg for pgsql-general@lists.postgresql.org; Thu, 10 May 2018 14:17:29 +0000 Received: from hermes ([84.165.107.239]) by mail.gmx.com (mrgmx103 [212.227.17.168]) with ESMTPSA (Nemesis) id 0LkP8Z-1ekkx61bKd-00cP8c for ; Thu, 10 May 2018 16:17:23 +0200 Received: from ncq by hermes with local (Exim 4.91) (envelope-from ) id 1fGmNl-0007hP-Mm for pgsql-general@lists.postgresql.org; Thu, 10 May 2018 16:17:21 +0200 Date: Thu, 10 May 2018 16:17:21 +0200 From: Karsten Hilbert To: pgsql-general@lists.postgresql.org Subject: Re: Domain based on TIMEZONE WITH TIME ZONE Message-ID: <20180510141721.GE3622@hermes.hilbert.loc> References: <06EAD729-DC35-4E48-AB25-C42F7FA19C28@relops.com> <188A0270-0A9A-4ADE-A928-9067E99AE7B7@relops.com> <20180510103608.GB3622@hermes.hilbert.loc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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:Iu+oA6p1MA6Txc5fGBhz1CrgfbJswy218aSHYaGQtMfIjY0u1XI w3olMXtS5qxLBMsp/5vmZnntnyLs5zhf1JkmdWq+rVmWapqZdWc5AAg+l8IlqMkavLJNBCF tVPGO9s0GAZWTRoYYffq4zUJD80uuJ7CJ6nQ1hxUc9dyvyjDpgE4m6CgPyPjyBHNHXvbziI CrgubAA9fzTvHghjFQn7w== X-UI-Out-Filterresults: notjunk:1;V01:K0:JgBnPmZ37YE=:jZCy8j3D6f/JOHSwANbICG IkktyzxMREzKl7Kq1hRm+hmGUQ+zXz5+Ht0MNbpnZMu/KIKUpeCfwAql6CrwCSx+Yn0NpQZhV PLkOXyXNriT8QQOsNSB1B3WCIWgDgbWadyWXobrM3s8/CEg8J1K4+YIzBYRAxi+xyDRPD1mwj mr7xDfwnQfiJufX6NyzS31ebzXsV6wbTIM/LnN6C7jhqv8cubxgmQRd4fwUAQdphnBL2m3UzH YtwNns37pX7FaSLdr1Fr3X6RAHJ03/HLeoHvaz7q7ZD7BSHTv2jWf3PJmjd26Rgdn4ZceOOxz utf84v6yk1AazZdQsG990TGujj4woJcPzETyfdEUYq5Yox1RnW6BnsCgzVNzzKF4J7j2LgahD RP86IeZx0VffLGJ1vrFwiHs0y5fTDd34c/P+nRJLhUvRZ5RMI8hYJLQGAI29QCSOAEwBqasI0 7Tw2r19BoUUQQLStP+laAulynnQkLBXQww1bDT5lPq3Eh5ADadEa5ibgBgUcsKP6vcK4nI3sF FS2NYznftMyYf5VFFxH+1ATvPBDpBSg3ibqgHgjxQGe+HWicVSUw7s2q7SfwNCjxIrYYqyB5S /7IwOrG77VNghoNQtqrv8hGNejfs0QHNLvL2oOdkTHGK2YHZLzxaaiMBf8Y6Jy+1SKsSHILgr BSsQOMR4aN8J8nCNSVhYOgDvsZwBB+zdj7+JT8UrqJ4M7z6554f2shPBYpMPIElFNHbIb/4a/ ddbcSvZvc5hMjtw/ZbByd/rorWZveT9tolHZO3n+WMlbarNX7lw3FwNX8gI= List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, May 10, 2018 at 06:41:04AM -0700, Adrian Klaver wrote: >> OK, so by using TIMESTAMP WITH TIME ZONE, you force all apps to submit timezone qualified timestamps in what language they are written in. > > Not really: > > https://www.postgresql.org/docs/10/static/datatype-datetime.html > > "For timestamp with time zone, the internally stored value is always in UTC > (Universal Coordinated Time, traditionally known as Greenwich Mean Time, > GMT). An input value that has an explicit time zone specified is converted > to UTC using the appropriate offset for that time zone. If no time zone is > stated in the input string, then it is assumed to be in the time zone > indicated by the system's TimeZone parameter, and is converted to UTC using > the offset for the timezone zone." True enough, I didn't remember that behaviour. And since a BEFORE UPDATE/INSERT trigger will see the data to be inserted PG will have already done that while parsing from on-the-wire data into in-memory ts-w-tz presentation so we can't simply use a trigger to enforce explicit specification of a timezone. Therefore, a domain could work but will require client language support for easy integration. > > And because of the internal UTC representation, there is no room for ambiguous timezones. > > Define ambiguous timezone? OP likely means underspecified for his use case (= not assuming "unspecified" to mean "TimeZone value"). But, then, OP could always force TimeZone to UTC on his servers :-) Karsten --