pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: andrewbille@gmail.com
Subject: BUG #17346: pg_upgrade fails with role granted by other role
Date: Mon, 27 Dec 2021 08:38:17 +0000
Message-ID: <17346-f72b28bd1a341060@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      17346
Logged by:          Andrew Bille
Email address:      andrewbille@gmail.com
PostgreSQL version: Unsupported/Unknown
Operating system:   Ubuntu 20.04
Description:        

Hello!
After the commit:

commit 371087d006e04991080bf17cf2287db38d3ea92e
Author: Daniel Gustafsson <dgustafsson@postgresql.org>
Date:   Fri Nov 26 14:02:01 2021 +0100

    Fix GRANTED BY support in REVOKE ROLE statements
    
    Commit 6aaaa76bb added support for the GRANTED BY clause in GRANT and
    REVOKE statements, but missed adding support for checking the role in
    the REVOKE ROLE case. Fix by checking that the parsed role matches the
    CURRENT_ROLE/CURRENT_USER requirement, and also add some tests for it.
    Backpatch to v14 where GRANTED BY support was introduced.
    
    Discussion:
https://postgr.es/m/B7F6699A-A984-4943-B9BF-CEB84C003527@yesql.se
    Backpatch-through: 14
    
pg_upgrade for example from 10.19 version causes the error:

10/bin/initdb -D d10
14/bin/initdb -D d14
10/bin/pg_ctl -D d10 -l logfile start
10/bin/psql -c "CREATE ROLE user1; CREATE ROLE user2; GRANT user1 TO user2
GRANTED BY user1;"
10/bin/pg_ctl -D d10 -l logfile stop
14/bin/pg_upgrade -d d10 -D d14 -b 10.19/bin/ -B 14/bin/

.........
Copying old pg_multixact/members to new server              ok
Setting next multixact ID and offset for new cluster        ok
Resetting WAL archives                                      ok
Setting frozenxid and minmxid counters in new cluster       ok
Restoring global objects in the new cluster                 
*failure*

Consult the last few lines of "pg_upgrade_utility.log" for
the probable cause of the failure.
Failure, exiting

Last lines of pg_upgrade_utility.log:
...
CREATE ROLE "user2";
CREATE ROLE
ALTER ROLE "user2" WITH NOSUPERUSER INHERIT NOCREATEROLE NOCREATEDB NOLOGIN
NOREPLICATION NOBYPASSRLS;
ALTER ROLE
GRANT "user1" TO "user2" GRANTED BY "user1";
psql:pg_upgrade_dump_globals.sql:37: ERROR:  grantor must be current user


Regards! Andrew Bille



view thread (7+ messages)  latest in thread

Message-ID: <17346-f72b28bd1a341060@postgresql.org>
Permalink:  ../17346-f72b28bd1a341060@postgresql.org/
Also on:    postgresql.org/message-id/17346-f72b28bd1a341060@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, andrewbille@gmail.com
  Subject: Re: BUG #17346: pg_upgrade fails with role granted by other role
  In-Reply-To: <17346-f72b28bd1a341060@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox