Thread

Commits

  1. Fix an ALTER GROUP ... DROP USER error message.

  2. Improve several permission-related error messages.

  3. Make role grant system more consistent with other privileges.

  1. Fix a wrong errmsg in AlterRole()

    cca5507 <cca5507@qq.com> — 2025-01-08T08:43:32Z

    Hi,
    
    
    ```
    postgres=# create group g1;
    CREATE ROLE
    postgres=# create role r1 in group g1;
    CREATE ROLE
    postgres=# set session authorization r1;
    SET
    postgres=&gt; alter group g1 drop user r1;
    ERROR:&nbsp; permission denied to alter role
    DETAIL:&nbsp; Only roles with the ADMIN option on role "g1" may add members.
    ```
    
    
    The errmsg is "add members", but we are doing a drop.
    
    
    Here is a small patch to fix it.
    
    
    --
    Regards,
    ChangAo Chen
  2. Re: Fix a wrong errmsg in AlterRole()

    Tom Lane <tgl@sss.pgh.pa.us> — 2025-01-08T15:29:12Z

    "=?ISO-8859-1?B?Y2NhNTUwNw==?=" <cca5507@qq.com> writes:
    > postgres=&gt; alter group g1 drop user r1;
    > ERROR:  permission denied to alter role
    > DETAIL:  Only roles with the ADMIN option on role "g1" may add members.
    
    > The errmsg is "add members", but we are doing a drop.
    > Here is a small patch to fix it.
    
    Hmm.  Seems simpler to just make the errdetail say "... may add or
    drop members."
    
    			regards, tom lane
    
    
    
    
  3. Re: Fix a wrong errmsg in AlterRole()

    Nathan Bossart <nathandbossart@gmail.com> — 2025-01-08T17:39:31Z

    On Wed, Jan 08, 2025 at 10:29:12AM -0500, Tom Lane wrote:
    > "=?ISO-8859-1?B?Y2NhNTUwNw==?=" <cca5507@qq.com> writes:
    >> postgres=&gt; alter group g1 drop user r1;
    >> ERROR:  permission denied to alter role
    >> DETAIL:  Only roles with the ADMIN option on role "g1" may add members.
    > 
    >> The errmsg is "add members", but we are doing a drop.
    >> Here is a small patch to fix it.
    > 
    > Hmm.  Seems simpler to just make the errdetail say "... may add or
    > drop members."
    
    +1.  It looks like this goes back to commit ce6b672 (v16).  The error
    message was changed in commit de4d456, which is also a v16 change, so
    fortunately this has a good chance of back-patching cleanly.
    
    -- 
    nathan
    
    
    
    
  4. Re: Fix a wrong errmsg in AlterRole()

    cca5507 <cca5507@qq.com> — 2025-01-09T02:13:11Z

    Hi,
    
    I modified the patch according to Tom's suggestion.
    
    
    --
    Regards,
    ChangAo Chen
  5. Re: Fix a wrong errmsg in AlterRole()

    Nathan Bossart <nathandbossart@gmail.com> — 2025-01-09T18:27:20Z

    On Thu, Jan 09, 2025 at 10:13:11AM +0800, cca5507 wrote:
    > I modified the patch according to Tom's suggestion.
    
    LGTM.  I'll plan on committing this shortly.
    
    -- 
    nathan
    
    
    
    
  6. Re: Fix a wrong errmsg in AlterRole()

    Nathan Bossart <nathandbossart@gmail.com> — 2025-01-09T23:19:20Z

    On Thu, Jan 09, 2025 at 12:27:20PM -0600, Nathan Bossart wrote:
    > LGTM.  I'll plan on committing this shortly.
    
    Committed.
    
    -- 
    nathan