---
title: "Postgresql 删除数据库连接"
author: "friping"
date: "2014-05-22T18:41:08Z"
tags: []
categories: ["数据库"]
slug: "postgresql"
draft: false
lastmod: "2014-05-22T21:57:19Z"
id: 2070088
url: "https://friping.iteye.com/blog/2070088"
---

错误：There are 5 other sessions using the database   

 

   解决：

```
SELECT pg_terminate_backend( pid )
FROM pg_stat_activity
WHERE pid <> pg_backend_pid( )
    AND datname = current_database( );
```