In PostgreSQL 8.4.9 with pgbouncer 1.3.4 in pool_mode = session (but some users connect to the database directly) - when I login as "super user" with
psql -U postgres -W postgres
What is the command please to disconnect all "normal users" and prevent them from connecting again while I perform maintenance (I'd like to rename some table columns for more consistent naming and correspondingly change some stored procedures).
I can't find it in the III. Server Administration doc.
Or should I edit pg_hba.conf and restart the service/process?
There isn't one, as far as I'm aware -- and I don't see the value in it. PgSQL gives you the ability to modify the database structure live, and in many cases all within a single transaction.
The hard part in any schema migration is having the users of the database know that they have to change the way they use the database (modifying code that calls the database, rewriting documentation, re-training users who execute manual, ad-hoc queries). Preventing users from connecting while you're doing the maintenance doesn't help with that, because they're just going to do things the old way when you allow them to reconnect. If you're able to do a lock-step migration of all users of the database at the same time as the maintenance, then you'd also be able to tell them all to stop using the database while you fiddle with it anyway.
Kicking them off should be as easy as something like:
You could combine that with either
revoke connect on <datname> from <role>
or editing pg_hba.conf...ref: "How do I detach all other users from a postgres database?"
According to https://dba.stackexchange.com/a/163518/118371 you can also:
ALTER DATABASE db SET CONNECTION LIMIT 0;
and more