select pg_terminate_backend(pid) from pg_stat_activity psa
join pg_user on pgu on pgu.usesysid = psa.usesysid 
where datname='sdfsdfsdf' and pgu.usename in ( 'sdfsdfsdf');