Deleting active connections in Azure Postgresql

Kopl 166 Reputation points
2022-02-17T19:49:54.363+00:00

I would like to delete active connections in my Azure SQL Database for Postgres. I have logged into the database as admin and tried:

SELECT pg_terminate_backend(pid)
FROM pg_stat_activity
WHERE datname = 'postgres' AND pid <> pg_backend_pid() AND state in ('idle');'

However, I got the following error:

ERROR: must be a member of the role whose process is being terminated or member of pg_signal_backend

Could you please help?

Azure Database for PostgreSQL
{count} votes

1 answer

Sort by: Most helpful
  1. Anurag Sharma 17,576 Reputation points
    2022-02-18T06:35:46.76+00:00

    Hi @ahmed-86273, welcome to Microsoft Q&A forum.

    It seems that you are trying to kill postgres session and facing the access issue.

    Can you please try granting access to your user using below command and check again?

    GRANT pg_signal_backend TO <user name>; 
    
    2 people found this answer helpful.
    0 comments No comments