title: Change data type of a table column from timestamp to bigint
body: <p>I am using postgres and I have a table with a column whose data type is timestamp without time zone.</p>
  
  <p>I would like to change the data type to <code>bigint</code>. I am trying to store number of seconds since 1970 in the column. So something big like <code>1397597908756</code>.</p>
  
  <p>I am using python, something like:</p>
  
  <pre><code>d = dict() # create a dictionary, has key 'timestamp'
  #get data from server and store in array 
  d.update(dict(timestamp=data[1]) #data[1] has the number of seconds 
  </code></pre>
  
  <p>I touch server many times so storing in dictionary is essential. The query is: </p>
  
  <pre><code>cursor.execute("INSERT into tablename columname VALUES (%s)", (quote['timestamp'];
  </code></pre>
  
  <p>At this point, an exception is thrown:</p>
  
  <blockquote>
    <p>invalid input syntax for type timestamp: 1397597908756</p>
  </blockquote>
  
  <p>So I tried to change the data type from <code>timestamp without timezone</code> to <code>bigint</code>. I did:</p>
  
  <pre><code>ALTER TABLE tablename ALTER COLUMN columnname
  SET DATA TYPE bigint USING updated::bigint;
  </code></pre>
  
  <p>I got the following error:</p>
  
  <blockquote>
    <p>ERROR: cannot cast type timestamp without time zone to bigint</p>
  </blockquote>