title: How do I interpret PostgreSQL error messages from within Go?
body: <p>How can I parse SQL constraint errors, in particular resulting from constraints such as <code>UNIQUE</code>, <code>FOREIGN KEY</code>, <code>NOT NULL</code>, <code>ON DELETE RESTRICT</code> within Go?</p>
  
  <p>e.g. Insert a new user that may have the same email which is defined as a <code>UNIQUE</code> field in the database. Parse constraint error in Go, return error to browser client.</p>