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 1rpaOV-007Rus-69 for pgsql-bugs@arkaria.postgresql.org; Wed, 27 Mar 2024 21:01:11 +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 1rpaOT-002VTj-AR for pgsql-bugs@arkaria.postgresql.org; Wed, 27 Mar 2024 21:01:09 +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 1rpaOT-002VTb-2B for pgsql-bugs@lists.postgresql.org; Wed, 27 Mar 2024 21:01:09 +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 1rpaOO-006qqU-KZ for pgsql-bugs@lists.postgresql.org; Wed, 27 Mar 2024 21:01:08 +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 42RL0xuH3442034; Wed, 27 Mar 2024 17:00:59 -0400 From: Tom Lane To: myanodress@gmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18411: Unable to create database with owner on AWS RDS In-reply-to: <18411-fdfca450bc4e7dd8@postgresql.org> References: <18411-fdfca450bc4e7dd8@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Wed, 27 Mar 2024 17:32:16 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3442032.1711573259.1@sss.pgh.pa.us> Date: Wed, 27 Mar 2024 17:00:59 -0400 Message-ID: <3442033.1711573259@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: > Using the postgres user on AWS RDS, execution of > CREATE USER my_user WITH PASSWORD 'my-user-password'; > CREATE DATABASE my_database WITH OWNER=my_user; > Results in an error: > ERROR: must be able to SET ROLE "my_user" > SQL state: 42501 > However, the following succeeds > CREATE USER my_user WITH PASSWORD 'my-user-password'; > CREATE DATABASE my_database; > ALTER DATABASE my_database OWNER TO my_user; > Is this intended behaviour or am I taking advantage of a bug by creating the > database and then setting the OWNER using ALTER DATABASE? Both things fail for me: regression=# create user admin with createrole createdb; CREATE ROLE regression=# \c - admin You are now connected to database "regression" as user "admin". regression=> CREATE USER my_user WITH PASSWORD 'my-user-password'; CREATE ROLE regression=> CREATE DATABASE my_database WITH OWNER=my_user; ERROR: must be able to SET ROLE "my_user" regression=> CREATE DATABASE my_database; CREATE DATABASE regression=> ALTER DATABASE my_database OWNER TO my_user; ERROR: must be able to SET ROLE "my_user" I suggest taking this up with AWS. regards, tom lane