title: Get count of records affected by INSERT or UPDATE in PostgreSQL
body: <p>My database driver for PostgreSQL 8/9 does not return a count of records affected when executing <code>INSERT</code> or <code>UPDATE</code>. </p>
  
  <p>PostgreSQL offers the non-standard syntax "<a href="http://www.postgresql.org/docs/current/static/sql-insert.html" rel="noreferrer">RETURNING</a>" which seems like a good workaround. But what might be the syntax? The example returns the ID of a record, but I need a count.</p>
  
  <blockquote>
    <p>INSERT INTO distributors (did, dname) VALUES (DEFAULT, 'XYZ Widgets')
       <strong>RETURNING did</strong>;</p>
  </blockquote>