pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: chrisj <chrisj.wood@sympatico.ca>
To: pgsql-sql@postgresql.org
Subject: Assigning a timestamp without timezone to a timestamp with timezone
Date: Mon, 2 Oct 2006 20:15:56 -0700 (PDT)
Message-ID: <6613652.post@talk.nabble.com> (raw)


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....
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.




view thread (24+ messages)  latest in thread

Message-ID: <6613652.post@talk.nabble.com>
Permalink:  ../6613652.post@talk.nabble.com/
Also on:    postgresql.org/message-id/6613652.post@talk.nabble.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: chrisj.wood@sympatico.ca
  Subject: Re: Assigning a timestamp without timezone to a timestamp with timezone
  In-Reply-To: <6613652.post@talk.nabble.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox