title: How to get the number of deleted rows in PostgreSQL?
body: <p>I am looking for a way to return the number of rows affected by a DELETE clause in PostgreSQL. The <a href="http://www.postgresql.org/docs/8.2/static/sql-delete.html" rel="noreferrer">documentation</a> states that;</p>
  <blockquote>
  <p>On successful completion, a DELETE
  command returns a command tag of the
  form</p>
  <p>DELETE count</p>
  <p>The count is the number of rows
  deleted. If count is 0, no rows
  matched the condition (this is not
  considered an error).</p>
  <p>If the DELETE command contains a
  RETURNING clause, the result will be
  similar to that of a SELECT statement
  containing the columns and values
  defined in the RETURNING list,
  computed over the row(s) deleted by
  the command.</p>
  </blockquote>
  <p>But I am having trouble finding a good example of it. Can anyone help me with this, <em>how can I find out how many rows were deleted?</em></p>
  <hr />
  <p><strong>EDIT:</strong>
  I wanted to present an alternative that I have found later. It can be found in <a href="http://developer.postgresql.org/pgdocs/postgres/plpgsql-statements.html" rel="noreferrer">here</a>, explained under <em>38.5.5. Obtaining the Result Status</em> title.</p>