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 1pcpqq-0004YA-Me for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Mar 2023 15:49:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pcpqp-0005JJ-H8 for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Mar 2023 15:49:11 +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 1pcpqp-0005J9-67 for pgsql-hackers@lists.postgresql.org; Thu, 16 Mar 2023 15:49:11 +0000 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pcpqg-0001CC-Pv for pgsql-hackers@postgresql.org; Thu, 16 Mar 2023 15:49:10 +0000 Received: by mail-pf1-x432.google.com with SMTP id ay18so1413087pfb.2 for ; Thu, 16 Mar 2023 08:49:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678981740; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Du+BSS3RiEwnhNlaNTsxSQY6cr8uqYGewPouKSzj5GI=; b=SYSSMKYMU6e6ZGIhYu+lvxqYgR8+yRAkUD4wenxuiGfvxO7/9REWOtpNeuJsea9ck0 HtkhBB0gBzxoOBJyyPS5bJ2M0XQnaoGs90AmlC4YEsB9VvFHxzMDvwXdZliV1VtLbAyb glQc46Z+vH2FtgN50H+R4YI7xuwhx+LjXcqd/TuqawA+iGWIYaqO5LcctbTSe4DdFwLe FZBwtn+mbqvOywZVl7Dd0IgUUn//C9m/kgTag++agoeA0YFNdCah5Wn15jgBCFVOJ+B6 TSiBN6d2pPpMg4w0GbvETWalXpQFXeTheukIcRyGhV1zgaSjqxOm3i50OAKvwgKN0GeY PoKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678981740; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Du+BSS3RiEwnhNlaNTsxSQY6cr8uqYGewPouKSzj5GI=; b=uXw+59RxODvK39aCrSqXYeRHIjy6q5VgbIXREwuRjxeZUlPrcnBupBsE1M8cZS+a1+ F6CGd3JvmcC8hnKZGMok5OenpxnRIMdSdUi5LPCAVJBGeVxSIPrgIWAoJ42z/HlPLeHo 4K0FpsOnnQ5gIzGXt9x1gNAY4aruGIgf1hMg79i7qF3PqS7esYplePreOornXZFY9VjP ME9S/PCochR4a17IPSso1AMxbma8GqahphtJgCIXV0Ank56oqoDFgPv4CiDrYdZpbG7K b8O+tIkNxSS5eamPOSWZBCguPYGTDGuUt2KmrwoGFl4OPxYC4+whAFJ+fuE550zdMdaG 3dhA== X-Gm-Message-State: AO0yUKUx898o6Rjhmja9rbn39+1UTWcLxi44vNE6CsoNXJp//iFYYq25 xT7O7Df4LnmYPZlO0RzOOOw= X-Google-Smtp-Source: AK7set/8iXrKjQHyy+bdIOOTnuJI3EuoK4suV463f7uLcAgMWlVaAhTatbUkBKDyjzm4shbJZJMkyg== X-Received: by 2002:a62:6105:0:b0:625:826f:b81e with SMTP id v5-20020a626105000000b00625826fb81emr3283137pfb.7.1678981740413; Thu, 16 Mar 2023 08:49:00 -0700 (PDT) Received: from nathanxps13 ([50.47.162.83]) by smtp.gmail.com with ESMTPSA id p10-20020aa7860a000000b005921c46cbadsm5784745pfn.99.2023.03.16.08.48.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Mar 2023 08:48:59 -0700 (PDT) Date: Thu, 16 Mar 2023 08:48:58 -0700 From: Nathan Bossart To: Peter Eisentraut Cc: Alvaro Herrera , Tom Lane , Robert Haas , "pgsql-hackers@postgresql.org" Subject: Re: improving user.c error messages Message-ID: <20230316154858.GA791987@nathanxps13> References: <20230127183119.e5jtyh4g2md57ctb@alvherre.pgsql> <20230127231507.GA2221340@nathanxps13> <20230207201009.GA450353@nathanxps13> <20230220190210.GA3481922@nathanxps13> <20230220225852.GA3940888@nathanxps13> <20230309175846.GA3626988@nathanxps13> <20230310000313.GA3992372@nathanxps13> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Mar 16, 2023 at 04:24:07PM +0100, Peter Eisentraut wrote: > I have committed two pieces that were not message changes separately. Thanks! > 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. > 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.", Will do. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com