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 1pLAKn-0001QC-7d for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Jan 2023 22:03:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pLAKm-0006h8-4I for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Jan 2023 22:03:04 +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 1pLAKl-0006gz-Rk for pgsql-hackers@lists.postgresql.org; Thu, 26 Jan 2023 22:03:03 +0000 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pLAKj-0005SF-Cc for pgsql-hackers@postgresql.org; Thu, 26 Jan 2023 22:03:03 +0000 Received: by mail-pj1-x1036.google.com with SMTP id z1-20020a17090a66c100b00226f05b9595so3121048pjl.0 for ; Thu, 26 Jan 2023 14:03:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=nmGMtnk7xaB5H7okLSJFOZdDoHKiMINdDrG34JVWUF0=; b=FSp0WOCqhbSQa3bdgQnUUH1eqTMhhJIX9w+zwWirnSR5jLjMUlOxtMEjtk/3VOdSnl hhqvuj3Q6EEKBWloEtMv6rwLtOZQkL2+vyQRiVvcewJPT/e4VbIl22emqSxM/tRJJ/2n LY6P85LQ+ByoctEthBiiaxncQcNPtdYQQd/+zu8jiKX/xuApzzG772M1PUs83fhgfPyj oz8fh9rGVYSz5huJevlMTtk1e/nLn/VunUJnzdJdw2tSkIeLzv7khLXsf5Y5hzJydJfe FDXckuzVEyAervXnY9F1x1NzeTIiLKtQt9NOtjEa920Ml/2Zf5d7PXegxvFLAZ4gjAu/ 1rcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=nmGMtnk7xaB5H7okLSJFOZdDoHKiMINdDrG34JVWUF0=; b=wOLr751E8278goFmI6Jg2KkRG20OY06s9HzbddutBXcxo3/k7wL3GgkB1JK7MnKy0W uNGcvD7R4i3Rwn54JpWR8vOpfmhr9N3UfagfrwJTIIwoHvXTWMvTuK2jPkwLT/qK9B9Q +yUTQkuedYkhNGhT0x9ffcHIkHfYb5ili8nS9BWEXeijSEQejWv/8CTvHvCb+vvYsPnA DZR/MerAOKADrrshak1Fsuoo+xbrdqv0aClqD5WQsnUaNnvbaj30Y8Ql6AdR/UjIcwYy DxfnPWXKIUWBDZ8EpMfYKiBmY9lzaxoDAeBsTbeQOlFzu4O5dMF8BrheNxSIhvf9UG0f gc3w== X-Gm-Message-State: AO0yUKXd9cl33yJMgiXitR/y4s10D9oeM1Laz8ITx4Jy5AvOAfhxcZSJ RRgumBBZTDOORUqfR5ah/dc= X-Google-Smtp-Source: AK7set+0CcMylxiwwwesCo99nshzUhhkcFhCwRPB3AiFSYG6bcqY5W0i3imd967MHe1kjRCyYem23A== X-Received: by 2002:a05:6a20:7b23:b0:af:ca6c:7d9f with SMTP id s35-20020a056a207b2300b000afca6c7d9fmr3254007pzh.19.1674770579089; Thu, 26 Jan 2023 14:02:59 -0800 (PST) Received: from nathanxps13 ([50.47.162.83]) by smtp.gmail.com with ESMTPSA id g12-20020a63374c000000b00476d1385265sm1152396pgn.25.2023.01.26.14.02.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 14:02:56 -0800 (PST) Date: Thu, 26 Jan 2023 14:02:53 -0800 From: Nathan Bossart To: Tom Lane Cc: Robert Haas , Alvaro Herrera , "pgsql-hackers@postgresql.org" Subject: Re: improving user.c error messages Message-ID: <20230126220253.GA1759865@nathanxps13> References: <20230126002251.GA1506128@nathanxps13> <20230126090739.nspznasnb4x3v5l4@alvherre.pgsql> <20230126191358.GA1660026@nathanxps13> <20230126195929.GB1702315@nathanxps13> <3165700.1674763663@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3165700.1674763663@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Jan 26, 2023 at 03:07:43PM -0500, Tom Lane wrote: > Nathan Bossart writes: >> On Thu, Jan 26, 2023 at 02:42:05PM -0500, Robert Haas wrote: >>> Basically my question is whether having one error message for all of >>> those cases is good enough, or whether we should be trying harder. > > I think the password case needs to be kept separate, because the > conditions for it are different (specifically the exception that > you can alter your own password). Lumping the rest together > seems OK to me. Hm. In v2, the error message for both cases is the same: ERROR: permission denied to alter role DETAIL: You must have CREATEROLE privilege and ADMIN OPTION on role "regress_priv_user2". We could add "to change its attributes" and "to change its password" to separate the two, but I'm not sure that adds much. ISTM the current error message for ALTER ROLE PASSWORD implies that you can change your own password, and that's lost with my patch. Perhaps we should add an errhint() with that information instead. WDYT? -- Nathan Bossart Amazon Web Services: https://aws.amazon.com