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 1mde77-0001IJ-3G for pgsql-general@arkaria.postgresql.org; Thu, 21 Oct 2021 19:52:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mde75-0005sC-31 for pgsql-general@arkaria.postgresql.org; Thu, 21 Oct 2021 19:52:31 +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 1mde74-0005s3-Ps for pgsql-general@lists.postgresql.org; Thu, 21 Oct 2021 19:52:30 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mde72-0001Gb-MN for pgsql-general@lists.postgresql.org; Thu, 21 Oct 2021 19:52:29 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 1DC605C023A; Thu, 21 Oct 2021 15:52:28 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 21 Oct 2021 15:52:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=P BR2H9VE95/ofkTjcWXdQgg+YBXH2ahPB8XWJLCIzsU=; b=KC1B7913i4gGI/EvD FAv2xcNLBfnyAzwJG3o5N3JJWmi6GALaStSY0CgCTfwIfIPZnruPXUOTnjF2pQKD foXarf/sXnFzno4Z06wJKhvLtIAbfGcwzSY3JKOPynJXUQ4u5PslFNf/XmQnE9Js /sqpDf95CgJ+fC7UqKEZnGdsHVqYp/Iw21nCyCiM/KohdfhN7R2VGHG+b34gJeqR oJDtZxrQSWjIdUy3e9+VN3q5nF+Wafm5T/c5v8UCi2ailf2nkiH73zWhoe/ABmIu Bj+E6fW6r0oautNA6Fa0AdZQsy+n+DB2vOH2A2GBTW8osAGrrULCS+0nfQKqnAWm 6uIGQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=PBR2H9VE95/ofkTjcWXdQgg+YBXH2ahPB8XWJLCIz sU=; b=QXQaeqWqdEXBJgctaXIQDcsSrqnFgg+6GZ/xnf4V6qiJM0hUQwyFYW/aW Kzk7Un9BxAeU7eH1PzjDxONYqJ7PBGOmMzGuKm6xuKZP263hrX4Xxrw5AnvZNMhi sCELGueysk08ch5TvnLkseD/ctOr9z13N0IU9V2H19uIhC+OYFgn8u1oOxpj880N hG0UZo+zvD1Pn9G/NZ+O2rfmV5sgj4g4VJWZHKgsOblxDp6T3d9mih24HPfviK4e uJhNj8g7LuBi5GiFrT8a7xg7x+gMUB+YdPKyP7CYZ+/YsC3YVbphdXBy+lfd44gM tG6iwy+yRnz3EOCLnLgm7SLx1PJNg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddviedgudegtdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepkfffgggfuffvfhfhjggtgfesth ejredttdefjeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdr khhlrghvvghrsegrkhhlrghvvghrrdgtohhmqeenucggtffrrghtthgvrhhnpeevvdekie fhudfhhfdtkeelgeffudeigfetjeegfffghfetfeelledugfelleegveenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrg hvvghrsegrkhhlrghvvghrrdgtohhm X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 21 Oct 2021 15:52:27 -0400 (EDT) Message-ID: Date: Thu, 21 Oct 2021 12:52:26 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: Can db user change own password? Content-Language: en-US To: Tom Lane Cc: Toomas , Vijaykumar Jain , pgsql-general References: <62f56a19-0504-4d7b-5f73-b10e8206642a@aklaver.com> <7FC82398-5C8C-4F2D-9620-D16E54E77091@gmail.com> <2424680.1634835237@sss.pgh.pa.us> <2440551.1634838273@sss.pgh.pa.us> From: Adrian Klaver In-Reply-To: <2440551.1634838273@sss.pgh.pa.us> 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/21/21 10:44, Tom Lane wrote: > Adrian Klaver writes: >> On 10/21/21 09:53, Tom Lane wrote: >> I would suggest session(_)user to make it match with the rest of >> documentation. > > But that's not right either. > > regression=# select session_user; > session_user > -------------- > postgres > (1 row) > > regression=# create user joe; > CREATE ROLE > regression=# set session authorization joe; > SET > regression=> select session_user; > session_user > -------------- > joe > (1 row) > > regression=> \password > Enter new password: > Enter it again: > ERROR: must be superuser to alter superuser roles or change superuser attribute > regression=> Hmm, I'm striking out on this one. Just now grasped that PQuser() is grabbing a user/role from the connection itself and that the effective role could be something entirely different. > > Another angle to this: even without SET SESSION AUTHORIZATION, the > existence of username mapping options in the pg_hba machinery means that > the role name that psql thought it logged in with might have nothing to do > with the role name that the server thinks is the authenticated user. > There might be no SQL role by that name at all. So what psql is doing > here is flat-out wrong. I'm still hesitant about changing the behavior in > the back branches, though, especially given the lack of prior complaints. > > regards, tom lane > -- Adrian Klaver adrian.klaver@aklaver.com