title: PostgreSQL plpgsql try catch block equivalent
body: <p>I am using PostgreSQL 9.6.</p>
  <p>I have a <code>PROCEDURE</code> in sql server. That makes use of a <code>try catch</code> block. It looks a little bit like the code below:</p>
  <pre><code>        BEGIN TRANSACTION
          BEGIN TRY
          --do stuff here
          COMMIT TRANSACTION
          END TRY
          BEGIN CATCH
          ROLLBACK TRANSACTION
          --do error stuff here
          END CATCH
  </code></pre>
  <p>Upon doing some research, It seems like postgres does not make use of <code>try catch</code>. Is there some way to handle this in postgres the same way sql server does?</p>