Limitation in `pg_lsclusters` and `pg_dropcluster --stop` on Debian-based Systems

From: AKASH <akashbhujbal7051(at)gmail(dot)com>
To: submit(at)bugs(dot)debian(dot)org, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Limitation in `pg_lsclusters` and `pg_dropcluster --stop` on Debian-based Systems
Date: 2025-02-18 05:04:12
Message-ID: CABaoBc6OA6M=DB0pWTuiu-7Or9NPCaR=B4gkFFx2j0JzkZu2bw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Package:`postgresql-common`
Version:17
Severity:Wishlist
Reported by:Akash
Date:18/02/2025

There are a couple of limitations observed with the PostgreSQL management
utilities `pg_lsclusters` and `pg_dropcluster --stop` on Debian-based
systems. These limitations may impact users managing PostgreSQL clusters
manually or with custom configurations. Below are the details:

1. `pg_lsclusters` Does Not List Manually Created Clusters

Limitation:
The `pg_lsclusters` utility currently does not list clusters that are
manually created using `initdb` and `pg_ctl`. These clusters are running
and functional but do not appear in the `pg_lsclusters` output.

Suggested Enhancement:
It would be useful if `pg_lsclusters` could detect and display all running
PostgreSQL clusters, including those created manually, for better
visibility and management.

2. `pg_lsclusters` Does Not Reflect Custom Ports

Limitation:
When a PostgreSQL cluster is started with a custom port using
`pg_ctlcluster` (e.g., `-o "-p <port>"`), `pg_lsclusters` reports the
default port from the `postgresql.conf` file, not the actual port in use by
the running instance.

Suggested Enhancement:
`pg_lsclusters` could be updated to reflect the actual runtime port of the
PostgreSQL process, providing accurate information for users.

3.`pg_dropcluster --stop` Deletes Clusters Without Confirmation

Limitation:
The `pg_dropcluster --stop` command deletes the PostgreSQL cluster
immediately without any confirmation prompt or warning.

Suggested Enhancement:
Adding a confirmation prompt or warning message before proceeding with the
deletion of a PostgreSQL cluster would help prevent accidental data loss.

Expected Behavior:

1. For `pg_lsclusters`:
The utility should list manually created clusters and reflect the actual
runtime port in use.

2. For `pg_dropcluster --stop`:
The command should prompt for confirmation before dropping a cluster to
avoid unintentional data loss.

Suggested Fixes:

1. For `pg_lsclusters`:
Modify the utility to scan for all PostgreSQL clusters, including
manually created ones, and check the actual running PostgreSQL process for
port information.

2. For `pg_dropcluster --stop`:
Introduce a confirmation prompt or warning before dropping a cluster to
protect users from accidental deletion.

Environment:
- **Operating System:** Debian-based system (e.g., Ubuntu 24.04)
- **PostgreSQL Version:** 17
- **Debian Package Version:** `postgresql-common` (version related to
PostgreSQL 17)

Additional Information:
Replication images are included to provide further clarification of the
observed limitations. Please refer to the attached images for more detailed
examples.

pg_dropcluster
sudo pg_dropcluster 17 main
WARNING: You are about to delete the PostgreSQL cluster 17/main.
This action is irreversible and will permanently delete all data.
Are you sure? (yes/no):

Like this I have added the option while dropping the cluster

Thank you for considering this request. Please feel free to contact me if
you need additional information or clarification on the suggestions
described.

Sincerely,
Akash

Attachment Content-Type Size
Screenshot from 2025-02-18 10-27-47.png image/png 120.5 KB
image/png 54.8 KB
image/png 46.6 KB

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2025-02-18 05:17:36 Re: Limitation in `pg_lsclusters` and `pg_dropcluster --stop` on Debian-based Systems
Previous Message Amit Langote 2025-02-18 05:03:16 Re: BUG #18806: When enable_rartitionwise_join is set to ON, the database shuts down abnormally