The Postgres Signature module making all database connections and queries "personalized". If you have not only default database user but also SQL users with the names as Drupal users, all requests would be performed with corresponding SQL-user name.
Queries from user #1 and from anonymous users authored by default connection string.
Adding and removing Drupal users also leads to do the same on database level.
On administration pages there is a functional to create (or delete) in bulk SQL users to reflect existing Drupal users.