Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eQqYe-0008E7-FV for pgsql-general@arkaria.postgresql.org; Mon, 18 Dec 2017 08:13:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eQqYd-0006p5-L6 for pgsql-general@arkaria.postgresql.org; Mon, 18 Dec 2017 08:13:55 +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.84_2) (envelope-from ) id 1eQqYd-0006ot-Dw for pgsql-general@lists.postgresql.org; Mon, 18 Dec 2017 08:13:55 +0000 Received: from [195.159.176.226] (helo=blaine.gmane.org) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eQqYa-00016D-V0 for pgsql-general@postgresql.org; Mon, 18 Dec 2017 08:13:54 +0000 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1eQqWa-0004B7-1d for pgsql-general@postgresql.org; Mon, 18 Dec 2017 09:11:48 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-general@postgresql.org From: Thomas Kellerer Subject: Re: Converting timestamp to timestamptz without rewriting tables Date: Mon, 18 Dec 2017 09:13:38 +0100 Lines: 23 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@blaine.gmane.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 In-Reply-To: Content-Language: de-DE X-Host-Lookup-Failed: Reverse DNS lookup failed for 195.159.176.226 (failed) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Tom Dunstan schrieb am 18.12.2017 um 09:08: > We have generally been using timestamps without timezones in our > system. As both our app servers and db server were set to UTC it so > far hasn't been an issue. However, that may not always be the case, > so we want to tighten things up a bit. We are also needing to do > things like get the particular date that a timestamp in the db refers > to, and thus need to be explicit about which timezone everything is > in. > > All of the timestamps in our system represent an instant in time, not > a clock date/time, so timestamp with time zone is more appropriate. > All of the data that is currently on disk in timestamp columns was > inserted in a db session in UTC, and represents that timestamp in > UTC. Are you aware of the fact that "timestamp with time zone" does NOT actually store the time zone? A timestamptz stores everything as UTC and the value is converted to the session time zone upon retrieval. Thomas