SkiingOtter
SkiingOtter

Reputation: 21

Disconnect Specific Users From PostgreSQL Database

I need to disconnect several former team members from our postgres database. I have seen several solutions which talk about disconnecting all users from the database. However, it would be preferrable if we didn't have to disconnect all users because that would mean disconnecting the current team members too. So my question is, how do I disconnet specific users who are connected to our postgres database?

Upvotes: 0

Views: 812

Answers (1)

jjanes
jjanes

Reputation: 44285

select pg_terminate_backend(pid) from pg_stat_activity where usename in ('specific','user','name');

Upvotes: 1

Related Questions