Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tD40X-00FbFE-0r for pgsql-bugs@arkaria.postgresql.org; Mon, 18 Nov 2024 15:49:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tD40S-005hIh-Rn for pgsql-bugs@arkaria.postgresql.org; Mon, 18 Nov 2024 15:49:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tD40S-005hIY-Ip for pgsql-bugs@lists.postgresql.org; Mon, 18 Nov 2024 15:49:41 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tD40Q-002b76-H2 for pgsql-bugs@lists.postgresql.org; Mon, 18 Nov 2024 15:49:40 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 4AIFnarV3305918; Mon, 18 Nov 2024 10:49:36 -0500 From: Tom Lane To: mittalhanumant@gmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18713: pg_upgrade fails when owner of an extension is changed or dropped In-reply-to: <18713-21afc479c25cce4b@postgresql.org> References: <18713-21afc479c25cce4b@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Mon, 18 Nov 2024 13:38:30 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3305916.1731944976.1@sss.pgh.pa.us> Date: Mon, 18 Nov 2024 10:49:36 -0500 Message-ID: <3305917.1731944976@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > pg_upgrade from pg14 to pg15 fails with error of this kind: > ``` > pg_restore: from TOC entry 3999; 0 0 ACL FUNCTION > "pg_stat_statements_reset"("userid" "oid", "dbid" "oid", "queryid" bigint) > newuser > pg_restore: error: could not execute query: ERROR: role "16384" does not > exist > ``` > Condition that seems to be triggering this is if we create an extension with > one user (e.g. olduser), reassigned to another user (e.g. newuser) and drop > the olduser. Post that if we trigger pg_upgrade it fails. Yeah. I believe this is an instance of the known problems around DROP OWNED/REASSIGN OWNED not updating entries in pg_init_privs. See long discussion here: https://www.postgresql.org/message-id/flat/1745535.1712358659%40sss.pgh.pa.us v17 has improved that situation (though I don't claim that pg_dump is fully simpatico with reassigning an extension's owner even yet). There's no chance of doing anything about it in older branches, sadly, because they simply lack the catalog entries needed to detect that a problem even exists. Short-term advice is to not reassign the owner of an extension. regards, tom lane