Assigning a timestamp without timezone to a timestamp with timezone

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


Hi
Does any one have any ideas for the following problem?

Two tables both the have open and close columns that are timestamp or
timestamp with time zone.

One row in first table represents the corporate office default open and
close times for all stores relative to the store?s own time zone for a
particular day.

The second table represents the specific open and close time for a specific
store for a specific day, occasionally a store?s hours can be different from
the corporate default.

Table1:
open_time timestamp
close_time timestamp

Table2:
store_number int
open_time timestamp with timezone
close_time timestamp with timezone

I would like to be able to initialize table 2 from table 1.

Suppose I had a store table that contained

Store_table:
Store_number int
Store_tz char(03)

I would like to do something like:

Insert into Table2
Select S.store_number
,cast(T1.open_time as timestamp with timezone at S.Store_tz)
,cast(T1.close_time as timestamp with timezone at S.Store_tz)
from Store_table S, Table1 T1

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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Bryce Nesbitt 2006-10-03 04:06:07 LOG: logger shutting down
Previous Message Bruno Wolff III 2006-10-03 00:20:49 Re: How to FindNearest