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 1fwEoZ-0001du-3G for pgsql-docs@arkaria.postgresql.org; Sat, 01 Sep 2018 22:56: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 1fwEoW-0002QU-89 for pgsql-docs@arkaria.postgresql.org; Sat, 01 Sep 2018 22:56:20 +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 1fwEoE-0000wJ-Bs for pgsql-docs@lists.postgresql.org; Sat, 01 Sep 2018 22:56:02 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fwEoA-0004LI-Kh for pgsql-docs@postgresql.org; Sat, 01 Sep 2018 22:56:00 +0000 Received: from bruce by momjian.us with local (Exim 4.84_2) (envelope-from ) id 1fwEo9-0005sE-Lf for pgsql-docs@postgresql.org; Sat, 01 Sep 2018 18:55:57 -0400 Date: Sat, 1 Sep 2018 18:55:57 -0400 From: Bruce Momjian To: PostgreSQL-documentation Subject: AT TIME ZONE correction Message-ID: <20180901225557.GA22406@momjian.us> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nFreZHaLTZJo0R7j" Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --nFreZHaLTZJo0R7j Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Looking over the AT TIME ZONE docs, I think they are subtly confusing. The order of conversion specific in the first example should _start_ with the assumption of local time zone for the time stamp, not something that happens after AT TIME ZONE is applied. The ordering in current docs makes the second example confusing too. The attached patch fixes this. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + As you are, so once was I. As I am, so you will be. + + Ancient Roman grave inscription + --nFreZHaLTZJo0R7j Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="time_zone.diff" diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml new file mode 100644 index bb794e0..ba22b7d *** a/doc/src/sgml/func.sgml --- b/doc/src/sgml/func.sgml *************** SELECT TIMESTAMP '2001-02-16 20:38:40' A *** 8145,8153 **** SELECT TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40-05' AT TIME ZONE 'MST'; Result: 2001-02-16 18:38:40 ! The first example takes a time stamp without time zone and interprets it as MST time ! (UTC-7), which is then converted to PST (UTC-8) for display. The second example takes ! a time stamp specified in EST (UTC-5) and converts it to local time in MST (UTC-7). --- 8145,8154 ---- SELECT TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40-05' AT TIME ZONE 'MST'; Result: 2001-02-16 18:38:40 ! The first example takes a time stamp without time zone, converts it ! to local time (PST, UTC-8), then converts it to time in MST (UTC-7) ! for display. The second example takes a time stamp specified in EST ! (UTC-5) and converts it to time in MST (UTC-7) for display. --nFreZHaLTZJo0R7j--