Re: Assigning a timestamp without timezone to a timestamp

From: chrisj <chrisj(dot)wood(at)sympatico(dot)ca>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Assigning a timestamp without timezone to a timestamp
Date: 2006-10-17 03:27:42
Message-ID: 6847852.post@talk.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


Thanks Tom that's great!!

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

So I was not hopeful, but when I tried it it did exactly what I needed which
is:
select '2006-07-13 09:20:00'::(timestamp at time zone 'EST5EDT');

My adjusted SQL is:

select start_datetime
, cast(start_datetime as timestamp(0) without time zone)::timestamp at
time zone B.timezone_ch
from reservation A
, location B
where A.appt_key = 7
and B.locn_key = 102;

thank-you so much

Tom Lane-2 wrote:
>
> chrisj <chrisj(dot)wood(at)sympatico(dot)ca> writes:
>> Did not seem to help:
>> ERROR: invalid input syntax for type timestamp with time zone:
>> "2006-07-13
>> 09:20:00 America/New_York"
>
> Sorry, I was thinking in terms of CVS HEAD ... the ability to use a full
> timezone spec in timestamptz input is new for 8.2. You might be able to
> use this, which does work in 8.1:
>
> select '2006-07-13 09:20:00'::timestamp at time zone 'EST5EDT';
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
>
>

--
View this message in context: http://www.nabble.com/Assigning-a-timestamp-without-timezone-to-a-timestamp-with-timezone-tf2373845.html#a6847852
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Felix Zhang 2006-10-17 07:39:21 How to split a table?
Previous Message Bruno Wolff III 2006-10-16 17:51:10 Re: deleting rows in specific order