Re: [PATCH] Add ALTER SYSTEM RELOAD

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: Yuhang Qiu <iamqyh(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Add ALTER SYSTEM RELOAD
Date: 2026-09-24 07:39:22
Message-ID: B254502B-2BF5-4A17-BA04-1E4AA6D878B3@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Sep 23, 2026, at 17:44, Yuhang Qiu <iamqyh(at)gmail(dot)com> wrote:
>
> 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
>
> <0001-Add-ALTER-SYSTEM-RELOAD.patch>

Thanks for the patch. After reading it, I have a concern. pg_reload_conf() relies on normal function privileges, so a super user can grant EXECUTE on it to a non-superuser. With this patch, the two interfaces for doing essentially the same thing would have different privilege models:

```
GRANT EXECUTE ON FUNCTION pg_reload_conf() TO some-user;

-- allowed
SELECT pg_reload_conf();

-- not allowed
ALTER SYSTEM RELOAD;
```

Is there a reason ALTER SYSTEM RELOAD needs stronger privileges than pg_reload_conf()?

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Jones 2026-09-24 07:48:25 Re: Temp schema drop leaves an inconsistent state behind
Previous Message Jeevan Chalke 2026-09-24 07:38:51 Re: Add PRODUCT() aggregate function