Hi,
I think that this bug would affect at least couple of other people, but I agree it is not worth to change deep internal mechanisms just for it.
Maybe changing pg_stat_activity would break existing code, but only for edge case where this code already behaves incorrectly (by missing existing connections) --- for example pgAdminIII won't show connections in this case!
Also using other query wouldn't introduce NULL columns to this view:
SELECT ..., CASE WHEN u.rolname IS NULL THEN 'pg_user_removed` ELSE u.rolname END, ... FROM ....;
This would break existing code only if they use this particular username, which is not probable.
Other option I see is just to document two things:
- How to drop connections connecting to database (there are several questions on Stack Overflow regarding this, so it is worthwile )
- Document this behaviour of pg_stat_activity.
I guess I could try to contribute these changes, but I'm not qualified to decide whether they make sense.
PS. Sorry to be so persistent, but I spent this Friday afternoon and better part of night chasing this bug!