On Sat, Sep  1, 2018 at 07:37:36PM -0400, Bruce Momjian wrote:
> > Here we've got a time value that was initially given in EST (-05),
> > but was converted to UTC by timestampz_in.  Then the AT TIME ZONE
> > says "Please convert this UTC value to MST, and emit it as a zoneless
> > timestamp" (which will not be subject to any further conversion when
> > it's displayed).
> > 
> > The existing text is indeed a bit deficient, because it fails to
> > draw a clear boundary between what the AT TIME ZONE operator is
> > doing and what is being done by the timestamp(tz) I/O functions.
> > But you're not making it better.
> 
> Yes, I am still researching and realize my diff is wrong.  Let me keep
> working and I will repost.

I have developed the attached patch, which I think is an improvement.

-- 
  Bruce Momjian  <br...@momjian.us>        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 +
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
new file mode 100644
index bb794e0..53aa515
*** a/doc/src/sgml/func.sgml
--- b/doc/src/sgml/func.sgml
*************** SELECT date_trunc('year', TIMESTAMP '200
*** 8082,8089 ****
     </indexterm>
  
     <para>
!     The <literal>AT TIME ZONE</literal> construct allows conversions
!     of time stamps to different time zones.  <xref
      linkend="functions-datetime-zoneconvert-table"/> shows its
      variants.
     </para>
--- 8082,8089 ----
     </indexterm>
  
     <para>
!     The <literal>AT TIME ZONE</literal> construct allows the addition,
!     conversion, and removal of time zones for time stamp values.  <xref
      linkend="functions-datetime-zoneconvert-table"/> shows its
      variants.
     </para>
*************** 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';
  <lineannotation>Result: </lineannotation><computeroutput>2001-02-16 18:38:40</computeroutput>
  </screen>
!     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).
     </para>
  
     <para>
--- 8145,8159 ----
  SELECT TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40-05' AT TIME ZONE 'MST';
  <lineannotation>Result: </lineannotation><computeroutput>2001-02-16 18:38:40</computeroutput>
  </screen>
!     The first example takes a time stamp without time zone and interprets
!     it in the MST time zone (UTC-7), returning a time stamp with time
!     zone value which is displayed in local time (PST, UTC-8).  The second
!     example takes a time stamp with time zone value (EST, UTC-5) and
!     converts it to the date and time in MST (UTC-7) without time zone.
!     Basically, the first example takes the date and time and puts it in
!     the specified time zone.  The second example takes a time stamp with
!     time zone and shifts it to the specified time zone. (No time zone
!     designation is returned.)
     </para>
  
     <para>

Reply via email to