We are observing long running process hung in active state on one of our db from last two days with usename 'xyz', We have tried killing the respective pid with pg_terminate_backned(pid), it's returning true but the quires are not actually being terminated. Based on the client address and port number from pg_stat_activity we found the connection origin and killed that connection initiation process from that host , even after that the connections on db from 'xyz' are not getting terminated.
and these connections are not making network calls a self dblink connection is being established in the query.
as a workaround we have disabled the connections initiation script for xyz user and restarted the database right after restart we observed the new connections from xyz user to database which is not expected because as we have already disables the connections initiation script.