Skip to content

Commit a6c8221

Browse files
committed
docs: update README with PostgreSQL 18 and role management features
- Update PostgreSQL client installation from version 12 to 18 - Update requirements to reference PostgreSQL 18 as latest - Add Key Features section documenting r1/r2 role management tools - Include usage examples and security notes for role management
1 parent 7530d44 commit a6c8221

File tree

1 file changed

+32
-2
lines changed

1 file changed

+32
-2
lines changed

README.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ Questions? Ideas? Contact me: [email protected], Nikolay Samokhvalov.
2222
## Requirements
2323

2424
**You need to have psql version 10 or newer**, but the Postgres server itself can be older – most tools work with it.
25-
You can install postgresql-client library version, say, 12 on your machine and use it to work with Postgres server version 9.6 and older – in this case postgres_dba will work. But you do need to have psql from the latest (version 12) Postgres release.
25+
You can install the latest postgresql-client library on your machine and use it to work with older Postgres servers – in this case postgres_dba will work. It's recommended to use psql from PostgreSQL 18 (the latest release) for the best compatibility.
2626

2727
On clean Ubuntu, this is how you can get postgresql-client and have the most recent psql:
2828
```
2929
sudo sh -c "echo \"deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main\" >> /etc/apt/sources.list.d/pgdg.list"
3030
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
3131
sudo apt-get update
32-
sudo apt-get install -y postgresql-client-12
32+
sudo apt-get install -y postgresql-client-18
3333
```
3434

3535
Using alternative psql pager called "pspg" is highly recommended (but not required): https://github.com/okbob/pspg.
@@ -95,6 +95,36 @@ And then:
9595
:dba
9696
```
9797

98+
## Key Features
99+
100+
### Secure Role Management
101+
102+
**postgres_dba** includes interactive tools for secure role (user) management:
103+
104+
- **r1** – Create user with random password (interactive)
105+
- **r2** – Alter user with random password (interactive)
106+
107+
These tools help prevent password exposure in psql history, logs, and command-line process lists by:
108+
- Generating secure random 16-character passwords
109+
- Using interactive prompts instead of command-line arguments
110+
- Only displaying the password once at creation/alteration time
111+
112+
**Usage example:**
113+
```sql
114+
-- In psql, after launching :dba
115+
-- Select option r1 to create a new user
116+
-- The script will prompt you for:
117+
-- - Username
118+
-- - Superuser privilege (yes/no)
119+
-- - Login privilege (yes/no)
120+
-- The generated password will be displayed once in the output
121+
122+
-- To see the password, set client_min_messages to DEBUG first:
123+
set client_min_messages to DEBUG;
124+
```
125+
126+
**Security note:** These are DBA tools designed for trusted environments where the user already has superuser privileges. The password is shown in the psql output, so ensure you're working in a secure session.
127+
98128
## How to Extend (Add More Queries)
99129
You can add your own useful SQL queries and use them from the main menu. Just add your SQL code to `./sql` directory. The filename should start with some 1 or 2-letter code, followed by underscore and some additional arbitrary words. Extension should be `.sql`. Example:
100130
```

0 commit comments

Comments
 (0)