juanefren
juanefren

Reputation: 2968

Terminate all connections from specific schema in certain database

With this command I can terminate all connections running in a specific database.

SELECT pg_terminate_backend(pg_stat_activity.pid) 
FROM pg_stat_activity 
WHERE pg_stat_activity.datname = 'DATABASE_NAME' 
AND pid <> pg_backend_pid();

Is there a way to terminate connections in a certain schema only?

Upvotes: 1

Views: 2896

Answers (1)

Erwin Brandstetter
Erwin Brandstetter

Reputation: 657892

No. PostgreSQL connections are always to a database, not to a schema.

Related question on dba.SE:

Upvotes: 2

Related Questions