Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bMk0n-0004b4-SI for pgsql-bugs@arkaria.postgresql.org; Mon, 11 Jul 2016 22:49:13 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bMk0n-0005YA-FC for pgsql-bugs@arkaria.postgresql.org; Mon, 11 Jul 2016 22:49:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bMk0m-0005Xk-Sb for pgsql-bugs@postgresql.org; Mon, 11 Jul 2016 22:49:12 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bMk0j-0008RS-Af for pgsql-bugs@postgresql.org; Mon, 11 Jul 2016 22:49:12 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u6BMn6V7014435; Mon, 11 Jul 2016 18:49:06 -0400 From: Tom Lane To: bossartn@amazon.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #14242: Role with a setconfig "role" setting to a nonexistent role causes pg_upgrade to fail In-reply-to: <20160711223641.1426.86096@wrigleys.postgresql.org> References: <20160711223641.1426.86096@wrigleys.postgresql.org> Comments: In-reply-to bossartn@amazon.com message dated "Mon, 11 Jul 2016 22:36:41 -0000" Date: Mon, 11 Jul 2016 18:49:06 -0400 Message-ID: <14434.1468277346@sss.pgh.pa.us> X-Pg-Spam-Score: -3.2 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org bossartn@amazon.com writes: > It is possible to modify the "role" setting in setconfig in the > pg_db_role_setting table such that it points to a nonexistent role. When > this is the case, restoring the output of pg_dumpall will fail due to the > missing role. > Steps to reproduce: > 1. As superuser, execute "create role foo with login password 'test'" > 2. As foo, execute "alter role foo set role = 'foo'" > 3. As superuser, execute "alter role foo rename to bar" > a. At this point, the setconfig entry in pg_db_role_setting for > 'bar' will contain '{role=foo}', which no longer exists > 4. Execute pg_upgrade with the recommended steps in > https://www.postgresql.org/docs/current/static/pgupgrade.html > During pg_upgrade (more specifically, during the restore of the output from > pg_dumpall), the "ALTER ROLE "bar" SET "role" TO 'foo'" command generated > will fail with "ERROR: role "foo" does not exist". This does not seem like particularly a bug to me. Once you rename the role, the ALTER ROLE SET setting is broken already, and it's on your head to fix that, not pg_upgrade's. (Or in other words, promising that pg_upgrade will succeed in already-malfunctioning installations seems to me like a slope we'd better not start down.) I am kind of wondering why we allow that parameter to be set in ALTER ROLE/DATABASE SET at all, though; especially by unprivileged users. Is this example based on a real use-case, and if so what is it? regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs