Does db_affected_rows() works well with PostgreSQL?
To summarize for Drupal 6:


db_affected_rows() gives you number of rows returned by a select if the database is MySQL but not if it's PostgreSQL.
In Drupal 6 if you are using PostgreSQL you can run pg_num_rows() on the query to get the number of rows.


It is indeed database specific.

[Reference: this comment in the Drupal documentation]