title: How to get Epoch with Microsecond accuracy from a timestamp column in Postgres?
body: <p>In Postgres I am trying to create a timestamp field with microsecond accuracy.</p>
  
  <p>If I query for the timestamp in printable format, it displays the date with the exact microseconds, but if I query for the epoch, it only displays 5 digits...</p>
  
  <p><strong>Example</strong>:</p>
  
  <pre><code>CREATE TABLE date_test (datetime timestamp(6) WITH TIME ZONE);
  
  INSERT INTO date_test VALUES(TO_TIMESTAMP(1525745241.879112));
  
  SELECT datetime FROM date_test; //returns 2018-05-08 12:07:21.879112+10
  SELECT EXTRACT(epoch FROM datetime) from date_test; //returns 1525745241.87911
  </code></pre>
  
  <p>What is the reason for the last digit to be lost? Is the query inherently converting to floating point and losing accuracy? Is there any easy way to store dates with microsecond precision in Postgres?</p>