| From: | Yuhang Qiu <iamqyh(at)gmail(dot)com> |
|---|---|
| To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | [PATCH] Add ALTER SYSTEM RELOAD |
| Date: | 2026-09-23 09:44:29 |
| Message-ID: | 5A1F1E3B-D22F-487B-9480-D3DDB5F0C2A1@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi hackers,
For configuration parameters that can be reloaded, administrators often need
to perform two steps in succession:
```sql
ALTER SYSTEM SET work_mem = '64MB';
SELECT pg_reload_conf();
```
I propose adding `ALTER SYSTEM RELOAD`, so the sequence can be written as:
```sql
ALTER SYSTEM SET work_mem = '64MB';
ALTER SYSTEM RELOAD;
```
`ALTER SYSTEM` is already the SQL interface for changing server configuration,
and reloading is a common next step. Keeping both steps in the same command
family would make the workflow easier to discover, without requiring users to
find a separate function for the second step. I also think `ALTER SYSTEM` is a
more natural interface for administrative operations than function calls.
`pg_reload_conf()` would remain available.
The privilege difference is a possible concern: this patch requires a
superuser for `ALTER SYSTEM RELOAD`, while `pg_reload_conf()` can be granted to
other roles. I am unsure whether this divergence would be acceptable. The new
command cannot run inside a transaction block, but I consider this a benefit: a
reload request cannot be rolled back.
In my experience with `psql`, commands are also easier to complete with Tab;
I cannot complete the function call in the same way. Adding `RELOAD` means
that `RE` will match both `RELOAD` and `RESET`, so the `RE` prefix will no
longer uniquely complete either command. Even with that drawback, I find the
command form more convenient overall.
I think log rotation (`ALTER SYSTEM ROTATE LOG`) and standby promotion
(`ALTER SYSTEM PROMOTE`) are also promising directions for this command family.
This patch proposes only `RELOAD`. I would appreciate feedback on whether
`ALTER SYSTEM` is the right place for this operation.
Best regards,
Yuhang Qiu
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Add-ALTER-SYSTEM-RELOAD.patch | application/octet-stream | 14.0 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ashutosh Sharma | 2026-09-23 09:51:00 | Re: Switching XLog source from archive to streaming when primary available |
| Previous Message | Jeevan Chalke | 2026-09-23 09:39:22 | Re: postgres_fdw: push down FETCH FIRST .. WITH TIES when server version allows |