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 1pcpSo-0003cT-L5 for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Mar 2023 15:24:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pcpSm-0004Fg-9w for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Mar 2023 15:24:20 +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 1pcpSl-0004FW-Ax for pgsql-hackers@lists.postgresql.org; Thu, 16 Mar 2023 15:24:19 +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 1pcpSf-0002lb-Qm for pgsql-hackers@postgresql.org; Thu, 16 Mar 2023 15:24:18 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id CD8D22B06851; Thu, 16 Mar 2023 11:24:10 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 16 Mar 2023 11:24:11 -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= 1678980250; x=1678987450; bh=YlpUVJH9q5RIj9uwQbxdf2TKsMzhtdszMo0 QEAywk+k=; b=Ub02zy0fx7+AA6IzTc6PG7KO97u6jIEj3Fk3l7zf1aKL4JNs4B3 byXvZDvbwxL9UnTk9tJlmWhZaWxIPXEVl8hE2/XG7tQAOfpQ/2uxMTrkWk24I1sB 049fVvNF0MQEOr/E1a+7uvdiOKdWXgJSj5cUarH7EHmIWd9Ab8rIM8jskAYMozfg gFjy+p5P8rqi8KLrc5kMcd1qyUC9kXlw8/lSXZBsOnFO2bxuDSlXzDtvZnSFooze 1QKBd9g8B65axnN3ZaXwtcYTn2L0NgSIw9gWM0PyJyX0Sa06tWdBNvJ+xuln7CzC PQyGsbHYYSFYpt+DgMttYE/9Q67yzbpNlzQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdeftddgjeejucetufdoteggodetrfdotf 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:24:09 -0400 (EDT) Message-ID: Date: Thu, 16 Mar 2023 16:24:07 +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: <20230127000936.GA1998073@nathanxps13> <20230127183119.e5jtyh4g2md57ctb@alvherre.pgsql> <20230127231507.GA2221340@nathanxps13> <20230207201009.GA450353@nathanxps13> <20230220190210.GA3481922@nathanxps13> <20230220225852.GA3940888@nathanxps13> <20230309175846.GA3626988@nathanxps13> <20230310000313.GA3992372@nathanxps13> From: Peter Eisentraut In-Reply-To: <20230310000313.GA3992372@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 10.03.23 01:03, Nathan Bossart wrote: >>> By the way, I'm not sure what the separation between 0001 and 0002 is >>> supposed to be. >> I'll combine them. I first started with user.c only, but we kept finding >> new messages to improve. > I combined the patches in v7. I have committed two pieces that were not message changes separately. 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().) That was the only "factual" error that I found. In file_fdw_validator(), the option names "filename" and "program" could be parameterized. In DropOwnedObjects() and ReassignOwnedObjects(), I suggest the following changes, for clarity: - errdetail("Only roles with privileges of role \"%s\" may drop its objects.", + errdetail("Only roles with privileges of role \"%s\" may drop objects owned by it.", - errdetail("Only roles with privileges of role \"%s\" may reassign its objects.", + errdetail("Only roles with privileges of role \"%s\" may reassign objects owned by it.", The rest looks okay to me.