Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jPR3t-0008HO-L9 for pgsql-bugs@arkaria.postgresql.org; Fri, 17 Apr 2020 13:29:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jPR3s-00019J-K3 for pgsql-bugs@arkaria.postgresql.org; Fri, 17 Apr 2020 13:29:40 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jPR3s-00019C-E0 for pgsql-bugs@lists.postgresql.org; Fri, 17 Apr 2020 13:29:40 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jPR3q-000278-85 for pgsql-bugs@lists.postgresql.org; Fri, 17 Apr 2020 13:29:40 +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 03HDTabn018976; Fri, 17 Apr 2020 09:29:36 -0400 From: Tom Lane To: 369358123@qq.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16374: I can't directly change owner from my created database to my created user. In-reply-to: <16374-7ef684e3fe909b74@postgresql.org> References: <16374-7ef684e3fe909b74@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Fri, 17 Apr 2020 12:50:06 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <18974.1587130176.1@sss.pgh.pa.us> Date: Fri, 17 Apr 2020 09:29:36 -0400 Message-ID: <18975.1587130176@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk PG Bug reporting form writes: >> **postgres=> alter database db1 owner to user1;** >> **2020-04-17 16:37:04.328 CST [4712] ERROR: must be member of role > "user1"** > However, "user1" is my created, and "db1" is my created too. Why couldn't I > chenge owner of "db1" to "user1" directly? Like it says, you're not a member of role user1. Since you have createrole privilege, you could make yourself a member: regression=> grant user1 to root; GRANT ROLE and then it'd work. But you didn't. (This is one of the ways that createrole is less powerful, and less dangerous, than superuser.) regards, tom lane