title: extract date from timestamp in postgreSQL
body: <p>we have a table of data that looks like:</p>
  
  <pre><code>|id|date1     |timestamp1         |
  -----------------------------
  |1 |2015-06-23|2015-06-23 16:02:00|
  -----------------------------
  |2 |2015-01-02|2015-01-02 11:32:00|
  </code></pre>
  
  <p>I tried to create a function and trigger which is not working, looks like this:</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION insert_date1_trg_func()
  RETURNS trigger AS
  $BODY$
  begin
  update schema.table set
  date1 = extract(date from new.timestamp1)
  where id = new.id;
  return null;
  end;
  $BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;
  </code></pre>
  
  <p>trigger</p>
  
  <pre><code>CREATE TRIGGER insert_date1_trg_func()
  AFTER INSERT or update
  ON schema.table
  FOR EACH ROW
  EXECUTE PROCEDURE insert_date1_trg_func();
  </code></pre>
  
  <p>I am getting an error type date but expression double precision.</p>