Close an existing Postgres connection using psycopg2
问题 I was playing around with Postgresql and psycopg2 . I think I started many connections using the terminal but never closed it. Using pyscopg2 I understood how to start a connection and close it too. Now I was trying to get the existing connection (that i launched using the terminal before) using pyscopg2 but it seems there is an issue with port number. When I run SELECT * FROM pg_stat_activity ; , these are my results datid | datname | pid | usesysid | usename | application_name | client_addr