This is a very simple example:

I have a table with two columns, `id` and `password`. I want to know when an update was done successfully, with success being defined as applied to an existing row.

PHP seems to only offer `mysql_affeted_rows()`, which doesn't differentiate between 0 rows affected, and 0 rows updated. <http://php.net/manual/en/function.mysql-affected-rows.php> This is awkward because the return value is dependent on the state of rows at the time of the transaction. In Postgresql you can get it both ways, `UPDATE foo SET bar = NULL`, will return the amount of rows *updated* in `foo`; whereas, `UPDATE foo SET bar = NULL WHERE bar IS NOT NULL` will return the amount of rows *affected*, by limiting the update.

Don't bother suggesting a previous `SELECT`, or a PHP counter var, that assumes there is a row. I want to know of clever ways to get the Pg functionality, without redundant queries.