Assigning a timestamp without timezone to a timestamp with timezone

Поиск
Список
Период
Сортировка
От chrisj
Тема Assigning a timestamp without timezone to a timestamp with timezone
Дата
Msg-id 6613652.post@talk.nabble.com
обсуждение исходный текст
Ответы Re: Assigning a timestamp without timezone to a timestamp with timezone
Список 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
withtimezone 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.



В списке pgsql-sql по дате отправления:

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: How to FindNearest
Следующее
От: Bryce Nesbitt
Дата:
Сообщение: LOG: logger shutting down