Re: Assigning a timestamp without timezone to a timestamp - Mailing list pgsql-sql

From Tom Lane
Subject Re: Assigning a timestamp without timezone to a timestamp
Date
Msg-id 16546.1161092042@sss.pgh.pa.us
Whole thread Raw
In response to Re: Assigning a timestamp without timezone to a timestamp  (chrisj <chrisj.wood@sympatico.ca>)
Responses Re: Assigning a timestamp without timezone to a timestamp  (chrisj <chrisj.wood@sympatico.ca>)
List pgsql-sql
chrisj <chrisj.wood@sympatico.ca> writes:
> When I first saw your solution I thought it was logically going to do
> (notice the parentheses):
>     select ('2006-07-13 09:20:00'::timestamp) at time zone 'EST5EDT';  
> which does not help

Well, actually, that's exactly what it does.  AT TIME ZONE is an
operator that converts timestamp without time zone to timestamp with
time zone (or vice versa).  I guess you could easily get confused
here, but AT is not WITH.

>   , cast(start_datetime as timestamp(0) without time zone)::timestamp at
> time zone B.timezone_ch

That's redundant --- you're casting the result of the cast to timestamp
(implicitly without time zone), then applying the AT TIME ZONE operator.
        regards, tom lane


pgsql-sql by date:

Previous
From: Lewis Cunningham
Date:
Subject: Re: [GENERAL] Any documatation about porting from Oracle to PostgreSQL
Next
From: chrisj
Date:
Subject: Re: Assigning a timestamp without timezone to a timestamp