Re: Assigning a timestamp without timezone to a timestamp

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: chrisj <chrisj(dot)wood(at)sympatico(dot)ca>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Assigning a timestamp without timezone to a timestamp
Date: 2006-10-17 13:34:02
Message-ID: 16546.1161092042@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

chrisj <chrisj(dot)wood(at)sympatico(dot)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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message chrisj 2006-10-17 20:42:17 Re: Assigning a timestamp without timezone to a timestamp
Previous Message Harald Armin Massa 2006-10-17 13:22:49 Re: Can we convert from Postgres to Oracle !!???