> ## Content Index
> Fetch the complete content index at: https://scriptcrunch.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# [Solved] PostgreSQL ERROR: There is 1 other session using the database.
- URL: https://scriptcrunch.com/there-is-1-other-session/
- Published: 2022-08-25T04:52:24.000Z
- Updated: 2026-06-23T08:56:01.000Z
- Author: Scriptcrunch Editorial
- Tags: Troubleshooting, #Migrated-1758801465347, #wp, #wp-post, #Import 2025-09-25 11:57

In [PostgreSQL](https://www.postgresql.org/?ref=scriptcrunch.com), if you have active connection to the [database](https://scriptcrunch.com/tag/databases/) and if you try to DROP the database, you will get the following error.

```
ERROR:  database "catalog" is being accessed by other users
DETAIL:  There is 1 other session using the database.
```

To rectify this error and to drop the database, follow the steps given below.

**Step 1:** First, you need to close all the active connections from programs or tools like PGAdmin. Quit all the applications connecting to the database.

**Step 2:** Execute the following query from on PostgreSQL to terminate all active connections. Replace `catalog` with your database name.

```
SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = 'catalog';

```

You will get the following output.

```
 pg_terminate_backend 
----------------------
 t
(1 row)
```

**Step 3:** Delete the database using the DROP command.

```
 DROP DATABASE dvdrental;
```