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: 0001-Add-ALTER-SYSTEM-RELOAD.patch
Description: Binary data

Reply via email to