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 1pcq1L-0004tK-VI for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Mar 2023 16:00:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pcq1K-0001J7-9x for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Mar 2023 16:00:02 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pcq1J-0001HB-VT for pgsql-hackers@lists.postgresql.org; Thu, 16 Mar 2023 16:00:01 +0000 Received: from wnew1-smtp.messagingengine.com ([64.147.123.26]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pcq1G-00034U-Ko for pgsql-hackers@postgresql.org; Thu, 16 Mar 2023 16:00:00 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.west.internal (Postfix) with ESMTP id 7876D2B0694E; Thu, 16 Mar 2023 11:59:56 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Thu, 16 Mar 2023 11:59:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1678982396; x=1678989596; bh=lGbIdUzTjSvWgK6g+vW4I6qCcuWILF27eDh 5YQmFZ6U=; b=SYpeuI9+bFE1fVCqodXl+eLXT3GiGHYaLECs3dZmuiil0e2qsEZ bNBP9ZzPCHA7cYWbUnW/RBzS+T2/8yosVFHoAsx9ckPi1ZtlXGaYSNHKorWyLFlO KPtex/hSKIP52RpFvAFhE3H5r+Hmd1PJzi3lAA2MUcxJ5jYI8tHPqpk26qrgJdLY EGAlZC1p5l4Ttb3ORfu0EM6dskdAoEqBfj3O6I+VdLcgdKp3+MoAXoDwsC92DYE5 jD+8OH235qvT/oV61KCKATKKb+6G2jBMxigI9ENHLWuLUgay8jut/+USWTRCCIyy xVDwQqwbvok11UxPz+6nk0aQHq2fRKEJEcA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdeftddgkeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpefrvght vghrucfgihhsvghnthhrrghuthcuoehpvghtvghrrdgvihhsvghnthhrrghuthesvghnth gvrhhprhhishgvuggsrdgtohhmqeenucggtffrrghtthgvrhhnpeehleffgeegudejteei hfelteduvdeifffhffdvjedvffegjeekudeludehudeifeenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpvghtvghrrdgvihhsvghnthhrrghu thesvghnthgvrhhprhhishgvuggsrdgtohhm X-ME-Proxy: Feedback-ID: i131946ab:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 16 Mar 2023 11:59:54 -0400 (EDT) Message-ID: <73ab0059-a652-e44a-73c6-36f350782078@enterprisedb.com> Date: Thu, 16 Mar 2023 16:59:53 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: improving user.c error messages Content-Language: en-US To: Nathan Bossart Cc: Alvaro Herrera , Tom Lane , Robert Haas , "pgsql-hackers@postgresql.org" References: <20230127183119.e5jtyh4g2md57ctb@alvherre.pgsql> <20230127231507.GA2221340@nathanxps13> <20230207201009.GA450353@nathanxps13> <20230220190210.GA3481922@nathanxps13> <20230220225852.GA3940888@nathanxps13> <20230309175846.GA3626988@nathanxps13> <20230310000313.GA3992372@nathanxps13> <20230316154858.GA791987@nathanxps13> From: Peter Eisentraut In-Reply-To: <20230316154858.GA791987@nathanxps13> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 16.03.23 16:48, Nathan Bossart wrote: >> I think the following change in DropRole() is incorrect: >> >> if (!is_admin_of_role(GetUserId(), roleid)) >> ereport(ERROR, >> (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), >> - errmsg("must have admin option on role \"%s\"", >> - role))); >> + errmsg("permission denied to drop role"), >> + errdetail("Only roles with the %s attribute and the %s >> option on role \"%s\" may drop this role.", >> + "CREATEROLE", "ADMIN", >> NameStr(roleform->rolname)))); >> >> The message does not reflect what check is actually performed. (Perhaps >> this was confused with a similar but not exactly the same check in >> RenameRole().) > Hm. Is your point that we should only mention the admin option here? I > mentioned both createrole and admin option in this message (and the > createrole check above this point) in an attempt to avoid giving partial > information. AFAICT, the mention of CREATEROLE is incorrect, because the code doesn't actually check for the CREATEROLE attribute.