title: Changing time zone value of data
body: <p>I have to import <strong>data without time zone information</strong> in it (however, I know the specific time zone of the data I want to import), but I need the <code>timestamp with time zone</code> format in the database. Once I import it and set the timestamp data type to <code>timestamp with time zone</code>, Postgres will automatically assume that the data in the table is from my time zone and assign my time zone to it. Unfortunately the data I want to import is not from my time frame, so this does not work.</p>
  
  <p>The database also contains data with different time zones. However, the time zone within one table is always the same.</p>
  
  <p>Now, I could set the time zone of the database to the time zone of the data I want to import before importing the data (using <code>SET time zone</code> command) and change it back to my time zone once the import is done, and I am pretty sure already stored data will not be affected by the time zone change of the database. But this seems to be a pretty dirty approach and may cause problems later on.</p>
  
  <p>I wonder if there is a more elegant way to specify the time zone for the import without having the time zone data in the data itself?</p>
  
  <p>Also, I have not found a way to edit time zone information after import. Is there a way not to convert, but simply to edit the time zone for a whole table, assuming that the whole table has the same time zone offset (i.e. if a wrong one has been assigned upon data entry/import)?</p>
  
  <p>Edit:<br>
  I managed to specify a time zone upon import, the whole command being:</p>
  
  <pre><code>set session time zone 'UTC';
  COPY tbl FROM 'c:\Users\Public\Downloads\test.csv' DELIMITERS ',' CSV;
  set session time zone 'CET';
  </code></pre>
  
  <p>The data then gets imported using the session time zone. I assume this has no effect on any other queries on the database at the same time from other connections?</p>
  
  <p>Edit 2:<br>
  I found out how to change the time zone of a table afterwards:<br>
  <a href="https://stackoverflow.com/questions/6492657/postgresql-update-time-zone-offset?rq=1">PostgreSQL update time zone offset</a></p>
  
  <p>I suppose it is more elegant to change the time zone of the table after import then to use session to change the local time zone temporary. Assuming the whole table has the same time zone of course.</p>
  
  <p>So the code would be now something along the line of:</p>
  
  <pre><code>COPY tbl FROM 'c:\Users\Public\Downloads\test.csv' DELIMITERS ',' CSV;
  UPDATE tbl SET &lt;tstz_field&gt; = &lt;tstz_field&gt; AT TIME ZONE '&lt;correct_time_zone&gt;';
  </code></pre>