To kill only one connection use this:
SELECT pg_terminate_backend( process_id )
where “process_id” is taken FROM pg_stat_activity – procpid in PG 8.4 or pid in PG 9.3
If you need to terminate processes / connections / sessions on some specific database you can use this:
SELECT pg_terminate_backend(procpid) FROM pg_stat_activity WHERE -- don't kill my own connection! procpid <> pg_backend_pid() -- don't kill the connections to other databases AND datname = '...database_name...';
Of course if you don’t case about some specific connection you can always restart pg server. Which is quick but ends everything…