title: PostgreSQL insert error into log_table
body: <p>How can I insert an error message into a table in PostgreSQL 9.3
  e.g </p>
  
  <pre>
  ERROR:  column "category_id" is of type smallint but expression is of type text
  LINE 2: insert into "MOP" values($2, $3, $4, $5, $6, $7);
  </pre>